diff --git a/global/resmgr_standard/resmgrjs/src/main/js/default/test/Resmgr.test.js b/global/resmgr_standard/resmgrjs/src/main/js/default/test/Resmgr.test.js index d8fc653c1ab9e0a603b5a99890a64466458920d5..9850fda6fb0ffbf119f6e4f0ca995fef42a08183 100755 --- a/global/resmgr_standard/resmgrjs/src/main/js/default/test/Resmgr.test.js +++ b/global/resmgr_standard/resmgrjs/src/main/js/default/test/Resmgr.test.js @@ -98,6 +98,42 @@ describe('resMgrTest', function () { done(); }) + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_0620 + * @tc.name test getString method with resource param in callback mode + * @tc.desc get the string in callback mode + */ + it('getString_test_003', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getString({ bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.string.app_name).id}, (err, value) => { + expect(value !== null).assertTrue(); + console.log('getString_test_003 ' + value); + expect(value).assertEqual('L2Test'); + }) + }) + done(); + }) + + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_0640 + * @tc.name test getString method with resource param in promise mode + * @tc.desc get the string in promise mode + */ + it('getString_test_004', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getString({ bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.string.app_name).id}).then(value => { + expect(value !== null).assertTrue(); + console.log('getString_test_004 ' + value); + expect(value).assertEqual('L2Test'); + }) + }) + done(); + }) + /* * * @tc.number SUB_GLOBAL_RESMGR_JS_0700 * @tc.name test getStringArray method in callback mode @@ -142,6 +178,54 @@ describe('resMgrTest', function () { done(); }) + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_0820 + * @tc.name test getStringArray method with resource param in callback mode + * @tc.desc get the string array in callback mode + */ + it('getStringArray_test_003', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getStringArray({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.strarray.sizeList).id}, (err, value) => { + expect(value !== null).assertTrue(); + console.log('getStringArray_test_003 ' + value); + console.log('getStringArray_test_003 ' + value.length); + console.log('getStringArray_test_003 ' + 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_0840 + * @tc.name test getStringArray method with resource param in promise mode + * @tc.desc get the string array in promise mode + */ + it('getStringArray_test_004', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getStringArray({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.strarray.sizeList).id}).then(value => { + expect(value !== null).assertTrue(); + console.log('getStringArray_test_004 ' + value); + console.log('getStringArray_test_004 ' + value.length); + console.log('getStringArray_test_004 ' + 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_0900 * @tc.name test getMedia method in callback mode @@ -150,6 +234,7 @@ describe('resMgrTest', function () { it('getMedia_test_001', 0, async function (done) { resmgr.getResourceManager((error, mgr) => { mgr.getMedia($r(app.media.icon).id, (err, value) => { + console.log('getMedia_test_001 ' + value.length); expect(value.length > 0).assertTrue(); }) }) @@ -164,6 +249,41 @@ describe('resMgrTest', function () { it('getMedia_test_002', 0, async function (done) { resmgr.getResourceManager((error, mgr) => { mgr.getMedia($r(app.media.icon).id).then(value => { + console.log('getMedia_test_002 ' + value.length); + expect(value.length > 0).assertTrue(); + }) + }) + done(); + }) + + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_1020 + * @tc.name test getMedia method with resource param in callback mode + * @tc.desc get the media in callback mode + */ + it('getMedia_test_003', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getMedia({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.media.icon).id}, (err, value) => { + console.log('getMedia_test_003 ' + value.length); + expect(value.length > 0).assertTrue(); + }) + }) + done(); + }) + + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_1040 + * @tc.name test getMedia method with resource param in promise mode + * @tc.desc get the media in promise mode + */ + it('getMedia_test_004', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getMedia({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.media.icon).id}).then(value => { + console.log('getMedia_test_004 ' + value.length); expect(value.length > 0).assertTrue(); }) }) @@ -200,6 +320,40 @@ describe('resMgrTest', function () { done(); }) + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_1220 + * @tc.name test getMediaBase64 method with resource param in callback mode + * @tc.desc get the media base64 in callback mode + */ + it('getMediaBase64_test_003', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getMediaBase64({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.media.icon).id}, (err, value) => { + expect(value.length > 0).assertTrue(); + console.log('getMediaBase64_test_003 ' + value); + }) + }) + done(); + }) + + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_1240 + * @tc.name test getMediaBase64 method with resource param in promise mode + * @tc.desc get the media base64 in promise mode + */ + it('getMediaBase64_test_004', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getMediaBase64({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.media.icon).id}).then(value => { + expect(value.length > 0).assertTrue(); + console.log('getMediaBase64_test_004 ' + value); + }) + }) + done(); + }) + /* * * @tc.number SUB_GLOBAL_RESMGR_JS_1300 * @tc.name test getConfiguration method in callback mode @@ -304,16 +458,52 @@ describe('resMgrTest', function () { done(); }) + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_1820 + * @tc.name test getPluralString method with resource param in callback mode + * @tc.desc get the plural string in callback mode + */ + it('getPluralString_test_003', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getPluralString({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.plural.plural_name).id}, 1, (error, value) => { + expect(value !== null).assertTrue(); + console.log('getPluralString_test_003 ' + value); + expect(value).assertEqual('1 test other'); + }) + }) + done(); + }) + + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_1840 + * @tc.name test getPluralString method with resource param in promise mode + * @tc.desc get the plural string in promise mode + */ + it('getPluralString_test_004', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + mgr.getPluralString({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.plural.plural_name).id}, 1).then(value => { + expect(value !== null).assertTrue(); + console.log('getPluralString_test_004 ' + value); + expect(value).assertEqual('1 test other'); + }) + }) + done(); + }) + /* * * @tc.number SUB_GLOBAL_RESMGR_JS_1900 * @tc.name test getString method in callback mode * @tc.desc get the string in callback mode */ - it('getString_test_003', 0, async function (done) { + it('getString_test_005', 0, async function (done) { resmgr.getResourceManager((error, mgr) => { - mgr.getString($r(app.string.app_name).id, (err, value) => { + mgr.getString($r(app.string.mainability_description).id, (err, value) => { expect(value !== null).assertTrue(); - console.log('getString_test_003 ' + value); + console.log('getString_test_005 ' + value); expect(value).assertEqual('JS_Phone_Empty Feature Ability'); }) }) @@ -619,6 +809,23 @@ describe('resMgrTest', function () { done(); }) + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_3450 + * @tc.name test getStringSync method with resource param + * @tc.desc get the string in sync mode + */ + it('getStringSync_test_002', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + let value = mgr.getStringSync({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.string.app_name).id}); + expect(value !== null).assertTrue(); + console.log('getStringSync_test_002 ' + value); + expect(value).assertEqual('L2Test'); + }) + done(); + }) + /* * * @tc.number SUB_GLOBAL_RESMGR_JS_3500 * @tc.name test getStringByNameSync method @@ -648,6 +855,22 @@ describe('resMgrTest', function () { done(); }) + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_3650 + * @tc.name test getBoolean method with resource param + * @tc.desc get the boolean value + */ + it('getBoolean_test_002', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + let value = mgr.getBoolean({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.boolean.boolean_1).id}); + console.log('getBoolean_test_002 ' + value); + expect(value).assertTrue(); + }) + done(); + }) + /* * * @tc.number SUB_GLOBAL_RESMGR_JS_3700 * @tc.name test getBooleanByName method @@ -676,6 +899,22 @@ describe('resMgrTest', function () { done(); }) + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_3850 + * @tc.name test getNumber method with interger resource param + * @tc.desc get the interger value + */ + it('getinteger_test_002', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + let value = mgr.getNumber({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.integer.integer_1).id}); + console.log('getinteger_test_002 ' + value); + expect(value).assertEqual(100); + }) + done(); + }) + /* * * @tc.number SUB_GLOBAL_RESMGR_JS_3900 * @tc.name test getNumberByName with interger @@ -704,6 +943,22 @@ describe('resMgrTest', function () { done(); }) + /* * + * @tc.number SUB_GLOBAL_RESMGR_JS_4050 + * @tc.name test getNumber with float resource param + * @tc.desc get the float value + */ + it('getfloat_test_002', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + let value = mgr.getNumber({bundleName:"ohos.intl.test", + moduleName:"entry", + id:$r(app.float.float_1).id}); + console.log('getfloat_test_002 ' + value); + expect(value).assertEqual(48); + }) + done(); + }) + /* * * @tc.number SUB_GLOBAL_RESMGR_JS_4100 * @tc.name test getNumberByName with float