diff --git a/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene1.hap b/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene1.hap index 9ade636d049389136fc5b45cb5748f01025ca016..2e0d1a3d008b08615f6bb22a22a998062a9b684a 100644 Binary files a/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene1.hap and b/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene1.hap differ diff --git a/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene2.hap b/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene2.hap index 0a00840c46b36d27a27dc38f35583084e166d4b3..24752d54ba046c4ae6f8fa4e05bf1d525bebd1e5 100644 Binary files a/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene2.hap and b/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene2.hap differ diff --git a/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene3.hap b/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene3.hap index 6c298ca7ccbaaf811385f68bbf3a8e282688ef01..ca524241c10fef9953b227416b115d5d7aa8caf6 100644 Binary files a/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene3.hap and b/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene3.hap differ diff --git a/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene4.hap b/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene4.hap new file mode 100644 index 0000000000000000000000000000000000000000..8cbe78dc96439a322e6024b6a059e3abd0675316 Binary files /dev/null and b/appexecfwk/bundle_standard/bundlemanager/hap/napi_test_suite_scene4.hap differ diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene1/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene1/src/main/config.json index bd0e029b31f7a27392eb3383c963b0f4fced9b35..98518b7ba92a7f9be4963bbcee9952bf6f2a7f6d 100644 --- a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene1/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene1/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.napi_test_suite", + "bundleName": "com.example.myapplication", "vendor": "example", "version": { "code": 1, @@ -14,9 +14,7 @@ }, "deviceConfig": {}, "module": { - - - "package": "com.example.napi_test_suite", + "package": "com.example.myapplication", "name": ".MyApplication", "deviceType": [ "phone" @@ -31,18 +29,45 @@ "skills": [ { "entities": [ - "entity.system.home" + "entity.system.home", + "flag.home.intent.from.system" ], "actions": [ "action.system.home" ] } ], - "name": "com.example.napi_test_suite.MainAbility", + "name": "com.example.myapplication.MainAbility", "icon": "$media:icon", + "theme":"$media:icon", "description": "$string:mainability_description", - "label": "$string:app_name", + "label": "MyApplication", "type": "page", + "formEntity": [ + "homeScreen", + "searchbox" + ], + "defaultFormHeight": 100, + "minFormHeight": 200, + "defaultFormWidth": 300, + "minFormWidth": 400, + "metaData": { + "parameters" : [{ + "name" : "string", + "type" : "Float", + "description" : "string_parameters_description" + }], + "results" : [{ + "name" : "string", + "type" : "Float", + "description" : "string_results_description" + }], + "customizeData" : [{ + "name" : "string", + "value" : "string", + "extra" : "" + }] + }, "launchType": "standard" } ], @@ -69,11 +94,13 @@ "description": "WeChat permission in detail" } ], + "colorMode": "light", "js": [ { "pages": [ "pages/index/index" ], + "colorMode": "light", "name": "default", "window": { "designWidth": 720, diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene1/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene1/src/main/js/test/ExampleJsunit.test.js index 7b953b1bb344e35bf75fccab19446173e17b8e2e..7ab7dd8aa514fa9f3374191d78b6269e093eee66 100644 --- a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene1/src/main/js/test/ExampleJsunit.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene1/src/main/js/test/ExampleJsunit.test.js @@ -124,4 +124,325 @@ describe('appInfoTest', function () { done() }) -}) \ No newline at end of file + it('getBundleInfo_0100', 0, async function (done) { + var datainfo = await demo.getBundleInfo('com.example.myapplication1',1) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + expect(datainfo.appInfo.descriptionId).assertEqual(16777217) + done() + }) + + it('getBundleInfo_0400', 0, async function (done) { + var datainfo = await demo.getBundleInfo('error',1); + expect(datainfo.name.length).assertEqual(0) + done(); + }) + + it('getBundleInfo_0500', 0, async function (done) { + var datainfo = await demo.getBundleInfo(); + expect(datainfo.name.length).assertEqual(0) + done(); + }) + + it('getBundleInfo_0600', 0, async function (done) { + await demo.getBundleInfo('com.example.myapplication1',1,OnReceiveEvent) + function OnReceiveEvent(err,datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + expect(datainfo.appInfo.descriptionId).assertEqual(16777217) + } + done() + }) + + it('getBundleInfo_0900', 0, async function (done) { + await demo.getBundleInfo('error',1,OnReceiveEvent) + function OnReceiveEvent(err, datainfo) { + expect(datainfo.name.length).assertEqual(0) + } + done() + }) + + it('getBundleInfo_1000', 0, async function (done) { + await demo.getBundleInfo(OnReceiveEvent) + function OnReceiveEvent(err, datainfo) { + expect(datainfo.name.length).assertEqual(0) + } + done() + }) + + it('getBundleArchiveInfo_0100', 0, async function (done) { + var datainfo = await demo.getBundleArchiveInfo('/data/bmsJstest1.hap',1) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + done() + }) + + it('getBundleArchiveInfo_0400', 0, async function (done) { + var datainfo = await demo.getBundleArchiveInfo('/data/error.hap',1) + expect(datainfo.name.length).assertEqual(0) + done() + }) + + it('getBundleArchiveInfo_0500', 0, async function (done) { + var datainfo = await demo.getBundleArchiveInfo(' ',1) + expect(datainfo.name.length).assertEqual(0) + done() + }) + + it('getBundleArchiveInfo_0600', 0, async function (done) { + await demo.getBundleArchiveInfo('/data/bmsJstest1.hap',1,OnReceiveEvent) + function OnReceiveEvent(err, datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + } + done() + }) + + it('getBundleArchiveInfo_0900', 0, async function (done) { + await demo.getBundleArchiveInfo('/data/error.', 1,OnReceiveEvent) + function OnReceiveEvent(err, datainfo) { + expect(datainfo.name.length).assertEqual(0) + } + done() + }) + + it('getBundleArchiveInfo_1000', 0, async function (done) { + await demo.getBundleArchiveInfo(' ', 1,OnReceiveEvent) + function OnReceiveEvent(err, datainfo) { + expect(datainfo.name.length).assertEqual(0) + } + done() + }) + + it('queryAbilityByWant_0100', 0, async function (done) { + var datainfo = + await demo.queryAbilityByWant({ + want:{ + action: "action.system.home", + entities:["entity.system.home"], + elementName: { + deviceId: "0", + bundleName : "com.example.myapplication1", + abilityName : ".MainAbility", + },}},{ + params:{ + flags: 8 , + userId:"0" , + } + }) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.icon.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.description.length).assertLarger(0) + expect(datainfo.applicationInfo.icon.length).assertLarger(0) + expect(datainfo.applicationInfo.label.length).assertLarger(0) + done(); + }) + + it('queryAbilityByWant_0400', 0, async function (done) { + var datainfo = + await demo.queryAbilityByWant({ + want:{ + action: "action.system.home", + entities:["entity.system.home"], + elementName: { + deviceId : "0", + bundleName : "com.example.myapplication1", + abilityName : "", + },}},{ + params:{ + flags: 8 , + userId:"0" , + } + }) + expect(datainfo.name.length).assertEqual(0) + done(); + }) + + it('queryAbilityByWant_0500', 0, async function (done) { + var datainfo = + await demo.queryAbilityByWant({ + want:{ + action: "action.system.home", + entities:["entity.system.home"], + elementName: { + deviceId : "0", + bundleName : "", + abilityName : "", + },}},{ + params:{ + flags: 8 , + userId:"0" , + } + }) + expect(datainfo.name.length).assertEqual(0) + done(); + }) + + it('queryAbilityByWant_0600', 0, async function (done) { + await demo.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplication1", + abilityName: ".MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(err,datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.icon.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.description.length).assertLarger(0) + expect(datainfo.applicationInfo.icon.length).assertLarger(0) + expect(datainfo.applicationInfo.label.length).assertLarger(0) + done() + } + }) + + it('queryAbilityByWant_0900', 0, async function (done) { + await demo.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplication1", + abilityName: "", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(err, datainfo) { + expect(datainfo.name.length).assertEqual(0) + done(); + } + }) + + it('queryAbilityByWant_1000', 0, async function (done) { + await demo.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "", + abilityName: "", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(err,datainfo) { + expect(datainfo.name.length).assertEqual(0) + done() + } + }) + + it('getPermissionDef_0100', 0, async function(done){ + await demo.getPermissionDef('com.permission.CAMERA').then((infos) => { + expect(typeof infos).assertEqual("object"); + + expect(infos.name).assertEqual("com.permission.CAMERA"); + expect(infos.grantMode).assertEqual(1); + expect(infos.availableScope).assertEqual(2); + expect(infos.label).assertEqual("CAMERA permission"); + expect(infos.description).assertEqual("CAMERA permission in detail"); + }); + done(); + }) + + it('getPermissionDef_0600', 0, async function(done){ + console.info("neu========================getPermissionDef_0100: for begin"); + + await demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent); + + function OnReceiveEvent(err, data) { + expect(data.name).assertEqual("com.permission.CAMERA"); + expect(data.grantMode).assertEqual(1); + expect(data.availableScope).assertEqual(2); + expect(data.label).assertEqual("CAMERA permission"); + expect(data.description).assertEqual("CAMERA permission in detail"); + } + + done(); + + }) + + it('getPermissionDef_0400', 0, async function(done){ + await demo.getPermissionDef('').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name).assertEqual(""); + expect(infos.grantMode).assertEqual(""); + expect(infos.availableScope).assertEqual(0); + expect(infos.label).assertEqual(""); + expect(infos.description).assertEqual(""); + }); + done(); + }) + it('getPermissionDef_0900', 0, async function(done) + { + + await demo.getPermissionDef('', OnReceiveEvent); + + function OnReceiveEvent(err, data) { + expect(typeof data).assertEqual("object"); + + expect(data.name).assertEqual(""); + + expect(data.availableScope).assertEqual(0); + expect(data.grantMode).assertEqual(""); + expect(data.label).assertEqual(""); + expect(data.description).assertEqual(""); + } + + done(); + }) + +}) diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene2/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene2/src/main/config.json index bd0e029b31f7a27392eb3383c963b0f4fced9b35..91531ab98e25efe920b6e018930d7c9e5c588a41 100644 --- a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene2/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene2/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.napi_test_suite", + "bundleName": "com.example.myapplication_2", "vendor": "example", "version": { "code": 1, @@ -14,9 +14,7 @@ }, "deviceConfig": {}, "module": { - - - "package": "com.example.napi_test_suite", + "package": "com.example.myapplication", "name": ".MyApplication", "deviceType": [ "phone" @@ -31,18 +29,45 @@ "skills": [ { "entities": [ - "entity.system.home" + "entity.system.home", + "flag.home.intent.from.system" ], "actions": [ "action.system.home" ] } ], - "name": "com.example.napi_test_suite.MainAbility", + "name": "com.example.myapplication.MainAbility", "icon": "$media:icon", + "theme":"$media:icon", "description": "$string:mainability_description", - "label": "$string:app_name", + "label": "MyApplication", "type": "page", + "formEntity": [ + "homeScreen", + "searchbox" + ], + "defaultFormHeight": 100, + "minFormHeight": 200, + "defaultFormWidth": 300, + "minFormWidth": 400, + "metaData": { + "parameters" : [{ + "name" : "string", + "type" : "Float", + "description" : "string_parameters_description" + }], + "results" : [{ + "name" : "string", + "type" : "Float", + "description" : "string_results_description" + }], + "customizeData" : [{ + "name" : "string", + "value" : "string", + "extra" : "" + }] + }, "launchType": "standard" } ], @@ -69,11 +94,13 @@ "description": "WeChat permission in detail" } ], + "colorMode": "light", "js": [ { "pages": [ "pages/index/index" ], + "colorMode": "light", "name": "default", "window": { "designWidth": 720, diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene2/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene2/src/main/js/test/ExampleJsunit.test.js index 4cb5d5b8972c59765900a33ff7bf02b7ab149895..83ad273bfcd90df1e2372f9caae41106271b47b3 100644 --- a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene2/src/main/js/test/ExampleJsunit.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene2/src/main/js/test/ExampleJsunit.test.js @@ -129,7 +129,7 @@ describe('appInfoTest', function () { }) it('getApplicationInfo_0200', 0, async function (done) { - var datainfo = await demo.getApplicationInfo('com.example.myapplication1', 8, 1) + var datainfo = await demo.getApplicationInfo('com.example.myapplication2', 8, 1) expect(typeof datainfo).assertEqual("object") expect(datainfo.name.length).assertLarger(0) expect(datainfo.description.length).assertLarger(0) @@ -142,7 +142,7 @@ describe('appInfoTest', function () { }) it('getApplicationInfo_0700', 0, async function (done) { - await demo.getApplicationInfo('com.example.myapplication1', 8, 1, (error, datainfo) => { + await demo.getApplicationInfo('com.example.myapplication2', 8, 1, (error, datainfo) => { expect(typeof datainfo).assertEqual("object") expect(datainfo.name.length).assertLarger(0) expect(datainfo.description.length).assertLarger(0) @@ -155,4 +155,166 @@ describe('appInfoTest', function () { done() }) -}) \ No newline at end of file + it('getBundleInfo_0200', 0, async function (done) { + var datainfo = await demo.getBundleInfo('com.example.myapplication2',1) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + expect(datainfo.appInfo.descriptionId).assertEqual(16777217) + done() + }) + + it('getBundleInfo_0700', 0, async function (done) { + await demo.getBundleInfo('com.example.myapplication2',1,OnReceiveEvent) + function OnReceiveEvent(err,datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + expect(datainfo.appInfo.descriptionId).assertEqual(16777217) + } + done() + }) + + it('getBundleArchiveInfo_0200', 0, async function (done) { + var datainfo = await demo.getBundleArchiveInfo('/data/bmsJstest2.hap',1) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + done() + }) + + it('getBundleArchiveInfo_0700', 0, async function (done) { + await demo.getBundleArchiveInfo('/data/bmsJstest2.hap',1,OnReceiveEvent) + function OnReceiveEvent(err, datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + } + done() + }) + + it('queryAbilityByWant_0200', 0, async function (done) { + var datainfo = + await demo.queryAbilityByWant({ + want:{ + action: "action.system.home", + entities:["entity.system.home"], + elementName: { + deviceId: "0", + bundleName : "com.example.myapplication2", + abilityName : ".MainAbility", + },}},{ + params:{ + flags: 8 , + userId:"0" , + } + }) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.icon.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.description.length).assertLarger(0) + expect(datainfo.applicationInfo.icon.length).assertLarger(0) + expect(datainfo.applicationInfo.label.length).assertLarger(0) + done(); + }) + + it('queryAbilityByWant_0700', 0, async function (done) { + await demo.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplication2", + abilityName: ".MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(err,datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.icon.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.description.length).assertLarger(0) + expect(datainfo.applicationInfo.icon.length).assertLarger(0) + expect(datainfo.applicationInfo.label.length).assertLarger(0) + done() + } + }) + it('getPermissionDef_0200', 0, async function(done){ + await demo.getPermissionDef('com.permission.CAMERA').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name).assertEqual("com.permission.CAMERA"); + expect(infos.grantMode).assertEqual(1); + expect(infos.availableScope).assertEqual(2); + expect(infos.label).assertEqual("CAMERA permission"); + expect(infos.description).assertEqual("CAMERA permission in detail"); + }); + await demo.getPermissionDef('com.permission.music').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name).assertEqual("com.permission.music"); + expect(infos.grantMode).assertEqual(1); + expect(infos.availableScope).assertEqual(2); + expect(infos.label).assertEqual("music permission"); + expect(infos.description).assertEqual("music permission in detail"); + }); + done(); + }) + + it('getPermissionDef_0700', 0, async function(done){ + await demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent1); + + await demo.getPermissionDef('com.permission.music', OnReceiveEvent2); + + function OnReceiveEvent1(err, data) { + expect(data.name).assertEqual("com.permission.CAMERA"); + expect(data.grantMode).assertEqual(1); + expect(data.availableScope).assertEqua(2); + expect(data.label).assertEqual("CAMERA permission"); + expect(data.description).assertEqual("CAMERA permission in detail"); + } + + function OnReceiveEvent2(err, data) { + expect(data.name).assertEqual("com.permission.music"); + expect(data.grantMode).assertEqual(1); + expect(data.availableScope).assertEqual(2); + expect(data.label).assertEqual("music permission"); + expect(data.description).assertEqual("music permission in detail"); + } + + done(); + }) + +}) diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene3/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene3/src/main/config.json index bd0e029b31f7a27392eb3383c963b0f4fced9b35..c02a2205c84f73b80fd2d819f86fe214453dbf6d 100644 --- a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene3/src/main/config.json +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene3/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.example.napi_test_suite", + "bundleName": "com.example.myapplication_3", "vendor": "example", "version": { "code": 1, @@ -14,9 +14,7 @@ }, "deviceConfig": {}, "module": { - - - "package": "com.example.napi_test_suite", + "package": "com.example.myapplication", "name": ".MyApplication", "deviceType": [ "phone" @@ -31,18 +29,45 @@ "skills": [ { "entities": [ - "entity.system.home" + "entity.system.home", + "flag.home.intent.from.system" ], "actions": [ "action.system.home" ] } ], - "name": "com.example.napi_test_suite.MainAbility", + "name": "com.example.myapplication.MainAbility", "icon": "$media:icon", + "theme":"$media:icon", "description": "$string:mainability_description", - "label": "$string:app_name", + "label": "MyApplication", "type": "page", + "formEntity": [ + "homeScreen", + "searchbox" + ], + "defaultFormHeight": 100, + "minFormHeight": 200, + "defaultFormWidth": 300, + "minFormWidth": 400, + "metaData": { + "parameters" : [{ + "name" : "string", + "type" : "Float", + "description" : "string_parameters_description" + }], + "results" : [{ + "name" : "string", + "type" : "Float", + "description" : "string_results_description" + }], + "customizeData" : [{ + "name" : "string", + "value" : "string", + "extra" : "" + }] + }, "launchType": "standard" } ], @@ -69,11 +94,13 @@ "description": "WeChat permission in detail" } ], + "colorMode": "light", "js": [ { "pages": [ "pages/index/index" ], + "colorMode": "light", "name": "default", "window": { "designWidth": 720, diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene3/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene3/src/main/js/test/ExampleJsunit.test.js index b2bd475c628adf4a12e892dfa2d38e7a2345c421..768b17c1734c6c12780d30b52050350483e9364f 100644 --- a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene3/src/main/js/test/ExampleJsunit.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene3/src/main/js/test/ExampleJsunit.test.js @@ -129,7 +129,7 @@ describe('appInfoTest', function () { }) it('getApplicationInfo_0300', 0, async function (done) { - var datainfo = await demo.getApplicationInfo('com.example.myapplication1', 8, 1) + var datainfo = await demo.getApplicationInfo('com.example.myapplication4', 8, 1) expect(typeof datainfo).assertEqual("object") expect(datainfo.name.length).assertLarger(0) expect(datainfo.description.length).assertLarger(0) @@ -142,7 +142,7 @@ describe('appInfoTest', function () { }) it('getApplicationInfo_0800', 0, async function (done) { - await demo.getApplicationInfo('com.example.myapplication1', 8, 1, (error, datainfo) => { + await demo.getApplicationInfo('com.example.myapplication4', 8, 1, (error, datainfo) => { expect(typeof datainfo).assertEqual("object") expect(datainfo.name.length).assertLarger(0) expect(datainfo.description.length).assertLarger(0) @@ -155,4 +155,188 @@ describe('appInfoTest', function () { done() }) -}) \ No newline at end of file + it('getBundleInfo_0300', 0, async function (done) { + var datainfo = await demo.getBundleInfo('com.example.myapplication4',1) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + expect(datainfo.appInfo.descriptionId).assertEqual(16777217) + done() + }) + + it('getBundleInfo_0800', 0, async function (done) { + await demo.getBundleInfo('com.example.myapplication4',1,OnReceiveEvent) + function OnReceiveEvent(err,datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + expect(datainfo.appInfo.descriptionId).assertEqual(16777217) + } + done() + }) + + it('getBundleArchiveInfo_0300', 0, async function (done) { + var datainfo = await demo.getBundleArchiveInfo('/data/bmsJstest4.hap',1) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + done() + }) + + it('getBundleArchiveInfo_0800', 0, async function (done) { + await demo.getBundleArchiveInfo('/data/bmsJstest4.hap',1,OnReceiveEvent) + function OnReceiveEvent(err, datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.appInfo.name.length).assertLarger(0) + expect(datainfo.appInfo.description.length).assertLarger(0) + expect(datainfo.appInfo.label.length).assertLarger(0) + expect(datainfo.appInfo.icon.length).assertLarger(0) + } + done() + }) + + it('queryAbilityByWant_0300', 0, async function (done) { + var datainfo = + await demo.queryAbilityByWant({ + want:{ + action: "action.system.home", + entities:["entity.system.home"], + elementName: { + deviceId: "0", + bundleName : "com.example.myapplication4", + abilityName : ".MainAbility", + },}},{ + params:{ + flags: 8 , + userId:"0" , + } + }) + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.icon.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.description.length).assertLarger(0) + expect(datainfo.applicationInfo.icon.length).assertLarger(0) + expect(datainfo.applicationInfo.label.length).assertLarger(0) + done(); + }) + + it('queryAbilityByWant_0800', 0, async function (done) { + await demo.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplication4", + abilityName: ".MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(err,datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.icon.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.description.length).assertLarger(0) + expect(datainfo.applicationInfo.icon.length).assertLarger(0) + expect(datainfo.applicationInfo.label.length).assertLarger(0) + done() + } + }) + it('getPermissionDef_0300', 0, async function(done){ + await demo.getPermissionDef('com.permission.CAMERA').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name).assertEqual("com.permission.CAMERA"); + expect(infos.grantMode).assertEqual(1); + expect(infos.availableScope).assertEqual(2); + expect(infos.label).assertEqual("CAMERA permission"); + expect(infos.description).assertEqual("CAMERA permission in detail"); + }); + + await demo.getPermissionDef('com.permission.music').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name).assertEqual("com.permission.music"); + expect(infos.grantMode).assertEqual(1); + expect(infos.availableScope).assertEqual(2); + expect(infos.label).assertEqual("music permission"); + expect(infos.description).assertEqual("music permission in detail"); + }); + + await demo.getPermissionDef('com.permission.WeChat').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name).assertEqual("com.permission.WeChat"); + expect(infos.grantMode).assertEqual(1); + expect(infos.availableScope).assertEqual(2); + expect(infos.label).assertEqual("WeChat permission"); + expect(infos.description).assertEqual("WeChat permission in detail"); + }); + + done(); + + }) + it('getPermissionDef_0800', 0, async function(done){ + + await demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent1); + await demo.getPermissionDef('com.permission.music', OnReceiveEvent2); + + await demo.getPermissionDef('com.permission.WeChat', OnReceiveEvent3); + + function OnReceiveEvent1(err, data) { + + expect(data.name).assertEqual("com.permission.CAMERA"); + expect(data.grantMode).assertEqual(1); + expect(data.availableScope).assertEqual(2); + expect(data.label).assertEqual("CAMERA permission"); + expect(data.description).assertEqual("CAMERA permission in detail"); + } + + function OnReceiveEvent2(err, data) { + expect(data.name).assertEqual("com.permission.music"); + expect(data.grantMode).assertEqual(1); + expect(data.availableScope).assertEqual(2); + expect(data.label).assertEqual("music permission"); + expect(data.description).assertEqual("music permission in detail"); + } + + function OnReceiveEvent3(err, data) { + expect(data.name).assertEqual("com.permission.WeChat"); + expect(data.grantMode).assertEqual(1); + expect(data.availableScope).assertEqual(2); + expect(data.label).assertEqual("WeChat permission"); + expect(data.description).assertEqual("WeChat permission in detail"); + } + + done(); + + }) +}) diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/package.json b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/package.json @@ -0,0 +1 @@ +{} diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..998dc909cd7377632f475881c927ad663470d8f7 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/config.json @@ -0,0 +1,86 @@ +{ + "app": { + "bundleName": "com.example.napi_test_suite", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + + + "package": "com.example.napi_test_suite", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home", + "flag.home.intent.from.system" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.napi_test_suite.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "name": "com.permission.CAMERA", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "CAMERA permission", + "description": "CAMERA permission in detail" + }, + { + "name": "com.permission.music", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "music permission", + "description": "music permission in detail" + }, + { + "name": "com.permission.WeChat", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "WeChat permission", + "description": "WeChat permission in detail" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/app.js b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/project/napi_test_suite_scene4/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +