From: Piotr Szydelko Date: Fri, 20 Sep 2013 14:04:20 +0000 (+0200) Subject: [Time] code cleanup X-Git-Tag: 2.2.1_release~114^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=304f503c13872447550eda31cf2f26b7208d6f06;p=test%2Ftct%2Fweb%2Fapi.git [Time] code cleanup Change-Id: If6a8d44e67704b1ec1812c4847cfa233779ac416 --- diff --git a/tct-time-tizen-tests/time/TZDate_addDuration_duration_invalid_obj.html b/tct-time-tizen-tests/time/TZDate_addDuration_duration_invalid_obj.html index e6aaa0b1d..c52f5ce05 100644 --- a/tct-time-tizen-tests/time/TZDate_addDuration_duration_invalid_obj.html +++ b/tct-time-tizen-tests/time/TZDate_addDuration_duration_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTZDate, currentTimeDuration = [], exceptionName = "TypeMismatchError"; + var currentTZDate, currentTimeDuration = [], exceptionName = TYPE_MISMATCH_ERR; currentTimeDuration[0] = {length: 2, unit: "MINS"}; currentTZDate = tizen.time.getCurrentDateTime(); diff --git a/tct-time-tizen-tests/time/TZDate_difference_other_invalid_obj.html b/tct-time-tizen-tests/time/TZDate_difference_other_invalid_obj.html index 44702b79c..6208d0a46 100644 --- a/tct-time-tizen-tests/time/TZDate_difference_other_invalid_obj.html +++ b/tct-time-tizen-tests/time/TZDate_difference_other_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTZDate = [], exceptionName = "TypeMismatchError"; + var currentTZDate = [], exceptionName = TYPE_MISMATCH_ERR; currentTZDate[0] = tizen.time.getCurrentDateTime(); currentTZDate[1] = {}; diff --git a/tct-time-tizen-tests/time/TZDate_earlierThan_other_invalid_obj.html b/tct-time-tizen-tests/time/TZDate_earlierThan_other_invalid_obj.html index 65038af2b..2bd49340a 100644 --- a/tct-time-tizen-tests/time/TZDate_earlierThan_other_invalid_obj.html +++ b/tct-time-tizen-tests/time/TZDate_earlierThan_other_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTZDate = [], exceptionName = "TypeMismatchError"; + var currentTZDate = [], exceptionName = TYPE_MISMATCH_ERR; currentTZDate[0] = tizen.time.getCurrentDateTime(); currentTZDate[1] = {}; diff --git a/tct-time-tizen-tests/time/TZDate_equalsTo_other_invalid_obj.html b/tct-time-tizen-tests/time/TZDate_equalsTo_other_invalid_obj.html index 3bbdf045e..422b786f6 100644 --- a/tct-time-tizen-tests/time/TZDate_equalsTo_other_invalid_obj.html +++ b/tct-time-tizen-tests/time/TZDate_equalsTo_other_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTZDate = [], exceptionName = "TypeMismatchError"; + var currentTZDate = [], exceptionName = TYPE_MISMATCH_ERR; currentTZDate[0] = tizen.time.getCurrentDateTime(); currentTZDate[1] = {}; diff --git a/tct-time-tizen-tests/time/TZDate_laterThan_other_invalid_obj.html b/tct-time-tizen-tests/time/TZDate_laterThan_other_invalid_obj.html index 033f8257a..e7527db7e 100644 --- a/tct-time-tizen-tests/time/TZDate_laterThan_other_invalid_obj.html +++ b/tct-time-tizen-tests/time/TZDate_laterThan_other_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTZDate = [], exceptionName = "TypeMismatchError"; + var currentTZDate = [], exceptionName = TYPE_MISMATCH_ERR; currentTZDate[0] = tizen.time.getCurrentDateTime(); currentTZDate[1] = {}; diff --git a/tct-time-tizen-tests/time/TZDate_toDateString.html b/tct-time-tizen-tests/time/TZDate_toDateString.html index 3ebc42d24..dc44083d8 100644 --- a/tct-time-tizen-tests/time/TZDate_toDateString.html +++ b/tct-time-tizen-tests/time/TZDate_toDateString.html @@ -38,7 +38,7 @@ test(function () { var currentTZDate = tizen.time.getCurrentDateTime(), returnedValue = null; returnedValue = currentTZDate.toDateString(); assert_type(returnedValue, "string", "type check"); - assert_not_equals(returnedValue, null, "null check"); + assert_not_equals(returnedValue, "", "returned"); }, "TZDate_toDateString"); diff --git a/tct-time-tizen-tests/time/TZDate_toLocaleDateString.html b/tct-time-tizen-tests/time/TZDate_toLocaleDateString.html index 4905b3bf8..53704bf99 100644 --- a/tct-time-tizen-tests/time/TZDate_toLocaleDateString.html +++ b/tct-time-tizen-tests/time/TZDate_toLocaleDateString.html @@ -38,7 +38,7 @@ test(function () { var currentTZDate = tizen.time.getCurrentDateTime(), returnedValue = null; returnedValue = currentTZDate.toLocaleDateString(); assert_type(returnedValue, "string", "type check"); - assert_not_equals(returnedValue, null, "null check"); + assert_not_equals(returnedValue, "", "returned"); }, "TZDate_toLocaleDateString"); diff --git a/tct-time-tizen-tests/time/TZDate_toLocaleString.html b/tct-time-tizen-tests/time/TZDate_toLocaleString.html index 72cc58a27..fef7d3e0e 100644 --- a/tct-time-tizen-tests/time/TZDate_toLocaleString.html +++ b/tct-time-tizen-tests/time/TZDate_toLocaleString.html @@ -38,7 +38,7 @@ test(function () { var currentTZDate = tizen.time.getCurrentDateTime(), returnedValue = null; returnedValue = currentTZDate.toLocaleString(); assert_type(returnedValue, "string", "type check"); - assert_not_equals(returnedValue, null, "null check"); + assert_not_equals(returnedValue, "", "returned"); }, "TZDate_toLocaleString"); diff --git a/tct-time-tizen-tests/time/TZDate_toLocaleTimeString.html b/tct-time-tizen-tests/time/TZDate_toLocaleTimeString.html index 5d3e6f8e8..e0d859e40 100644 --- a/tct-time-tizen-tests/time/TZDate_toLocaleTimeString.html +++ b/tct-time-tizen-tests/time/TZDate_toLocaleTimeString.html @@ -38,7 +38,7 @@ test(function () { var currentTZDate = tizen.time.getCurrentDateTime(), returnedValue = null; returnedValue = currentTZDate.toLocaleTimeString(); assert_type(returnedValue, "string", "type check"); - assert_not_equals(returnedValue, null, "null check"); + assert_not_equals(returnedValue, "", "returned"); }, "TZDate_toLocaleTimeString"); diff --git a/tct-time-tizen-tests/time/TZDate_toString.html b/tct-time-tizen-tests/time/TZDate_toString.html index e0905baae..c5f118a3a 100644 --- a/tct-time-tizen-tests/time/TZDate_toString.html +++ b/tct-time-tizen-tests/time/TZDate_toString.html @@ -38,7 +38,7 @@ test(function () { var currentTZDate = tizen.time.getCurrentDateTime(), returnedValue = null; returnedValue = currentTZDate.toString(); assert_type(returnedValue, "string", "type check"); - assert_not_equals(returnedValue, null, "null check"); + assert_not_equals(returnedValue, "", "returned"); }, "TZDate_toString"); diff --git a/tct-time-tizen-tests/time/TZDate_toTimeString.html b/tct-time-tizen-tests/time/TZDate_toTimeString.html index 9c750bd9a..7a35bb398 100644 --- a/tct-time-tizen-tests/time/TZDate_toTimeString.html +++ b/tct-time-tizen-tests/time/TZDate_toTimeString.html @@ -38,7 +38,7 @@ test(function () { var currentTZDate = tizen.time.getCurrentDateTime(), returnedValue = null; returnedValue = currentTZDate.toTimeString(); assert_type(returnedValue, "string", "type check"); - assert_not_equals(returnedValue, null, "null check"); + assert_not_equals(returnedValue, "", "returned"); }, "TZDate_toTimeString"); diff --git a/tct-time-tizen-tests/time/TimeDuration_difference_other_invalid_obj.html b/tct-time-tizen-tests/time/TimeDuration_difference_other_invalid_obj.html index ce90ceab5..b8e57a0cf 100644 --- a/tct-time-tizen-tests/time/TimeDuration_difference_other_invalid_obj.html +++ b/tct-time-tizen-tests/time/TimeDuration_difference_other_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTimeDuration = [], exceptionName = "TypeMismatchError"; + var currentTimeDuration = [], exceptionName = TYPE_MISMATCH_ERR; currentTimeDuration[0] = new tizen.TimeDuration(1, "DAYS"); currentTimeDuration[1] = {length: 2, unit: "MINS"}; diff --git a/tct-time-tizen-tests/time/TimeDuration_equalsTo_other_invalid_obj.html b/tct-time-tizen-tests/time/TimeDuration_equalsTo_other_invalid_obj.html index 1b5d7b688..d8156f6f0 100644 --- a/tct-time-tizen-tests/time/TimeDuration_equalsTo_other_invalid_obj.html +++ b/tct-time-tizen-tests/time/TimeDuration_equalsTo_other_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTimeDuration = [], exceptionName = "TypeMismatchError"; + var currentTimeDuration = [], exceptionName = TYPE_MISMATCH_ERR; currentTimeDuration[0] = new tizen.TimeDuration(1, "DAYS"); currentTimeDuration[1] = {length: 2, unit: "MINS"}; diff --git a/tct-time-tizen-tests/time/TimeDuration_greaterThan_missarg.html b/tct-time-tizen-tests/time/TimeDuration_greaterThan_missarg.html index 2e8c43394..27f4ccf08 100644 --- a/tct-time-tizen-tests/time/TimeDuration_greaterThan_missarg.html +++ b/tct-time-tizen-tests/time/TimeDuration_greaterThan_missarg.html @@ -37,7 +37,7 @@ Authors: //==== TEST_CRITERIA MMA test(function () { var currentTimeDuration = new tizen.TimeDuration(1, "DAYS"); - assert_throws({name: "TypeMismatchError"}, + assert_throws({name: TYPE_MISMATCH_ERR}, function () { currentTimeDuration.greaterThan(); }); diff --git a/tct-time-tizen-tests/time/TimeDuration_greaterThan_other_invalid_obj.html b/tct-time-tizen-tests/time/TimeDuration_greaterThan_other_invalid_obj.html index 46dad8edb..b509bdba1 100644 --- a/tct-time-tizen-tests/time/TimeDuration_greaterThan_other_invalid_obj.html +++ b/tct-time-tizen-tests/time/TimeDuration_greaterThan_other_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTimeDuration = [], exceptionName = "TypeMismatchError"; + var currentTimeDuration = [], exceptionName = TYPE_MISMATCH_ERR; currentTimeDuration[0] = new tizen.TimeDuration(1, "DAYS"); currentTimeDuration[1] = {length: 2, unit: "MINS"}; diff --git a/tct-time-tizen-tests/time/TimeDuration_lessThan_other_invalid_obj.html b/tct-time-tizen-tests/time/TimeDuration_lessThan_other_invalid_obj.html index 2b7a6e9ea..2808d09f9 100644 --- a/tct-time-tizen-tests/time/TimeDuration_lessThan_other_invalid_obj.html +++ b/tct-time-tizen-tests/time/TimeDuration_lessThan_other_invalid_obj.html @@ -38,7 +38,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MTO test(function () { - var currentTimeDuration = [], exceptionName = "TypeMismatchError"; + var currentTimeDuration = [], exceptionName = TYPE_MISMATCH_ERR; currentTimeDuration[0] = new tizen.TimeDuration(1, "DAYS"); currentTimeDuration[1] = {length: 2, unit: "MINS"}; diff --git a/tct-time-tizen-tests/time/Time_TZDate_difference_compareWithCharacter.html b/tct-time-tizen-tests/time/Time_TZDate_difference_compareWithCharacter.html index f8c790e92..9f21a2f88 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_difference_compareWithCharacter.html +++ b/tct-time-tizen-tests/time/Time_TZDate_difference_compareWithCharacter.html @@ -47,7 +47,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MC test(function () { - assert_throws("TYPE_MISMATCH_ERR", + assert_throws({name: "TypeMismatchError"}, function () { tizen.time.getCurrentDateTime().difference("abcd"); }, "Specific TypeMismatchError exception."); diff --git a/tct-time-tizen-tests/time/Time_TZDate_earlierThan_character.html b/tct-time-tizen-tests/time/Time_TZDate_earlierThan_character.html index f476a9633..daf1159a1 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_earlierThan_character.html +++ b/tct-time-tizen-tests/time/Time_TZDate_earlierThan_character.html @@ -47,7 +47,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MC test(function () { - assert_throws("TYPE_MISMATCH_ERR", + assert_throws({name: "TypeMismatchError"}, function () { tizen.time.getCurrentDateTime().earlierThan("abcd"); }, "Specific TypeMismatchError exception."); diff --git a/tct-time-tizen-tests/time/Time_TZDate_earlierThan_number.html b/tct-time-tizen-tests/time/Time_TZDate_earlierThan_number.html index 4a4c9b05f..3e611c12e 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_earlierThan_number.html +++ b/tct-time-tizen-tests/time/Time_TZDate_earlierThan_number.html @@ -47,7 +47,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MC test(function () { - assert_throws("TYPE_MISMATCH_ERR", + assert_throws({name: "TypeMismatchError"}, function () { tizen.time.getCurrentDateTime().earlierThan(123); }, "Specific TypeMismatchError exception."); diff --git a/tct-time-tizen-tests/time/Time_TZDate_earlierThan_stringTZDate.html b/tct-time-tizen-tests/time/Time_TZDate_earlierThan_stringTZDate.html index e3979714e..3718593fe 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_earlierThan_stringTZDate.html +++ b/tct-time-tizen-tests/time/Time_TZDate_earlierThan_stringTZDate.html @@ -48,7 +48,7 @@ Authors: //==== TEST_CRITERIA MC test(function () { var tzStr = tizen.time.getCurrentDateTime().toString(); - assert_throws("TYPE_MISMATCH_ERR", + assert_throws({name: "TypeMismatchError"}, function () { tizen.time.getCurrentDateTime().earlierThan(tzStr); }, "Specific TypeMismatchError exception."); diff --git a/tct-time-tizen-tests/time/Time_TZDate_equalsTo_character.html b/tct-time-tizen-tests/time/Time_TZDate_equalsTo_character.html index adaf41e02..b0b25abd5 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_equalsTo_character.html +++ b/tct-time-tizen-tests/time/Time_TZDate_equalsTo_character.html @@ -47,7 +47,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MC test(function () { - assert_throws("TYPE_MISMATCH_ERR", + assert_throws({name: "TypeMismatchError"}, function () { tizen.time.getCurrentDateTime().equalsTo("abcd"); }, "Specific TypeMismatchError exception."); diff --git a/tct-time-tizen-tests/time/Time_TZDate_equalsTo_number.html b/tct-time-tizen-tests/time/Time_TZDate_equalsTo_number.html index 2e8533943..78fdc2036 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_equalsTo_number.html +++ b/tct-time-tizen-tests/time/Time_TZDate_equalsTo_number.html @@ -47,7 +47,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MC test(function () { - assert_throws("TYPE_MISMATCH_ERR", + assert_throws({name: "TypeMismatchError"}, function () { tizen.time.getCurrentDateTime().equalsTo(123); }, "Specific TypeMismatchError exception."); diff --git a/tct-time-tizen-tests/time/Time_TZDate_getMilliseconds.html b/tct-time-tizen-tests/time/Time_TZDate_getMilliseconds.html index 96dfa7b03..9ac09c165 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_getMilliseconds.html +++ b/tct-time-tizen-tests/time/Time_TZDate_getMilliseconds.html @@ -51,7 +51,7 @@ test(function () { exp_ms = myDate.getMilliseconds(); ms = tizen.time.getCurrentDateTime().getMilliseconds(); - assert_gap_less_than(ms, exp_ms, 10); + assert_approx_equals(ms, exp_ms, 10, "getMilliseconds()"); }, "Time_TZDate_getMilliseconds"); diff --git a/tct-time-tizen-tests/time/Time_TZDate_getUTCMilliseconds.html b/tct-time-tizen-tests/time/Time_TZDate_getUTCMilliseconds.html index 4d6eb78ca..e5774fab5 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_getUTCMilliseconds.html +++ b/tct-time-tizen-tests/time/Time_TZDate_getUTCMilliseconds.html @@ -52,7 +52,7 @@ test(function () { exp_UTCMs = myDate.getUTCMilliseconds(); UTCMs = tizen.time.getCurrentDateTime().getUTCMilliseconds(); - assert_gap_less_than(UTCMs, exp_UTCMs, 10, "milliseconds check"); + assert_approx_equals(UTCMs, exp_UTCMs, 10, "milliseconds check"); }, "Time_TZDate_getUTCMilliseconds"); diff --git a/tct-time-tizen-tests/time/Time_TZDate_laterThan_character.html b/tct-time-tizen-tests/time/Time_TZDate_laterThan_character.html index 15f6d72bb..447196bfe 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_laterThan_character.html +++ b/tct-time-tizen-tests/time/Time_TZDate_laterThan_character.html @@ -47,7 +47,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MC test(function () { - assert_throws("TYPE_MISMATCH_ERR", + assert_throws({name: "TypeMismatchError"}, function () { tizen.time.getCurrentDateTime().laterThan("abcd"); }, "Specific TypeMismatchError exception."); diff --git a/tct-time-tizen-tests/time/Time_TZDate_laterThan_number.html b/tct-time-tizen-tests/time/Time_TZDate_laterThan_number.html index e3070891a..b486533b1 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_laterThan_number.html +++ b/tct-time-tizen-tests/time/Time_TZDate_laterThan_number.html @@ -47,7 +47,7 @@ Authors: //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/time.html //==== TEST_CRITERIA MMINA MR test(function () { - assert_throws("TYPE_MISMATCH_ERR", + assert_throws({name: "TypeMismatchError"}, function () { tizen.time.getCurrentDateTime().laterThan(123); }, "Specific TypeMismatchError exception."); diff --git a/tct-time-tizen-tests/time/Time_TZDate_setMilliseconds_normal.html b/tct-time-tizen-tests/time/Time_TZDate_setMilliseconds_normal.html index e03296653..7e8318d86 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_setMilliseconds_normal.html +++ b/tct-time-tizen-tests/time/Time_TZDate_setMilliseconds_normal.html @@ -53,7 +53,7 @@ test(function () { dt.setMilliseconds(set_ms); msAfterSet = dt.getMilliseconds(); - assert_gap_less_than(msAfterSet, set_ms, 10); + assert_approx_equals(msAfterSet, set_ms, 10, "getMilliseconds()"); }, "Time_TZDate_setMilliseconds_normal"); diff --git a/tct-time-tizen-tests/time/Time_TZDate_toTimezone_invalid.html b/tct-time-tizen-tests/time/Time_TZDate_toTimezone_invalid.html index ea297546f..997255bb1 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_toTimezone_invalid.html +++ b/tct-time-tizen-tests/time/Time_TZDate_toTimezone_invalid.html @@ -47,13 +47,10 @@ Authors: //==== TEST_CRITERIA test(function () { var tzid, timezone; - try { + assert_throws({ name: INVALID_VALUES_ERR }, function () { tzid = "ab"; timezone = tizen.time.getCurrentDateTime().toTimezone(tzid); - assert_true(false, "Should throw an exception"); - } catch (e) { - assert_equals(e.name,"InvalidValuesError","error message is " + e.message); - } + }); }, "Time_TZDate_toTimezone_invalid"); diff --git a/tct-time-tizen-tests/time/Time_TZDate_toTimezone_null.html b/tct-time-tizen-tests/time/Time_TZDate_toTimezone_null.html index fe1069e7d..48d049fd5 100644 --- a/tct-time-tizen-tests/time/Time_TZDate_toTimezone_null.html +++ b/tct-time-tizen-tests/time/Time_TZDate_toTimezone_null.html @@ -47,13 +47,10 @@ Authors: //==== TEST_CRITERIA test(function () { var tzid, timezone; - try { + assert_throws({ name: INVALID_VALUES_ERR }, function () { tzid = null; timezone = tizen.time.getCurrentDateTime().toTimezone(tzid); - assert_true(false,"Should throw an exception"); - } catch (e) { - assert_equals(e.name,"InvalidValuesError","error message is" +e.message); - } + }); }, "Time_TZDate_toTimezone_null"); diff --git a/tct-time-tizen-tests/time/support/time_common.js b/tct-time-tizen-tests/time/support/time_common.js index 39f044377..0aed54920 100644 --- a/tct-time-tizen-tests/time/support/time_common.js +++ b/tct-time-tizen-tests/time/support/time_common.js @@ -61,168 +61,3 @@ var date = new tizen.TZDate( ); var testAdditionalParamArray = [ERROR_NUM, null, undefined]; -// var currentDate = new tizen.TZDate(); - -function presenceTest() { - assert_true(tizen, "Checking tizen object"); -} - -function checkTZDate(count, paramTZDate, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { - assert_true(paramTZDate instanceof tizen.TZDate, "checkTZDate() paramTZDate):"); - if (count == 0) { - return; - } - - switch (count) { - case 1: - assert_equals(arg1, paramTZDate.getTimezone(), "checkTZDate() timezone"); - break; - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - assert_equals(arg1, paramTZDate.getFullYear(), "checkTZDate() year"); - assert_equals(arg2, paramTZDate.getMonth(), "checkTZDate() month"); - assert_equals(arg3, paramTZDate.getDate(), "checkTZDate() date"); - - if (count > 3) { - assert_equals(arg4, paramTZDate.getHours(), "checkTZDate() hours"); - } - - if (count > 4) { - assert_equals(arg5, paramTZDate.getMinutes(), "checkTZDate() minutes"); - } - - if (count > 5) { - assert_equals(arg6, paramTZDate.getSeconds(), "checkTZDate() seconds"); - } - - if (count > 6) { - assert_equals(arg7, paramTZDate.getMilliseconds(), "checkTZDate() milliseconds"); - } - - if (count > 7) { - assert_equals(arg8, paramTZDate.getTimezone(), "checkTZDate() timezone"); - } - - break; - } -} - -function checkValidParamTZDate() { - try { - assert_true(!isUndefined(new tizen.TZDate(ERROR_NUM)), "checkValidParamTZDate new tizen.TZDate(ERROR_NUM) : "); - console.error("checkValidParamTZDate expected error (expected : [" + TYPE_MISMATCH_ERR + "] but NoError)"); - } catch (e) { - assert_equals("checkValidParamTZDate() new tizen.TZDate(ERROR_NUM) error", e.name, TYPE_MISMATCH_ERR); - } - - try { - assert_true(!isUndefined(new tizen.TZDate(new Date(), ERROR_NUM)), "checkValidParamTZDate new tizen.TZDate(new Date(), ERROR_NUM) : "); - console.error("checkValidParamTZDate expected error (expected : [" + INVALID_VALUES_ERR + "] but NoError)"); - } catch (e) { - assert_equals("checkValidParamTZDate() new tizen.TZDate(new Date(), ERROR_NUM) error", e.name, INVALID_VALUES_ERR); - } - - try { - TestEngine.test("checkValidParamTZDate new tizen.TZDate(expected_year, expected_month, expected_date, expected_hours, expected_minutes, expected_seconds, expected_milliseconds, ERROR_NUM) : ", !isUndefined(new tizen.TZDate(expected_year, expected_month, expected_date, expected_hours, expected_minutes, expected_seconds, expected_milliseconds, ERROR_NUM))); - console.error("checkValidParamTZDate expected error (expected : [" + INVALID_VALUES_ERR + "] but NoError)"); - } catch (e) { - assert_equals("checkValidParamTZDate() new tizen.TZDate(expected_year, expected_month, expected_date, expected_hours, expected_minutes, expected_seconds, expected_milliseconds, ERROR_NUM) error", e.name, INVALID_VALUES_ERR); - } -} - -function compareDate(date, tzdate, timezone) { - assert_equals(date.getFullYear(), tzdate.getFullYear(), "compareDate() year"); - assert_equals(date.getMonth(), tzdate.getMonth(), "compareDate() month"); - assert_equals(date.getDate(), tzdate.getDate(), "compareDate() day"); - assert_equals(date.getHours(), tzdate.getHours(), "compareDate() hours"); - assert_equals(date.getMinutes(), tzdate.getMinutes(), "compareDate() mins"); - assert_equals(date.getSeconds(), tzdate.getSeconds(), "compareDate() sec"); - assert_equals(date.getMilliseconds(), tzdate.getMilliseconds(), "compareDate() millisec"); - if (!isUndefined(timezone)) { - assert_equals(timezone, tzdate.getTimezone(), "compareDate() timezone"); - } -} - -function checkTimeDuration(duration, expected_length, expected_unit) { - assert_true(duration instanceof tizen.TimeDuration, "checkTimeDuration() duration instanceof tizen.TimeDuration :"); - if (isNull(expected_unit)) { - expected_unit = "MSECS"; - } - - assert_type(duration.length, "number", "duration length"); - assert_type(duration.unit, "string", "duration unit"); - assert_equals(expected_length, duration.length, "checkTimeDuration() length"); - assert_equals(expected_unit, duration.unit, "checkTimeDuration() unit"); -} - - - - - -function assert_gap_less_than(actual, expect, distance){ - if( Math.abs(parseInt(actual-expect))<=distance ){ - assert_true(true); - }else - assert_true(false) -} - -function FailTest() -{ - t.step(function() { assert_true(false); } ); - t.done(); -} - -/* -function assert_is_timezone(actual) { - for (var i in _timezone_fields) { - assert_own_property(actual, i); - } -} - -function assert_tzdate_same_as(actual, expected) { - for (var field in _tzdate_fields) { - _compare_field(actual[field], expected[field], field, _tzdate_fields[field]); - } -} - -function assert_timezone_same_as(actual, expected) { - for (var field in _timezone_fields) { - _compare_field(actual[field], expected[field], field, _timezone_fields[field]); - } -} - - -function assert_contact_same_as(actual, expected) { - for (var field in _contact_properties) { - _compare_field(actual[field], expected[field], field, _contact_properties[field]); - } -} - -function _compare_field(actual, expected, fieldname, datatype) { - if (expected == null) { - assert_equals(actual, expected, "Comparing values of " + fieldname); - } else if (datatype == "string" || datatype == "date" || datatype=="opaquestring") { - if (expected == null || datatype != "opaquestring") { - assert_equals(actual, expected, "Comparing values of " + fieldname); - } - } else if (datatype instanceof Array) { - for (var i in expected) { - _compare_field(actual[i], expected[i], fieldname, datatype[0]); - } - } else if (typeof(datatype)=='object') { - for (var i in actual) { - assert_own_property(expected, i, "Unexpected property " + i + " in " + fieldname); - _compare_field(actual[i], expected[i], fieldname + "." + i, "string"); - } - for (var j in expected) { - assert_own_property(actual, j, "Missing property " + j + " in " + fieldname); - } - } else { - assert_unreached( "Unknown datatype to compare:" + datatype); - } -} -*/