diff --git a/global/i18n_standard/intljs/src/main/js/test/I18n.test.js b/global/i18n_standard/intljs/src/main/js/test/I18n.test.js index f22b9a099d07e8763ef0b6da888b887d5b42a378..6ac4754ead3e6690014534ab87d0e3ffb40540ca 100644 --- a/global/i18n_standard/intljs/src/main/js/test/I18n.test.js +++ b/global/i18n_standard/intljs/src/main/js/test/I18n.test.js @@ -2292,5 +2292,40 @@ describe('I18nTest', function () { expect(value).assertEqual('\u0032\u0035'); }) + /** + * @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_0900 + * @tc.name getInstance method return 401 error code + * @tc.desc test the getInstance error code + */ + it('i18n_normalizer_test_0900', 0, function () { + console.log('i18n_normalizer_test_0900 ' + 'start'); + let str = '\u0032\u2075'; + try{ + let normal = I18n.Normalizer.getInstance(0); + }catch(error){ + console.log('i18n_normalizer_test_0900 ' + error.code); + console.log('i18n_normalizer_test_0900 ' + error.message); + expect(error.code == 401).assertTrue(); + } + }) + + /** + * @tc.number SUB_GLOBAL_I18N_NORMALIZE_JS_1000 + * @tc.name normalize method return 401 error code + * @tc.desc test the normalize error code + */ + it('i18n_normalizer_test_1000', 0, function () { + console.log('i18n_normalizer_test_1000 ' + 'start'); + let str = '\u0032\u2075'; + let normal = I18n.Normalizer.getInstance(1); + try{ + let value = normal.normalize(1234); + }catch(error){ + console.log('i18n_normalizer_test_1000 ' + error.code); + console.log('i18n_normalizer_test_1000 ' + error.message); + expect(error.code == 401).assertTrue(); + } + }) + console.log('*************end I18NTest*************'); })} diff --git a/global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js b/global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js index 79619e732302e500e389804b86af2cccf4a8bc19..cf0f41f18acec9ebc34d0f813bd80466a23f976b 100644 --- a/global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js +++ b/global/resmgr_standard/resmgrjs/src/main/js/test/Resmgr.test.js @@ -1752,5 +1752,395 @@ describe('resMgrTest', function () { }) }) + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0100 + * @tc.name getDrawableDescriptor with normal pic + * @tc.desc test the getDrawableDescriptor method + */ + it('getDrawableDescriptor_test_0100', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01000017); + console.log('getDrawableDescriptor_test_0100 ' + JSON.stringify(value)); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0100 ' + error.code); + console.log('getDrawableDescriptor_test_0100 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0200 + * @tc.name getDrawableDescriptor with normal pic and density + * @tc.desc test the getDrawableDescriptor method + */ + it('getDrawableDescriptor_test_0200', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01000017,120); + console.log('getDrawableDescriptor_test_0200 ' + JSON.stringify(value)); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0200 ' + error.code); + console.log('getDrawableDescriptor_test_0200 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0300 + * @tc.name getDrawableDescriptor with json style pic + * @tc.desc test the getDrawableDescriptor method + */ + it('getDrawableDescriptor_test_0300', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01000018); + console.log('getDrawableDescriptor_test_0300 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0300 ' + error.code); + console.log('getDrawableDescriptor_test_0300 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0400 + * @tc.name getDrawableDescriptor with json style pic and density + * @tc.desc test the getDrawableDescriptor method + */ + it('getDrawableDescriptor_test_0400', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01000018, 240); + console.log('getDrawableDescriptor_test_0400 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0400 ' + error.code); + console.log('getDrawableDescriptor_test_0400 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0500 + * @tc.name getDrawableDescriptor with string param + * @tc.desc test the getDrawableDescriptor method return 401 + */ + it('getDrawableDescriptor_test_0500', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor('0x01000018'); + console.log('getDrawableDescriptor_test_0500 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0500 ' + error.code); + console.log('getDrawableDescriptor_test_0500 ' + error.message); + expect(error.code == 401).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0600 + * @tc.name getDrawableDescriptor with not exist resource id + * @tc.desc test the getDrawableDescriptor method return 9001001 + */ + it('getDrawableDescriptor_test_0600', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01110000); + console.log('getDrawableDescriptor_test_0600 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0600 ' + error.code); + console.log('getDrawableDescriptor_test_0600 ' + error.message); + expect(error.code == 9001001).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0700 + * @tc.name getDrawableDescriptor with string resource id + * @tc.desc test the getDrawableDescriptor method return 9001002 + */ + it('getDrawableDescriptor_test_0700', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01000000); + console.log('getDrawableDescriptor_test_0700 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0700 ' + error.code); + console.log('getDrawableDescriptor_test_0700 ' + error.message); + expect(error.code == 9001002).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0800 + * @tc.name getDrawableDescriptor with not exist density + * @tc.desc test the getDrawableDescriptor method return 401 + */ + it('getDrawableDescriptor_test_0800', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01000018, 130); + console.log('getDrawableDescriptor_test_0800 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0800 ' + error.code); + console.log('getDrawableDescriptor_test_0800 ' + error.message); + expect(error.code == 401).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_0900 + * @tc.name getDrawableDescriptor with string type density + * @tc.desc test the getDrawableDescriptor method return 401 + */ + it('getDrawableDescriptor_test_0900', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01000018, '120'); + console.log('getDrawableDescriptor_test_0900 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_0900 ' + error.code); + console.log('getDrawableDescriptor_test_0900 ' + error.message); + expect(error.code == 401).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1000 + * @tc.name getDrawableDescriptor with 0 density + * @tc.desc test the getDrawableDescriptor method + */ + it('getDrawableDescriptor_test_1000', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptor(0x01000018, 0); + console.log('getDrawableDescriptor_test_1000 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1000 ' + error.code); + console.log('getDrawableDescriptor_test_1000 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1100 + * @tc.name getDrawableDescriptorByName with normal pic + * @tc.desc test the getDrawableDescriptorByName method + */ + it('getDrawableDescriptor_test_1100', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName('icon'); + console.log('getDrawableDescriptor_test_1100 ' + JSON.stringify(value)); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1100 ' + error.code); + console.log('getDrawableDescriptor_test_1100 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1200 + * @tc.name getDrawableDescriptorByName with normal pic and density + * @tc.desc test the getDrawableDescriptorByName method + */ + it('getDrawableDescriptor_test_1200', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName('icon',120); + console.log('getDrawableDescriptor_test_1200 ' + JSON.stringify(value)); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1200 ' + error.code); + console.log('getDrawableDescriptor_test_1200 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1300 + * @tc.name getDrawableDescriptorByName with json style pic + * @tc.desc test the getDrawableDescriptorByName method + */ + it('getDrawableDescriptor_test_1300', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName('stratify'); + console.log('getDrawableDescriptor_test_1300 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1300 ' + error.code); + console.log('getDrawableDescriptor_test_1300 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1400 + * @tc.name getDrawableDescriptorByName with json style pic and density + * @tc.desc test the getDrawableDescriptorByName method + */ + it('getDrawableDescriptor_test_1400', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName('stratify', 240); + console.log('getDrawableDescriptor_test_1400 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1400 ' + error.code); + console.log('getDrawableDescriptor_test_1400 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1500 + * @tc.name getDrawableDescriptorByName with number param + * @tc.desc test the getDrawableDescriptorByName method return 401 + */ + it('getDrawableDescriptor_test_1500', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName(0x01000018); + console.log('getDrawableDescriptor_test_1500 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1500 ' + error.code); + console.log('getDrawableDescriptor_test_1500 ' + error.message); + expect(error.code == 401).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1600 + * @tc.name getDrawableDescriptorByName with not exist pic name + * @tc.desc test the getDrawableDescriptorByName method return 9001003 + */ + it('getDrawableDescriptor_test_1600', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName('stratify1'); + console.log('getDrawableDescriptor_test_1600 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1600 ' + error.code); + console.log('getDrawableDescriptor_test_1600 ' + error.message); + expect(error.code == 9001003).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1800 + * @tc.name getDrawableDescriptorByName with not exist density + * @tc.desc test the getDrawableDescriptorByName method return 401 + */ + it('getDrawableDescriptor_test_1800', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName('stratify', 130); + console.log('getDrawableDescriptor_test_1800 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1800 ' + error.code); + console.log('getDrawableDescriptor_test_1800 ' + error.message); + expect(error.code == 401).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_1900 + * @tc.name getDrawableDescriptorByName with string type density + * @tc.desc test the getDrawableDescriptorByName method return 401 + */ + it('getDrawableDescriptor_test_1900', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName('stratify', '120'); + console.log('getDrawableDescriptor_test_1900 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_1900 ' + error.code); + console.log('getDrawableDescriptor_test_1900 ' + error.message); + expect(error.code == 401).assertTrue(); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_2000 + * @tc.name getDrawableDescriptorByName with 0 density + * @tc.desc test the getDrawableDescriptorByName method + */ + it('getDrawableDescriptor_test_2000', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + try{ + let value = mgr.getDrawableDescriptorByName('stratify', 0); + console.log('getDrawableDescriptor_test_2000 ' + value); + expect(value != null).assertTrue(); + }catch(error){ + console.log('getDrawableDescriptor_test_2000 ' + error.code); + console.log('getDrawableDescriptor_test_2000 ' + error.message); + } + }) + done(); + }) + + /** + * @tc.number SUB_GLOBAL_RESMGR_DRAWABLE_JS_2100 + * @tc.name getDrawableDescriptor with resource object + * @tc.desc test the getDrawableDescriptor method + */ + it('getDrawableDescriptor_test_2100', 0, async function (done) { + resmgr.getResourceManager((error, mgr) => { + let out = true; + let value = mgr.getDrawableDescriptor( + { bundleName:"ohos.intl.test", moduleName:"entry", id:0x01000018}); + console.log('getDrawableDescriptor_test_2100 ' + value); + if(value == null){ + out = false; + } + console.log('getDrawableDescriptor_test_2100 ' + out); + expect(out).assertFalse(); + }) + done(); + }) + console.log('*************end ResmgrTest*************'); })} diff --git a/global/resmgr_standard/resmgrjs/src/main/resources/base/media/stratify.json b/global/resmgr_standard/resmgrjs/src/main/resources/base/media/stratify.json new file mode 100644 index 0000000000000000000000000000000000000000..e209c801e22f2bed8c2b499ae6c8cb0b0da7a8ac --- /dev/null +++ b/global/resmgr_standard/resmgrjs/src/main/resources/base/media/stratify.json @@ -0,0 +1,6 @@ +{ + "stratified-image":{ + "background":"$media:icon", + "foreground":"$media:wp", + } +} \ No newline at end of file diff --git a/global/resmgr_standard/resmgrjs/src/main/resources/base/media/wp.png b/global/resmgr_standard/resmgrjs/src/main/resources/base/media/wp.png new file mode 100644 index 0000000000000000000000000000000000000000..42dfaa8ca5195ddea547f67944bbf61dd02414a3 Binary files /dev/null and b/global/resmgr_standard/resmgrjs/src/main/resources/base/media/wp.png differ