未验证 提交 beb744b9 编写于 作者: O openharmony_ci 提交者: Gitee

!3187 add date order cases

Merge pull request !3187 from 杨清/1228
...@@ -778,5 +778,163 @@ describe('LangTest', function () { ...@@ -778,5 +778,163 @@ describe('LangTest', function () {
expect(value > 0).assertEqual(true); expect(value > 0).assertEqual(true);
}) })
/* *
* @tc.number SUB_GLOBAL_I18N_JS_DATEORDER_0100
* @tc.name test getDateOrder method with zh param
* @tc.desc get the DateOrder value
*/
it('dateorder_test_0100', 0, function () {
console.log('dateorder_test_0100 ' + 'start');
let value = I18n.Util.getDateOrder('zh');
console.log('dateorder_test_0100 ' + value);
expect(value).assertEqual('y-L-d');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_DATEORDER_0200
* @tc.name test getDateOrder method with en param
* @tc.desc get the DateOrder value
*/
it('dateorder_test_0200', 0, function () {
console.log('dateorder_test_0200 ' + 'start');
let value = I18n.Util.getDateOrder('en');
console.log('dateorder_test_0200 ' + value);
expect(value).assertEqual('LLL-d-y');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_DATEORDER_0300
* @tc.name test getDateOrder method with th param
* @tc.desc get the DateOrder value
*/
it('dateorder_test_0300', 0, function () {
console.log('dateorder_test_0300 ' + 'start');
let value = I18n.Util.getDateOrder('th');
console.log('dateorder_test_0300 ' + value);
expect(value).assertEqual('d-LLL-y');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_DATEORDER_0400
* @tc.name test getDateOrder method with jp param
* @tc.desc get the DateOrder value
*/
it('dateorder_test_0400', 0, function () {
console.log('dateorder_test_0400 ' + 'start');
let value = I18n.Util.getDateOrder('jp');
console.log('dateorder_test_0400 ' + value);
expect(value).assertEqual('LLL-d-y');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0100
* @tc.name test getAvailableIDs
* @tc.desc get the ID value
*/
it('transliterator_test_0100', 0, function () {
console.log('transliterator_test_0100 ' + 'start');
let value = I18n.Transliterator.getAvailableIDs();
let len = value.length;
console.log('transliterator_test_0100 ' + value);
console.log('transliterator_test_0100 ' + len);
expect(value !== null).assertTrue();
expect(len).assertEqual(671);
while (len > 0)
{
console.log('transliterator_test_0100 ' + value[len-1]);
len--;
}
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0200
* @tc.name test getInstance with a param
* @tc.desc get the instance value
*/
it('transliterator_test_0200', 0, function () {
console.log('transliterator_test_0200 ' + 'start');
let value = I18n.Transliterator.getInstance('a');
console.log('transliterator_test_0200 ' + value);
expect(value !== null).assertTrue();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0300
* @tc.name test transform with 中国 param
* @tc.desc get the transform value
*/
it('transliterator_test_0300', 0, function () {
console.log('transliterator_test_0300 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Accents');
let value = trans.transform('中国');
console.log('transliterator_test_0300 ' + value);
expect(value).assertEqual('中国');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0400
* @tc.name test transform with Any-Latn param
* @tc.desc get the transform value
*/
it('transliterator_test_0400', 0, function () {
console.log('transliterator_test_0400 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Latn');
let value = trans.transform('中国');
console.log('transliterator_test_0400 ' + value);
expect(value).assertEqual('zhōng guó');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0500
* @tc.name test transform with Any-Thai param
* @tc.desc get the transform value
*/
it('transliterator_test_0500', 0, function () {
console.log('transliterator_test_0500 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Thai');
let value = trans.transform('中国');
console.log('transliterator_test_0500 ' + value);
expect(value).assertEqual('中国');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0600
* @tc.name test transform with Any-zh param
* @tc.desc get the transform value
*/
it('transliterator_test_0600', 0, function () {
console.log('transliterator_test_0600 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-zh');
let value = trans.transform('nihao');
console.log('transliterator_test_0600 ' + value);
expect(value).assertEqual('nihao');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0700
* @tc.name test transform with Any-Hant param
* @tc.desc get the transform value
*/
it('transliterator_test_0700', 0, function () {
console.log('transliterator_test_0700 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Hant');
let value = trans.transform('hello');
console.log('transliterator_test_0700 ' + value);
expect(value).assertEqual('hello');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_TRANSLITERATOR_0800
* @tc.name test transform with Any-Kannada param
* @tc.desc get the transform value
*/
it('transliterator_test_0800', 0, function () {
console.log('transliterator_test_0800 ' + 'start');
let trans = I18n.Transliterator.getInstance('Any-Kannada');
let value = trans.transform('hello');
console.log('transliterator_test_0800 ' + value);
expect(value).assertEqual('ಹೆಲ್ಲೊ');
})
console.log('*************end LangTest*************'); console.log('*************end LangTest*************');
}) })
\ No newline at end of file
...@@ -73,7 +73,7 @@ describe('resMgrTest', function () { ...@@ -73,7 +73,7 @@ describe('resMgrTest', function () {
*/ */
it('getString_test_001', 0, async function (done) { it('getString_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getString(0x1000000, (err, value) => { mgr.getString($r(app.string.app_name).id, (err, value) => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
console.log('getString_test_001 ' + value); console.log('getString_test_001 ' + value);
expect(value).assertEqual('L2Test'); expect(value).assertEqual('L2Test');
...@@ -89,7 +89,7 @@ describe('resMgrTest', function () { ...@@ -89,7 +89,7 @@ describe('resMgrTest', function () {
*/ */
it('getString_test_002', 0, async function (done) { it('getString_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getString(0x1000000).then(value => { mgr.getString($r(app.string.app_name).id).then(value => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
console.log('getString_test_002 ' + value); console.log('getString_test_002 ' + value);
expect(value).assertEqual('L2Test'); expect(value).assertEqual('L2Test');
...@@ -105,7 +105,7 @@ describe('resMgrTest', function () { ...@@ -105,7 +105,7 @@ describe('resMgrTest', function () {
*/ */
it('getStringArray_test_001', 0, async function (done) { it('getStringArray_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getStringArray(0x1000002, (err, value) => { mgr.getStringArray($r(app.strarray.sizeList).id, (err, value) => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
console.log('getStringArray_test_001 ' + value); console.log('getStringArray_test_001 ' + value);
console.log('getStringArray_test_001 ' + value.length); console.log('getStringArray_test_001 ' + value.length);
...@@ -127,7 +127,7 @@ describe('resMgrTest', function () { ...@@ -127,7 +127,7 @@ describe('resMgrTest', function () {
*/ */
it('getStringArray_test_002', 0, async function (done) { it('getStringArray_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getStringArray(0x1000002).then(value => { mgr.getStringArray($r(app.strarray.sizeList).id).then(value => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
console.log('getStringArray_test_002 ' + value); console.log('getStringArray_test_002 ' + value);
console.log('getStringArray_test_002 ' + value.length); console.log('getStringArray_test_002 ' + value.length);
...@@ -149,7 +149,7 @@ describe('resMgrTest', function () { ...@@ -149,7 +149,7 @@ describe('resMgrTest', function () {
*/ */
it('getMedia_test_001', 0, async function (done) { it('getMedia_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getMedia(0x1000004, (err, value) => { mgr.getMedia($r(app.media.icon).id, (err, value) => {
expect(value.length > 0).assertTrue(); expect(value.length > 0).assertTrue();
}) })
}) })
...@@ -163,7 +163,7 @@ describe('resMgrTest', function () { ...@@ -163,7 +163,7 @@ describe('resMgrTest', function () {
*/ */
it('getMedia_test_002', 0, async function (done) { it('getMedia_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getMedia(0x1000004).then(value => { mgr.getMedia($r(app.media.icon).id).then(value => {
expect(value.length > 0).assertTrue(); expect(value.length > 0).assertTrue();
}) })
}) })
...@@ -177,7 +177,7 @@ describe('resMgrTest', function () { ...@@ -177,7 +177,7 @@ describe('resMgrTest', function () {
*/ */
it('getMediaBase64_test_001', 0, async function (done) { it('getMediaBase64_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getMediaBase64(0x1000004, (err, value) => { mgr.getMediaBase64($r(app.media.icon).id, (err, value) => {
expect(value.length > 0).assertTrue(); expect(value.length > 0).assertTrue();
console.log('getMediaBase64_test_001 ' + value); console.log('getMediaBase64_test_001 ' + value);
}) })
...@@ -192,7 +192,7 @@ describe('resMgrTest', function () { ...@@ -192,7 +192,7 @@ describe('resMgrTest', function () {
*/ */
it('getMediaBase64_test_002', 0, async function (done) { it('getMediaBase64_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getMediaBase64(0x1000004).then(value => { mgr.getMediaBase64($r(app.media.icon).id).then(value => {
expect(value.length > 0).assertTrue(); expect(value.length > 0).assertTrue();
console.log('getMediaBase64_test_002 ' + value); console.log('getMediaBase64_test_002 ' + value);
}) })
...@@ -279,7 +279,7 @@ describe('resMgrTest', function () { ...@@ -279,7 +279,7 @@ describe('resMgrTest', function () {
*/ */
it('getPluralString_test_001', 0, async function (done) { it('getPluralString_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getPluralString(0x1000003, 1, (error, value) => { mgr.getPluralString($r(app.plural.plural_name).id, 1, (error, value) => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
console.log('getPluralString_test_001 ' + value); console.log('getPluralString_test_001 ' + value);
expect(value).assertEqual('1 test other'); expect(value).assertEqual('1 test other');
...@@ -295,7 +295,7 @@ describe('resMgrTest', function () { ...@@ -295,7 +295,7 @@ describe('resMgrTest', function () {
*/ */
it('getPluralString_test_002', 0, async function (done) { it('getPluralString_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getPluralString(0x1000003, 1).then(value => { mgr.getPluralString($r(app.plural.plural_name).id, 1).then(value => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
console.log('getPluralString_test_002 ' + value); console.log('getPluralString_test_002 ' + value);
expect(value).assertEqual('1 test other'); expect(value).assertEqual('1 test other');
...@@ -311,7 +311,7 @@ describe('resMgrTest', function () { ...@@ -311,7 +311,7 @@ describe('resMgrTest', function () {
*/ */
it('getString_test_003', 0, async function (done) { it('getString_test_003', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getString(0x1000001, (err, value) => { mgr.getString($r(app.string.app_name).id, (err, value) => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
console.log('getString_test_003 ' + value); console.log('getString_test_003 ' + value);
expect(value).assertEqual('JS_Phone_Empty Feature Ability'); expect(value).assertEqual('JS_Phone_Empty Feature Ability');
...@@ -357,7 +357,7 @@ describe('resMgrTest', function () { ...@@ -357,7 +357,7 @@ describe('resMgrTest', function () {
*/ */
it('release_test_001', 0, async function (done) { it('release_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => { resmgr.getResourceManager((error, mgr) => {
mgr.getString(0x1000000, (err, value) => { mgr.getString($r(app.string.app_name).id, (err, value) => {
expect(value !== null).assertTrue(); expect(value !== null).assertTrue();
}) })
mgr.release(); mgr.release();
...@@ -438,5 +438,285 @@ describe('resMgrTest', function () { ...@@ -438,5 +438,285 @@ describe('resMgrTest', function () {
done(); done();
}) })
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2400
* @tc.name test getStringByName method in callback mode
* @tc.desc get the string in callback mode
*/
it('getStringByName_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getStringByName('app_name', (err, value) => {
expect(value !== null).assertTrue();
console.log('getStringByName_test_001 ' + value);
expect(value).assertEqual('L2Test');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2500
* @tc.name test getString method in promise mode
* @tc.desc get the string in promise mode
*/
it('getStringByName_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getStringByName('app_name').then(value => {
expect(value !== null).assertTrue();
console.log('getStringByName_test_002 ' + value);
expect(value).assertEqual('L2Test');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2600
* @tc.name test getStringArrayByName method in callback mode
* @tc.desc get the string array in callback mode
*/
it('getStringArrayByName_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getStringArrayByName('sizeList', (err, value) => {
expect(value !== null).assertTrue();
console.log('getStringArrayByName_test_001 ' + value);
console.log('getStringArrayByName_test_001 ' + value.length);
console.log('getStringArrayByName_test_001 ' + value[0]);
expect(value.length).assertEqual(4);
expect(value[0]).assertEqual('small');
expect(value[1]).assertEqual('middle');
expect(value[2]).assertEqual('large');
expect(value[3]).assertEqual('extra large');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2700
* @tc.name test getStringArrayByName method in promise mode
* @tc.desc get the string array in promise mode
*/
it('getStringArrayByName_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getStringArrayByName('sizeList').then(value => {
expect(value !== null).assertTrue();
console.log('getStringArrayByName_test_002 ' + value);
console.log('getStringArrayByName_test_002 ' + value.length);
console.log('getStringArrayByName_test_002 ' + value[0]);
expect(value.length).assertEqual(4);
expect(value[0]).assertEqual('small');
expect(value[1]).assertEqual('middle');
expect(value[2]).assertEqual('large');
expect(value[3]).assertEqual('extra large');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2800
* @tc.name test getMediaByName method in callback mode
* @tc.desc get the media in callback mode
*/
it('getMediaByName_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getMediaByName('icon', (err, value) => {
expect(value.length > 0).assertTrue();
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2900
* @tc.name test getMediaByName method in promise mode
* @tc.desc get the media in promise mode
*/
it('getMediaByName_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getMediaByName('icon').then(value => {
expect(value.length > 0).assertTrue();
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3000
* @tc.name test getMediaBase64ByName method in callback mode
* @tc.desc get the media base64 in callback mode
*/
it('getMediaBase64ByName_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getMediaBase64ByName('icon', (err, value) => {
expect(value.length > 0).assertTrue();
console.log('getMediaBase64ByName_test_001 ' + value);
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3100
* @tc.name test getMediaBase64ByName method in promise mode
* @tc.desc get the media base64 in promise mode
*/
it('getMediaBase64ByName_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getMediaBase64ByName('icon').then(value => {
expect(value.length > 0).assertTrue();
console.log('getMediaBase64ByName_test_002 ' + value);
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3200
* @tc.name test getPluralStringByName method in callback mode
* @tc.desc get the plural string in callback mode
*/
it('getPluralStringByName_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getPluralStringByName('plural_name', 1, (error, value) => {
expect(value !== null).assertTrue();
console.log('getPluralStringByName_test_001 ' + value);
expect(value).assertEqual('1 test other');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3300
* @tc.name test getPluralStringByName method in promise mode
* @tc.desc get the plural string in promise mode
*/
it('getPluralStringByName_test_002', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
mgr.getPluralStringByName('plural_name', 1).then(value => {
expect(value !== null).assertTrue();
console.log('getPluralStringByName_test_002 ' + value);
expect(value).assertEqual('1 test other');
})
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3400
* @tc.name test getStringSync method
* @tc.desc get the string in sync mode
*/
it('getStringSync_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
let value = mgr.getStringSync($r(app.string.app_name).id);
expect(value !== null).assertTrue();
console.log('getStringSync_test_001 ' + value);
expect(value).assertEqual('L2Test');
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3500
* @tc.name test getStringByNameSync method
* @tc.desc get the string in sync mode
*/
it('getStringByNameSync_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
let value = mgr.getStringByNameSync('app_name');
expect(value !== null).assertTrue();
console.log('getStringByNameSync_test_001 ' + value);
expect(value).assertEqual('L2Test');
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3600
* @tc.name test getBoolean method
* @tc.desc get the boolean value
*/
it('getBoolean_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
let value = mgr.getBoolean($r(app.boolean.boolean_1).id);
console.log('getBoolean_test_001 ' + value);
expect(value).assertTrue();
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3700
* @tc.name test getBooleanByName method
* @tc.desc get the boolean value
*/
it('getBooleanByName_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
let value = mgr.getBooleanByName('boolean_1');
console.log('getBooleanByName_test_001 ' + value);
expect(value).assertTrue();
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3800
* @tc.name test getNumber method with interger id
* @tc.desc get the interger value
*/
it('getinteger_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
let value = mgr.getNumber($r(app.integer.integer_1).id);
console.log('getinteger_test_001 ' + value);
expect(value).assertEqual(100);
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_3900
* @tc.name test getNumberByName with interger
* @tc.desc get the interger value
*/
it('getintegerByName_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
let value = mgr.getNumberByName('integer_1');
console.log('getintegerByName_test_001 ' + value);
expect(value).assertEqual(100);
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_4000
* @tc.name test getNumber with float id
* @tc.desc get the float value
*/
it('getfloat_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
let value = mgr.getNumber($r(app.float.float_1).id);
console.log('getfloat_test_001 ' + value);
expect(value).assertEqual(48);
})
done();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_4100
* @tc.name test getNumberByName with float
* @tc.desc get the float value
*/
it('getfloatByName_test_001', 0, async function (done) {
resmgr.getResourceManager((error, mgr) => {
let value = mgr.getNumberByName('float_1');
console.log('getfloatByName_test_001 ' + value);
expect(value).assertEqual(48);
})
done();
})
console.log('*************end ResmgrTest*************'); console.log('*************end ResmgrTest*************');
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册