Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f2319fcd
Commit
f2319fcd
authored
Dec 20, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 20, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Date.setYear implementation.
parent
3a2aae49
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
2 deletions
+64
-2
date.c
dlls/jscript/date.c
+36
-2
api.js
dlls/jscript/tests/api.js
+28
-0
No files found.
dlls/jscript/date.c
View file @
f2319fcd
...
...
@@ -2028,8 +2028,42 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
static
HRESULT
Date_setYear
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
DateInstance
*
date
;
DOUBLE
t
,
year
;
VARIANT
v
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
if
(
!
(
date
=
date_this
(
jsthis
)))
return
throw_type_error
(
ctx
,
ei
,
IDS_NOT_DATE
,
NULL
);
if
(
!
arg_cnt
(
dp
))
return
throw_type_error
(
ctx
,
ei
,
IDS_ARG_NOT_OPT
,
NULL
);
t
=
local_time
(
date
->
time
,
date
);
hres
=
to_number
(
ctx
,
get_arg
(
dp
,
0
),
ei
,
&
v
);
if
(
FAILED
(
hres
))
return
hres
;
year
=
num_val
(
&
v
);
if
(
isnan
(
year
))
{
date
->
time
=
year
;
if
(
retv
)
num_set_nan
(
retv
);
return
S_OK
;
}
year
=
year
>=
0
.
0
?
floor
(
year
)
:
-
floor
(
-
year
);
if
(
-
1
.
0
<
year
&&
year
<
100
.
0
)
year
+=
1900
.
0
;
date
->
time
=
time_clip
(
utc
(
make_date
(
make_day
(
year
,
month_from_time
(
t
),
date_from_time
(
t
)),
time_within_day
(
t
)),
date
));
if
(
retv
)
num_set_val
(
retv
,
date
->
time
);
return
S_OK
;
}
static
HRESULT
Date_value
(
script_ctx_t
*
ctx
,
vdisp_t
*
jsthis
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
dlls/jscript/tests/api.js
View file @
f2319fcd
...
...
@@ -1597,6 +1597,7 @@ ok(date.getUTCHours() === 0, "date.getUTCHours() = " + date.getUTCHours());
ok
(
date
.
getUTCMinutes
()
===
0
,
"date.getUTCMinutes() = "
+
date
.
getUTCMinutes
());
ok
(
date
.
getUTCSeconds
()
===
0
,
"date.getUTCSeconds() = "
+
date
.
getUTCSeconds
());
ok
(
date
.
getUTCMilliseconds
()
===
0
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
date
.
setTime
(
60
*
24
*
60
*
60
*
1000
);
ok
(
date
.
getUTCFullYear
()
===
1970
,
"date.getUTCFullYear() = "
+
date
.
getUTCFullYear
());
ok
(
date
.
getUTCMonth
()
===
2
,
"date.getUTCMonth() = "
+
date
.
getUTCMonth
());
...
...
@@ -1606,6 +1607,7 @@ ok(date.getUTCHours() === 0, "date.getUTCHours() = " + date.getUTCHours());
ok
(
date
.
getUTCMinutes
()
===
0
,
"date.getUTCMinutes() = "
+
date
.
getUTCMinutes
());
ok
(
date
.
getUTCSeconds
()
===
0
,
"date.getUTCSeconds() = "
+
date
.
getUTCSeconds
());
ok
(
date
.
getUTCMilliseconds
()
===
0
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
date
.
setTime
(
59
*
24
*
60
*
60
*
1000
+
4
*
365
*
24
*
60
*
60
*
1000
+
60
*
60
*
1000
+
2
*
60
*
1000
+
2
*
1000
+
640
);
ok
(
date
.
getUTCFullYear
()
===
1974
,
"date.getUTCFullYear() = "
+
date
.
getUTCFullYear
());
ok
(
date
.
getUTCMonth
()
===
1
,
"date.getUTCMonth() = "
+
date
.
getUTCMonth
());
...
...
@@ -1616,6 +1618,22 @@ ok(date.getUTCHours() === 1, "date.getUTCHours() = " + date.getUTCHours());
ok
(
date
.
getUTCMinutes
()
===
2
,
"date.getUTCMinutes() = "
+
date
.
getUTCMinutes
());
ok
(
date
.
getUTCSeconds
()
===
2
,
"date.getUTCSeconds() = "
+
date
.
getUTCSeconds
());
ok
(
date
.
getUTCMilliseconds
()
===
640
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
tmp
=
date
.
setYear
(
96
);
ok
(
date
.
getYear
()
===
96
,
"date.getYear() = "
+
date
.
getYear
());
ok
(
date
.
getFullYear
()
===
1996
,
"date.getFullYear() = "
+
date
.
getYear
());
ok
(
date
.
getUTCMonth
()
===
1
,
"date.getUTCMonth() = "
+
date
.
getUTCMonth
());
ok
(
date
.
getUTCMonth
(
123
)
===
1
,
"date.getUTCMonth() = "
+
date
.
getUTCMonth
());
ok
(
date
.
getUTCMilliseconds
()
===
640
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
tmp
=
date
.
setYear
(
2010
);
ok
(
tmp
===
date
.
getTime
(),
"date.setYear(2010) = "
+
tmp
);
ok
(
date
.
getYear
()
===
2010
,
"date.getYear() = "
+
date
.
getYear
());
ok
(
date
.
getFullYear
()
===
2010
,
"date.getFullYear() = "
+
date
.
getYear
());
ok
(
date
.
getUTCMonth
()
===
1
,
"date.getUTCMonth() = "
+
date
.
getUTCMonth
());
ok
(
date
.
getUTCMonth
(
123
)
===
1
,
"date.getUTCMonth() = "
+
date
.
getUTCMonth
());
ok
(
date
.
getUTCMilliseconds
()
===
640
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
date
.
setTime
(
Infinity
);
ok
(
isNaN
(
date
.
getUTCFullYear
()),
"date.getUTCFullYear() is not NaN"
);
ok
(
isNaN
(
date
.
getUTCMonth
()),
"date.getUTCMonth() is not NaN"
);
...
...
@@ -1628,6 +1646,12 @@ ok(isNaN(date.getUTCMilliseconds()), "date.getUTCMilliseconds() is not NaN");
ok
(
isNaN
(
date
.
setMilliseconds
(
0
)),
"date.setMilliseconds() is not NaN"
);
date
.
setTime
(
0
);
tmp
=
date
.
setYear
(
NaN
);
ok
(
isNaN
(
tmp
),
"date.setYear(NaN) = "
+
tmp
);
ok
(
isNaN
(
date
.
getUTCFullYear
()),
"date.getUTCFullYear() is not NaN"
);
ok
(
isNaN
(
date
.
getUTCMonth
()),
"date.getUTCMonth() is not NaN"
);
date
.
setTime
(
0
);
date
.
setUTCMilliseconds
(
-
10
,
2
);
ok
(
date
.
getUTCMilliseconds
()
===
990
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
date
.
setUTCMilliseconds
(
10
);
...
...
@@ -1863,6 +1887,7 @@ exception_test(function() {arr.toString = Date.prototype.toString; arr.toString(
exception_test
(
function
()
{
Array
(
-
3
);},
"RangeError"
,
-
2146823259
);
exception_test
(
function
()
{
arr
.
toString
=
Boolean
.
prototype
.
toString
;
arr
.
toString
();},
"TypeError"
,
-
2146823278
);
exception_test
(
function
()
{
date
.
setTime
();},
"TypeError"
,
-
2146827839
);
exception_test
(
function
()
{
date
.
setYear
();},
"TypeError"
,
-
2146827839
);
exception_test
(
function
()
{
arr
.
test
();},
"TypeError"
,
-
2146827850
);
exception_test
(
function
()
{
arr
.
toString
=
Number
.
prototype
.
toString
;
arr
.
toString
();},
"TypeError"
,
-
2146823287
);
exception_test
(
function
()
{(
new
Number
(
3
)).
toString
(
1
);},
"TypeError"
,
-
2146828283
);
...
...
@@ -1939,6 +1964,7 @@ testDateThis("getUTCMilliseconds");
testDateThis
(
"getUTCMinutes"
);
testDateThis
(
"getUTCMonth"
);
testDateThis
(
"getUTCSeconds"
);
testDateThis
(
"getYear"
);
testDateThis
(
"setDate"
);
testDateThis
(
"setFullYear"
);
testDateThis
(
"setHours"
);
...
...
@@ -1954,6 +1980,7 @@ testDateThis("setUTCMilliseconds");
testDateThis
(
"setUTCMinutes"
);
testDateThis
(
"setUTCMonth"
);
testDateThis
(
"setUTCSeconds"
);
testDateThis
(
"setYear"
);
testDateThis
(
"toDateString"
);
testDateThis
(
"toLocaleDateString"
);
testDateThis
(
"toLocaleString"
);
...
...
@@ -2121,6 +2148,7 @@ testFunctions(Date.prototype, [
[
"getUTCMinutes"
,
0
],
[
"getUTCMonth"
,
0
],
[
"getUTCSeconds"
,
0
],
[
"getYear"
,
0
],
[
"setDate"
,
1
],
[
"setFullYear"
,
3
],
[
"setHours"
,
4
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment