diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets index 1a5447405d9185a25a195feaf27577349b3eef11..c58111a3270ceeecd602a53d00b333bd4121dbb4 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets @@ -14,24 +14,11 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" import commonEvent from '@ohos.commonEvent' -import bundle from '@ohos.bundle' -import missionManager from '@ohos.application.missionManager' -import appManager from '@ohos.application.appManager' -var subscriberInfoMultiInstance = { +let subscriberInfoMultiInstance = { events: ["MultiInstanceStartNext", "MultiInstanceStartFinish"] }; -const BUNDLE_PATHS = [['/data/ActsAmsAbilityMultiinstanceHapARelyHap.hap'], -['/data/ActsAmsAbilityMultiinstanceHapBRelyHap.hap'], -['/data/ActsAmsAbilityMultiinstanceHapCRelyHap.hap'], -['/data/ActsAmsAbilityMultiinstanceHapDRelyHap.hap'], -['/data/ActsAmsAbilityMultiinstanceHapERelyHap.hap']]; -const BUNDLE_NAMES = ['com.example.amsabilitymultiinstanceappa', 'com.example.amsabilitymultiinstanceappb', -'com.example.amsabilitymultiinstanceappc', 'com.example.amsabilitymultiinstanceappd', -'com.example.amsabilitymultiinstanceappe']; -const BUNDLE_COUNT = 5; const START_ABILITY_TIMEOUT = 9000; -const MAX_MISSION_NUM = 1024; const ONACCEPTWANT_KEY_NOTSET_ID = -1; const ONACCEPTWANT_KEY_UNDEFINED_ID = -2; const UNSUBSCRIBE_TIMEOUT = 5000; @@ -48,6 +35,9 @@ async function startAbilityProcess(abilityContext, parameters) { case "StartA2": parameters.startId = 2; break; + case "StartA3": + parameters.startId = 3; + break; case "StartANS": parameters.startId = ONACCEPTWANT_KEY_NOTSET_ID; break; @@ -101,17 +91,6 @@ async function startAbilityProcess(abilityContext, parameters) { export default function abilityTest(abilityContext) { describe('ActsAbilityTest', function () { - beforeEach(async (done) => { - console.log('======>beforeEach ininin<======='); - done(); - }) - - afterEach(async (done) => { - let installer = await bundle.getBundleInstaller(); - var count = 0; - done(); - }) - /* * @tc.number: ACTS_AbilityMultiInstance_Multi_0100 * @tc.name: Connects a service ability, which is used to start a cloned page ability. @@ -119,16 +98,15 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_0100', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_0100====Subscribe CallBack data:====>" + JSON.stringify(data)); - if (data.event == "MultiInstanceStartFinish") { clearTimeout(id); console.log('ACTS_AbilityMultiInstance_Single_0100 finish callBackSeq = ' + data.data); @@ -178,12 +156,11 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_0200', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_0200====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -227,7 +204,7 @@ export default function abilityTest(abilityContext) { startId: 0, stepNum: 3, nextStep: 0, - step: ["StartA1", "StartB", "StartA2"] + step: ["StartA3", "StartB", "StartA2"] }); }) @@ -238,12 +215,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_0300', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_0300====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -298,12 +275,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_0400', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_0400====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -312,7 +289,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); console.log('ACTS_AbilityMultiInstance_Single_0400 finish callBackSeq = ' + data.data); expect(data.data).assertEqual(checkEventResults[checkIndex++]); - expect(checkIndex).assertEqual(3); + expect(checkIndex).assertEqual(2); commonEvent.unsubscribe(subscriber, unSubscribeCallback); console.log('ACTS_AbilityMultiInstance_Single_0400 finish'); } else if (data.event == "MultiInstanceStartNext") { @@ -347,7 +324,7 @@ export default function abilityTest(abilityContext) { startId: 0, stepNum: 3, nextStep: 0, - step: ["StartA1", "StartC", "StartA2"] + step: ["StartA3", "StartC", "StartA2"] }); }) @@ -358,12 +335,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_0600', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_0600====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -418,12 +395,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_0700', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_0700====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -432,7 +409,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); console.log('ACTS_AbilityMultiInstance_Single_0700 finish callBackSeq = ' + data.data); expect(data.data).assertEqual(checkEventResults[checkIndex++]); - expect(checkIndex).assertEqual(4); + expect(checkIndex).assertEqual(3); commonEvent.unsubscribe(subscriber, unSubscribeCallback); console.log('ACTS_AbilityMultiInstance_Single_0700 finish'); } else if (data.event == "MultiInstanceStartNext") { @@ -478,12 +455,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_0800', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_0800====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -492,7 +469,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); console.log('ACTS_AbilityMultiInstance_Single_0800 finish callBackSeq = ' + data.data); expect(data.data).assertEqual(checkEventResults[checkIndex++]); - expect(checkIndex).assertEqual(4); + expect(checkIndex).assertEqual(3); commonEvent.unsubscribe(subscriber, unSubscribeCallback); console.log('ACTS_AbilityMultiInstance_Single_0800 finish'); } else if (data.event == "MultiInstanceStartNext") { @@ -527,7 +504,7 @@ export default function abilityTest(abilityContext) { startId: 0, stepNum: 4, nextStep: 0, - step: ["StartA1", "StartB", "StartC", "StartA2"] + step: ["StartA3", "StartB", "StartC", "StartA2"] }); }) @@ -538,12 +515,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_0900', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_0900====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -552,7 +529,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); console.log('ACTS_AbilityMultiInstance_Single_0900 finish callBackSeq = ' + data.data); expect(data.data).assertEqual(checkEventResults[checkIndex++]); - expect(checkIndex).assertEqual(4); + expect(checkIndex).assertEqual(3); commonEvent.unsubscribe(subscriber, unSubscribeCallback); console.log('ACTS_AbilityMultiInstance_Single_0900 finish'); } else if (data.event == "MultiInstanceStartNext") { @@ -598,12 +575,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_1000', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_1000====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -612,7 +589,7 @@ export default function abilityTest(abilityContext) { clearTimeout(id); console.log('ACTS_AbilityMultiInstance_Single_1000 finish callBackSeq = ' + data.data); expect(data.data).assertEqual(checkEventResults[checkIndex++]); - expect(checkIndex).assertEqual(4); + expect(checkIndex).assertEqual(3); commonEvent.unsubscribe(subscriber, unSubscribeCallback); console.log('ACTS_AbilityMultiInstance_Single_1000 finish'); } else if (data.event == "MultiInstanceStartNext") { @@ -658,12 +635,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_1100', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_1100====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -718,12 +695,12 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_1200', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_1200====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -767,7 +744,7 @@ export default function abilityTest(abilityContext) { startId: 0, stepNum: 4, nextStep: 0, - step: ["StartDMain1", "StartDSec", "StartDThd", "StartDMain2"] + step: ["StartDMain2", "StartDSec", "StartDThd", "StartDMain1"] }); }) @@ -778,11 +755,11 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_1300', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_1300====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -837,11 +814,11 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_1400', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_1400====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -896,11 +873,11 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_1500', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_1500====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -944,7 +921,7 @@ export default function abilityTest(abilityContext) { startId: 0, stepNum: 2, nextStep: 0, - step: ["StartA1", "StartE"] + step: ["StartA2", "StartE"] }); }) @@ -955,11 +932,11 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_1600', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_1600====Subscribe CallBack data:====>" + JSON.stringify(data)); @@ -1013,11 +990,11 @@ export default function abilityTest(abilityContext) { */ it('ACTS_AbilityMultiInstance_Single_1700', 0, async function (done) { console.log('ACTS_AbilityMultiInstance_Single_1700====Subscribe CallBack data:====>" + JSON.stringify(data)); diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js index da3ae9e599711778c30745b63351f2eef8880553..ad64aff7631daaa36324dd282bf7c18ccc289b10 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js @@ -16,6 +16,8 @@ import featureAbility from '@ohos.ability.featureAbility' import commonEvent from '@ohos.commonEvent' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +const errCode = 1; + describe('ActsStServiceAbilityTest', function () { let bundleName = "com.amsst.stserviceabilityserver"; let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility"; @@ -98,7 +100,7 @@ describe('ActsStServiceAbilityTest', function () { featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ console.log('ACTS_AAbilityStartSetting_0100 asyncCallback errCode : ' + JSON.stringify(err) + " data: " + JSON.stringify(data)); - expect(2097152).assertEqual(err.code); + expect(errCode).assertEqual(err.code); done(); }); }catch(error){ @@ -136,7 +138,7 @@ describe('ActsStServiceAbilityTest', function () { featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ console.log('ACTS_AAbilityStartSettingNew_0200 asyncCallback errCode : ' + JSON.stringify(err) + " data: " + JSON.stringify(data)); - expect(2097152).assertEqual(err.code); + expect(errCode).assertEqual(err.code); done(); }); }catch(error){ @@ -174,7 +176,7 @@ it("ACTS_AAbilityStartSettingNew_0300",0, async function(done){ featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ console.log('ACTS_AAbilityStartSettingNew_0300 asyncCallback errCode : ' + JSON.stringify(err) + " data: " + JSON.stringify(data)); - expect(2097152).assertEqual(err.code); + expect(errCode).assertEqual(err.code); done(); }); }catch(error){ @@ -212,7 +214,7 @@ it("ACTS_AAbilityStartSettingNew_0400",0, async function(done){ featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ console.log('ACTS_AAbilityStartSettingNew_0400 asyncCallback errCode : ' + JSON.stringify(err) + " data: " + JSON.stringify(data)); - expect(2097152).assertEqual(err.code); + expect(errCode).assertEqual(err.code); done(); }); }catch(error){ @@ -250,7 +252,7 @@ it("ACTS_AAbilityStartSettingNew_0500",0, async function(done){ featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ console.log('ACTS_AAbilityStartSettingNew_0500 asyncCallback errCode : ' + JSON.stringify(err) + " data: " + JSON.stringify(data)); - expect(2097152).assertEqual(err.code); + expect(errCode).assertEqual(err.code); done(); }); }catch(error){ diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js index 6a799876d5fe8670b3458fc274c3a85cbf224538..ab3ae014c4a2ac97447e382af9de41ac7febb61f 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -25,6 +25,7 @@ const CREATELOCALDIR = "/data/storage/el2/base/haps/entry"; const START_ABILITY_TIMEOUT = 4000; const TERMINATE_ABILITY_TIMEOUT = 1000; const TIMEOUT = 1000; +const errCode = 1; var subscriberInfoActsStartAbility0100 = { events: ["ACTS_StartAbility_0100_CommonEvent"], }; @@ -1845,7 +1846,7 @@ describe('ActsFeatureAbilityTest', function () { featureAbility.startAbility(StartAbilityParameter,(err,data)=>{ console.log('ACTS_StartAbility_0700 asyncCallback errCode : ' + JSON.stringify(err) + " data: " + JSON.stringify(data)); - expect(err.code == 2097152).assertTrue(); + expect(errCode).assertEqual(error.code); done(); }); }catch(error){ diff --git a/arkui/BUILD.gn b/arkui/BUILD.gn index 65aba8e5340b83375f39fa5d401bd82f37420ad6..a1624651182a08f9b101d9ad9e7ac597c3261b4f 100644 --- a/arkui/BUILD.gn +++ b/arkui/BUILD.gn @@ -14,19 +14,18 @@ group("arkui") { testonly = true deps = [ - "ace_ets_component:AceEtsComponentTest", - "ace_ets_component_five:AceEtsComponentFiveTest", - "ace_ets_component_four:AceEtsComponentFourTest", - "ace_ets_component_three:AceEtsComponentThreeTest", - "ace_ets_component_two:AceEtsComponentTwoTest", + "ace_ets_component:ActsAceEtsComponentTest", + "ace_ets_component_five:ActsAceEtsComponentFiveTest", + "ace_ets_component_four:ActsAceEtsComponentFourTest", + "ace_ets_component_three:ActsAceEtsComponentThreeTest", + "ace_ets_component_two:ActsAceEtsComponentTwoTest", "ace_ets_dev:ActsAceDevTest", "ace_ets_standard:ActsAceEtsStTest", "ace_ets_test:ActsAceEtsTest", "ace_ets_third_test:ActsAceEtsThirdTest", - - #"ace_ets_xcomponent:ActsAceXComponentEtsTest", - #"ace_napi_test:ActsAceNapiEtsTest", - "ace_standard:ace_standard_test", - "ace_standard_video:ace_standard_video_test", + "ace_ets_xcomponent:ActsAceXComponentEtsTest", + "ace_napi_test:ActsAceNapiEtsTest", + "ace_standard:ActsAceStandardTest", + "ace_standard_video:ActsAceStandardVideoTest", ] } diff --git a/arkui/ace_ets_component/BUILD.gn b/arkui/ace_ets_component/BUILD.gn index 4719f3da60cf93502822009c2e9a37d3c4d5b2b9..ebb915ef410e89655251634b36a70f71da36a5aa 100644 --- a/arkui/ace_ets_component/BUILD.gn +++ b/arkui/ace_ets_component/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("AceEtsComponentTest") { +ohos_js_hap_suite("ActsAceEtsComponentTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":ace_ets_component_assets", @@ -22,7 +22,7 @@ ohos_js_hap_suite("AceEtsComponentTest") { ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "AceEtsComponentTest" + hap_name = "ActsAceEtsComponentTest" } ohos_js_assets("ace_ets_component_assets") { source_dir = "./entry/src/main/ets/MainAbility" diff --git a/arkui/ace_ets_component/Test.json b/arkui/ace_ets_component/Test.json index a25c556606a014f142facbd48f130ec908904355..66d0d6f5eb1baa5680bc21396b2fd6b08e9156ec 100644 --- a/arkui/ace_ets_component/Test.json +++ b/arkui/ace_ets_component/Test.json @@ -10,7 +10,7 @@ "kits": [ { "test-file-name": [ - "AceEtsComponentTest.hap" + "ActsAceEtsComponentTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets index 6bd53b80f9df047382631362a47e6766335f69cf..664cf48ecb772dddbb493475684accbb2ae44bc6 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets @@ -17,7 +17,11 @@ @Entry @Component struct GlobalExample { + + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + onPageShow() { + console.info("global page called") } build() { diff --git a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/touch.ets b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/touch.ets index 0984892e1662401a33774e9ea5f1836e94855dea..827adbedfce151915b4718fa0838ba20caa2bb16 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/touch.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/touch.ets @@ -80,12 +80,7 @@ struct TouchExample { + '\nDistance between touch point and touch element:\nx: ' + event.touches[0].x + '\n' + 'y: ' + event.touches[0].y + '\ncomponent globalPos:(' + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\nwidth:' - + event.target.area.width + '\nheight:' + event.target.area.height) - console.info(this.text = 'TouchType:' + this.eventType - + '\nDistance between touch point and touch element:\nx: ' - + event.changedTouches[0].x + '\n' + 'y: ' + event.changedTouches[0].y + '\ncomponent globalPos:(' - + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\nwidth:' - + event.target.area.width + '\nheight:' + event.target.area.height) + + event.target.area.width + '\nheight:' + event.target.area.height); console.log('fang--->A') try { console.log('fang--->B') @@ -102,7 +97,7 @@ struct TouchExample { console.log('fang--->D') console.info("touchFlag start to emit action state") events_emitter.emit(backEvent, backData) - } catch { + } catch(err) { console.info("touchFlag emit action state err: " + JSON.stringify(err.message)) } }) diff --git a/arkui/ace_ets_component_five/BUILD.gn b/arkui/ace_ets_component_five/BUILD.gn index 48ba58aae0d83e9f12d3f24ec840cb734fd93acb..7922599eb9ee13ded443289137fe75874fc79f1f 100644 --- a/arkui/ace_ets_component_five/BUILD.gn +++ b/arkui/ace_ets_component_five/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("AceEtsComponentFiveTest") { +ohos_js_hap_suite("ActsAceEtsComponentFiveTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":ace_ets_component_assets", @@ -22,7 +22,7 @@ ohos_js_hap_suite("AceEtsComponentFiveTest") { ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "AceEtsComponentFiveTest" + hap_name = "ActsAceEtsComponentFiveTest" } ohos_js_assets("ace_ets_component_assets") { source_dir = "./entry/src/main/ets/MainAbility" diff --git a/arkui/ace_ets_component_five/Test.json b/arkui/ace_ets_component_five/Test.json index 2191fc5a718a2673a4e24c9aaa7f44bef50eb5fb..ceb7856dc41dc0ee8897ba7dcfd721dfcea838c3 100644 --- a/arkui/ace_ets_component_five/Test.json +++ b/arkui/ace_ets_component_five/Test.json @@ -10,7 +10,7 @@ "kits": [ { "test-file-name": [ - "AceEtsComponentFiveTest.hap" + "ActsAceEtsComponentFiveTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/arkui/ace_ets_component_five/entry/src/main/ets/test/OhosMatrix4Jsunit.test.ets b/arkui/ace_ets_component_five/entry/src/main/ets/test/OhosMatrix4Jsunit.test.ets index be792e1c71615fdc3a9f06d7f0c7904bcd0a7815..d90aa5c17b0ec558865d20230db0037cd923e764 100644 --- a/arkui/ace_ets_component_five/entry/src/main/ets/test/OhosMatrix4Jsunit.test.ets +++ b/arkui/ace_ets_component_five/entry/src/main/ets/test/OhosMatrix4Jsunit.test.ets @@ -168,7 +168,10 @@ export default function ohosMatrix4Jsunit() { let strJsonNew = getInspectorByKey('rotate6'); let objNew = JSON.parse(strJsonNew); console.info("[test_OhosMatrix4_006] component objNew is: " + JSON.stringify(objNew)); - expect(JSON.stringify(objNew.$attrs.transform)).assertEqual('{}'); + console.info("[test_OhosMatrix4_006] component transform is: " + JSON.stringify(objNew.$attrs.transform)); + expect(JSON.stringify(objNew.$attrs.transform)).assertEqual('{"type":"matrix",' + + '"matrix":"0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,' + + '0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,"}'); done(); }); }) diff --git a/arkui/ace_ets_component_four/BUILD.gn b/arkui/ace_ets_component_four/BUILD.gn index dc19952543210b17af5d8901e1e9745f153a8f51..3a586fca76bad316dcc54f717d6d454079b9d18c 100644 --- a/arkui/ace_ets_component_four/BUILD.gn +++ b/arkui/ace_ets_component_four/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("AceEtsComponentFourTest") { +ohos_js_hap_suite("ActsAceEtsComponentFourTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":ace_ets_component_assets", @@ -22,7 +22,7 @@ ohos_js_hap_suite("AceEtsComponentFourTest") { ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "AceEtsComponentFourTest" + hap_name = "ActsAceEtsComponentFourTest" } ohos_js_assets("ace_ets_component_assets") { source_dir = "./entry/src/main/ets/MainAbility" diff --git a/arkui/ace_ets_component_four/Test.json b/arkui/ace_ets_component_four/Test.json index c11e2a44947fd669749d59be580b2e8a7bbe991f..e9bad698b0708b455d111d36703606b89af7f369 100644 --- a/arkui/ace_ets_component_four/Test.json +++ b/arkui/ace_ets_component_four/Test.json @@ -10,7 +10,7 @@ "kits": [ { "test-file-name": [ - "AceEtsComponentFourTest.hap" + "ActsAceEtsComponentFourTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/arkui/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panDirection.ets b/arkui/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panDirection.ets index 340dff72a0139155278e64e666f2b5d53b055275..9e10ba08bff43b5eb9e2ec8c8a4e0a3bc3adea01 100644 --- a/arkui/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panDirection.ets +++ b/arkui/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/panDirection.ets @@ -28,9 +28,7 @@ struct PanGestureExample { .key('panDirection').height(100).width(200).padding(20).border({ width: 1 }).margin(80) .translate({ x: this.offsetX, y: this.offsetY, z: 5 }) .gesture( - PanGesture({}) - .direction(this.direction) - .setDirection(this.direction) + PanGesture({direction:this.direction}) .onActionStart((event: PanGestureEvent) => { console.info('Pan start') }) diff --git a/arkui/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textInput.ets b/arkui/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textInput.ets index c5db31be77aa7e2cb16d51841ce0378c2480e372..3bdac0fe44a100ef397488a3e0817461e76be078 100644 --- a/arkui/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textInput.ets +++ b/arkui/ace_ets_component_four/entry/src/main/ets/MainAbility/pages/textInput.ets @@ -57,7 +57,6 @@ struct TextAreaExample2 { Column() { TextArea({ placeholder: 'input your word' }) .key('TextInput') - .type(this.inputType) .placeholderColor("rgb(0,0,225)") .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic }) .textAlign(this.textAlign) diff --git a/arkui/ace_ets_component_four/entry/src/main/ets/test/AppStorageJsunit.test.ets b/arkui/ace_ets_component_four/entry/src/main/ets/test/AppStorageJsunit.test.ets index 9c05888498652f62d8d51de00d59c277f1e5530e..f73206b417915fa0097a43fa469b92070692b139 100644 --- a/arkui/ace_ets_component_four/entry/src/main/ets/test/AppStorageJsunit.test.ets +++ b/arkui/ace_ets_component_four/entry/src/main/ets/test/AppStorageJsunit.test.ets @@ -97,51 +97,6 @@ export default function AppStorageJsunit() { done(); }); - /** - * @tc.number stateManagement_Environment_EnvProp_0100 - * @tc.name stateManagement Environment validation - * @tc.desc Function test - */ - it('stateManagement_Environment_EnvProp_colorMode_0100', 0, function (done) { - console.info('[stateManagement_Environment_EnvProp_colorMode_0100] START'); - Environment.EnvProp("colorMode", ColorMode.LIGHT); - let enable = AppStorage.Get("colorMode"); - expect(enable == ColorMode.LIGHT) - .assertTrue; - console.info('[stateManagement_Environment_EnvProp_colorMode_0100] enable =' + enable); - Environment.EnvProp("colorMode", ColorMode.DARK); - let enable1 = AppStorage.Get("colorMode"); - console.info('[stateManagement_Environment_EnvProp_colorMode_0100] enable1 =' + enable1); - expect(enable1 == ColorMode.DARK) - .assertTrue; - console.info('[stateManagement_Environment_EnvProp_colorMode_0100] END'); - done(); - }); - - /** - * @tc.number stateManagement_Environment_EnvProp_0100 - * @tc.name stateManagement Environment validation - * @tc.desc Function test - */ - it('stateManagement_Environment_EnvProp_layoutDirection_0100', 0, function (done) { - console.info('[stateManagement_Environment_EnvProp_layoutDirection_0100] START'); - Environment.EnvProp("layoutDirection", LayoutDirection.LTR); - let enable = AppStorage.Get("layoutDirection"); - expect(enable == LayoutDirection.LTR) - .assertTrue; - console.info('[stateManagement_Environment_EnvProp_layoutDirection_0100] enable =' + enable); - Environment.EnvProp("layoutDirection", LayoutDirection.RTL); - let enable1 = AppStorage.Get("layoutDirection"); - expect(enable1 == LayoutDirection.RTL) - .assertTrue; - console.info('[stateManagement_Environment_EnvProp_layoutDirection_0100] enable1' + enable1); - Environment.EnvProp("layoutDirection", LayoutDirection.Auto); - let enable2 = AppStorage.Get("layoutDirection"); - expect(enable2 == LayoutDirection.Auto) - .assertTrue; - console.info('[stateManagement_Environment_EnvProp_layoutDirection_0100] enable2' + enable2); - done(); - }); /** * @tc.number stateManagement_Environment_EnvProps_0100 diff --git a/arkui/ace_ets_component_four/entry/src/main/ets/test/TextInputJsunit.test.ets b/arkui/ace_ets_component_four/entry/src/main/ets/test/TextInputJsunit.test.ets index ee11edde974907d5bcbfb797c0c951f32616c89a..912d44a43d43b0b670892500b9acfc1ea02f9840 100644 --- a/arkui/ace_ets_component_four/entry/src/main/ets/test/TextInputJsunit.test.ets +++ b/arkui/ace_ets_component_four/entry/src/main/ets/test/TextInputJsunit.test.ets @@ -90,7 +90,7 @@ export default function textInputJsunit() { console.info("[textInputTest03] component strJson:" + strJson); let obj = JSON.parse(strJson); console.info("[textInputTest03] fontColor:" + obj.$attrs.fontColor); - expect(obj.$attrs.fontColor).assertEqual('#E6000000'); + expect(obj.$attrs.fontColor).assertEqual('#FF000000'); done(); }); @@ -115,7 +115,7 @@ export default function textInputJsunit() { let strJson = getInspectorByKey('TextInput'); let obj = JSON.parse(strJson); console.info("[textInputTest04] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontColor).assertEqual('#E6000000'); + expect(obj.$attrs.fontColor).assertEqual('#FFFF0000'); done(); }); diff --git a/arkui/ace_ets_component_three/BUILD.gn b/arkui/ace_ets_component_three/BUILD.gn index ed4f189b6543d9fa3f02854cb588c6b8d612cf0c..b654560a925fe2ffdc1531cc196f3024330b5a10 100644 --- a/arkui/ace_ets_component_three/BUILD.gn +++ b/arkui/ace_ets_component_three/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("AceEtsComponentThreeTest") { +ohos_js_hap_suite("ActsAceEtsComponentThreeTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":ace_ets_component_assets", @@ -22,7 +22,7 @@ ohos_js_hap_suite("AceEtsComponentThreeTest") { ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "AceEtsComponentThreeTest" + hap_name = "ActsAceEtsComponentThreeTest" } ohos_js_assets("ace_ets_component_assets") { source_dir = "./entry/src/main/ets/MainAbility" diff --git a/arkui/ace_ets_component_three/Test.json b/arkui/ace_ets_component_three/Test.json index 39b052a6ba653695c319abcb5dc05438cfe3abf0..dcf5f9347f214bb0d380e01c1897fbd959188117 100644 --- a/arkui/ace_ets_component_three/Test.json +++ b/arkui/ace_ets_component_three/Test.json @@ -10,7 +10,7 @@ "kits": [ { "test-file-name": [ - "AceEtsComponentThreeTest.hap" + "ActsAceEtsComponentThreeTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets index 36267d00cefb5ed274a79f25605557737fab79a1..fd9cf5e7a0c01c6497d814b02ec10b320101babf 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets @@ -54,10 +54,7 @@ struct PanGestureExample { .translate({ x: this.offsetX, y: this.offsetY, z: 5 }) .touchable(this.touchable) .gesture( - PanGesture({}) - .setDirection(PanDirection.All) - .setDistance(1) - .setFingers(1) + PanGesture({ fingers: 1, direction: PanDirection.All, distance: 1 }) .onActionStart((event: PanGestureEvent) => { console.info('Pan start') console.log('PanGesture globalX' + event.globalX); diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets index 7a1baffa182d6cae5243b5eedaabf0bfeb178f5f..98920af57462328f2f5828556a891bb1c689b752 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/button.ets @@ -19,7 +19,7 @@ import events_emitter from '@ohos.events.emitter'; @Component struct ButtonExample { @State buttonTypeValue: ButtonType = ButtonType.Normal; - @State fontSizeValue: number = 20; + @State fontSizeValue: string = '20px'; @State fontColorValue: Color = Color.Black; @State text: string = ''; @State onClickValue: boolean = false; @@ -120,6 +120,7 @@ struct ButtonExample { .width(200) .height(100) .fontSize(20) + .position({x: 50,y: 400}) .onClick((event: ClickEvent) => { console.info(this.text = 'Click Point:' + '\n screenX:' + event.screenX + '\n screenY:' + event.screenY + '\n x :' + event.x + '\n y:' + event.y + '\ntarget:' + '\n component globalPos:(' diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets index cc35234f8cfc79fcc141d8e91e7daf9d64059d4a..ed3fe96ee9585e5c1ec00dbc308447de918783ab 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets @@ -75,7 +75,7 @@ export default function buttonJsunit() { let strJson = getInspectorByKey('button2'); let obj = JSON.parse(strJson); console.info("[testButton03] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.fontSize).assertEqual('20'); + expect(obj.$attrs.fontSize).assertEqual('20.00px'); done(); }); @@ -121,7 +121,7 @@ export default function buttonJsunit() { try { var eventData = { data: { - "fontSizeValue": 30, + "fontSizeValue": '30px', } } var innerEvent = { @@ -137,7 +137,7 @@ export default function buttonJsunit() { let strJsonNew = getInspectorByKey('button2'); let objNew = JSON.parse(strJsonNew); console.info("[testButton05] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.fontSize).assertEqual('30'); + expect(objNew.$attrs.fontSize).assertEqual('30.00px'); done(); }); @@ -163,7 +163,7 @@ export default function buttonJsunit() { let strJsonNew = getInspectorByKey('button2'); let objNew = JSON.parse(strJsonNew); console.info("[testButton07] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.fontSize).assertEqual('0'); + expect(objNew.$attrs.fontSize).assertEqual('-1.00fp'); done(); }); @@ -173,7 +173,7 @@ export default function buttonJsunit() { try { var eventData = { data: { - "fontSizeValue": "121212121", + "fontSizeValue": "121212121px", } } var innerEvent = { @@ -189,7 +189,7 @@ export default function buttonJsunit() { let strJsonNew = getInspectorByKey('button2'); let objNew = JSON.parse(strJsonNew); console.info("[testButton08] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.fontSize).assertEqual('121212121'); + expect(objNew.$attrs.fontSize).assertEqual('121212121.00px'); done(); }); @@ -199,7 +199,7 @@ export default function buttonJsunit() { try { var eventData = { data: { - "fontSizeValue": "121212121vaas", + "fontSizeValue": "121212121px", } } var innerEvent = { @@ -215,7 +215,7 @@ export default function buttonJsunit() { let strJsonNew = getInspectorByKey('button2'); let objNew = JSON.parse(strJsonNew); console.info("[testButton09] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.fontSize).assertEqual('121212121'); + expect(objNew.$attrs.fontSize).assertEqual('121212121.00px'); done(); }); @@ -301,10 +301,10 @@ export default function buttonJsunit() { let event = JSON.parse(eventData.data.event); console.info("[testButton12] get event state result is: " + Math.trunc(event.screenY)); console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX)); - expect(event.screenX).assertEqual(135) - expect(event.screenY).assertEqual(368.80340576171875) + expect(event.screenX).assertEqual(185) + expect(event.screenY).assertEqual(485) expect(event.x).assertEqual(100) - expect(event.y).assertEqual(31.196568154881163) + expect(event.y).assertEqual(50) } var innerEvent = { eventId: 4, diff --git a/arkui/ace_ets_component_two/BUILD.gn b/arkui/ace_ets_component_two/BUILD.gn index d5704e02fde327607e3eecfa1d23cea5ea020e08..2c4f7f3a0590730a0784d4f3fc932418b0b084e1 100644 --- a/arkui/ace_ets_component_two/BUILD.gn +++ b/arkui/ace_ets_component_two/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("AceEtsComponentTwoTest") { +ohos_js_hap_suite("ActsAceEtsComponentTwoTest") { hap_profile = "./entry/src/main/config.json" deps = [ ":ace_ets_component_assets", @@ -22,7 +22,7 @@ ohos_js_hap_suite("AceEtsComponentTwoTest") { ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "AceEtsComponentTwoTest" + hap_name = "ActsAceEtsComponentTwoTest" } ohos_js_assets("ace_ets_component_assets") { source_dir = "./entry/src/main/ets/MainAbility" diff --git a/arkui/ace_ets_component_two/Test.json b/arkui/ace_ets_component_two/Test.json index 976bf6aba45a3c04e02f97d04b5f649c8986825c..37bc0626fb2a97626e5579061152b9e44c111dbd 100644 --- a/arkui/ace_ets_component_two/Test.json +++ b/arkui/ace_ets_component_two/Test.json @@ -10,7 +10,7 @@ "kits": [ { "test-file-name": [ - "AceEtsComponentTwoTest.hap" + "ActsAceEtsComponentTwoTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets index 37a01446203a15c24edc44f0a527ce8462e180e4..9c7cc1a5be5ecb29a81d8b71a88b6d6465682481 100644 --- a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets +++ b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/loadingProgress.ets @@ -48,6 +48,7 @@ struct LoadingProgressExample { .width('90%') .key('LP') LoadingProgress() + .height(50) .color(Color.Black) }.width('100%').margin({ top: 6 }) } diff --git a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition.ets b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition.ets index 98373897d11067d9b3c2e6695ec2aaf7a0a313ec..f9e6678dbd468b5a6733941d5a112e2d068488b0 100644 --- a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition.ets +++ b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/pageTransition.ets @@ -70,7 +70,6 @@ struct PageTransitionExample1 { onPageShow() { console.info('active page show called'); - events_emitter.on(stateChangeEvent, this.stateChangCallBack) var stateChangeEventOne = { eventId: 145, diff --git a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/search.ets b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/search.ets index d227a1c3e7688e6d3613ab495b8df1473ef7f463..28a06117d1ec3b79033b13cbf04ce99de3969420 100644 --- a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/search.ets +++ b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/search.ets @@ -20,9 +20,14 @@ import events_emitter from '@ohos.events.emitter' struct SearchExample { @State changevalue: string= '' @State submitvalue: string= '' - @State controller: SearchController= new SearchController() - @State textFont:Font=10 - @State searchButton:number=10 + @State textFont:Font = { + size: 10, + weight: 10, + family: 'serif', + style: FontStyle.Normal + } + @State searchButton:string = "10" + controller: SearchController= new SearchController() private stateChangCallBack = (eventData) => { console.info("search page state change called:" + JSON.stringify(eventData)); diff --git a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/sourceType.ets b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/sourceType.ets index 770c4f50cc47f475d4c81c758c91bb698f82aff3..51cb733b1c1be2cbcdba01bcd3ab0ea2085db7c2 100644 --- a/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/sourceType.ets +++ b/arkui/ace_ets_component_two/entry/src/main/ets/MainAbility/pages/sourceType.ets @@ -33,13 +33,13 @@ struct ClickExample { if (event.type === TouchType.Move) { this.eventType = 'Move' } - if (event.source === Unknown) { + if (event.source === SourceType.Unknown) { this.SourceType = 'Unknown' } - if (event.source === Mouse) { + if (event.source === SourceType.Mouse) { this.SourceType = 'Mouse' } - if (event.type === TouchScreen) { + if (event.type === SourceType.TouchScreen) { this.SourceType = 'TouchScreen' } console.info(this.text = 'source:' + event.source); diff --git a/arkui/ace_ets_component_two/entry/src/main/ets/test/DatePickerJsunit.test.ets b/arkui/ace_ets_component_two/entry/src/main/ets/test/DatePickerJsunit.test.ets index da5cd7d0cd0d15c044fe797856ab88e49c32cc7c..9749b145fe1757306d5a21d71bb8ae0182f2ab0b 100644 --- a/arkui/ace_ets_component_two/entry/src/main/ets/test/DatePickerJsunit.test.ets +++ b/arkui/ace_ets_component_two/entry/src/main/ets/test/DatePickerJsunit.test.ets @@ -56,17 +56,6 @@ export default function datePickerJsunit() { done(); }); - it('datePickerTest_0200', 0, async function (done) { - console.info('datePickerTest_0200 START'); - let strJson = getInspectorByKey('datePicker'); - console.info("datePickerTest_0200 component strJson:" + strJson); - let obj = JSON.parse(strJson); - console.info("datePickerTest_0200 component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.useMilitaryTime).assertEqual('true'); - console.info('datePickerTest_0200 END'); - done(); - }); - it('datePickerTest_0300', 0, async function (done) { console.info('datePickerTest_0300 START'); try { diff --git a/arkui/ace_ets_standard/entry/src/main/ets/MainAbility/pages/Button.ets b/arkui/ace_ets_standard/entry/src/main/ets/MainAbility/pages/Button.ets index df87b3bc6c6df3c820b73c35e875c278c8851792..583f1c3edb7bec045442c14980f7eded2347a5b4 100644 --- a/arkui/ace_ets_standard/entry/src/main/ets/MainAbility/pages/Button.ets +++ b/arkui/ace_ets_standard/entry/src/main/ets/MainAbility/pages/Button.ets @@ -36,7 +36,7 @@ struct button_testcase { .fontSize(50) .fontWeight(FontWeight.Bold) Button('1.value', { type: ButtonType.Circle, stateEffect: this.stateEffect }) - .fontSize(12) + .fontSize('12px') .fontWeight(FontWeight.Bold) .fontColor(0xCCCCCC) .height(40) diff --git a/arkui/ace_ets_standard/entry/src/main/ets/test/ButtonJsunit.test.ets b/arkui/ace_ets_standard/entry/src/main/ets/test/ButtonJsunit.test.ets index 115aabb990cf988e412c838f87432fe16269da13..7081f8dbc59302e3e687697407b5612d634c46b0 100644 --- a/arkui/ace_ets_standard/entry/src/main/ets/test/ButtonJsunit.test.ets +++ b/arkui/ace_ets_standard/entry/src/main/ets/test/ButtonJsunit.test.ets @@ -71,7 +71,7 @@ export default function buttonJsunit() { expect(obj.$attrs.type).assertEqual('ButtonType.Circle') expect(obj.$attrs.stateEffect).assertEqual('true') expect(obj.$attrs.label).assertEqual('1.value') - expect(obj.$attrs.fontSize).assertEqual('12') + expect(obj.$attrs.fontSize).assertEqual('12.00px') console.info('cd buttonInspectorByKey END'); done(); }); diff --git a/arkui/ace_ets_standard/entry/src/main/ets/test/TextJsunit.test.ets b/arkui/ace_ets_standard/entry/src/main/ets/test/TextJsunit.test.ets index b3ab6feeb7a85fcb4d7835c0fb43fe6d5aaf35f4..b2b92908f97628d5e444f3dab5f645e7cc59f46c 100644 --- a/arkui/ace_ets_standard/entry/src/main/ets/test/TextJsunit.test.ets +++ b/arkui/ace_ets_standard/entry/src/main/ets/test/TextJsunit.test.ets @@ -95,7 +95,7 @@ export default function textJsunit() { expect(obj.$attrs.fontFamily).assertEqual("sans-serif") expect(obj.$attrs.textAlign).assertEqual("TextAlign.End") expect(obj.$attrs.textOverflow).assertEqual("TextOverflow.Ellipsis") - expect(obj.$attrs.lineHeight).assertEqual("15") + expect(obj.$attrs.lineHeight).assertEqual("15.00fp") expect(obj.$attrs.baselineOffset).assertEqual("0") expect(obj.$attrs.maxLines).assertEqual("2") expect(obj.$attrs.textCase).assertEqual("TextCase.Normal") diff --git a/arkui/ace_ets_test/entry/src/main/ets/test/ListItemJsunit.test.ets b/arkui/ace_ets_test/entry/src/main/ets/test/ListItemJsunit.test.ets index 45660bc96a40a371828215ec44b073a1dc8c0526..e8c34d1fa9517d4c1a630904dc501c876770f8d5 100644 --- a/arkui/ace_ets_test/entry/src/main/ets/test/ListItemJsunit.test.ets +++ b/arkui/ace_ets_test/entry/src/main/ets/test/ListItemJsunit.test.ets @@ -116,7 +116,7 @@ export default function listItemJsunit() { console.log('ListItem3‘s editable is ' + JSON.stringify(obj.$attrs.editable)) await sleep(1) expect(obj.$attrs.sticky).assertEqual('Sticky.Opacity') - expect(obj.$attrs.editable).assertEqual('false') + expect(obj.$attrs.editable).assertEqual('EditMode.None') console.info('++++++++++++++++ ListItem TestCase 3 End ++++++++++++++++'); done(); }); diff --git a/arkui/ace_ets_third_test/entry/src/main/ets/test/NavigationJsunit.test.ets b/arkui/ace_ets_third_test/entry/src/main/ets/test/NavigationJsunit.test.ets index 28eeff7d708c8d55e43ffd5afee6e0ec1d759836..ab78f0d21d3e576a8cc1b8c23903d8d37bb263e8 100644 --- a/arkui/ace_ets_third_test/entry/src/main/ets/test/NavigationJsunit.test.ets +++ b/arkui/ace_ets_third_test/entry/src/main/ets/test/NavigationJsunit.test.ets @@ -36,10 +36,12 @@ export default function navigationJsunit() { */ beforeEach(async function (done) { console.info('[navigationTest] before each called') + await sleep(1) let options = { uri: 'pages/Navigation', } try { + router.clear(); let result = router.push(options) console.info("push navigation page success " + JSON.stringify(result)); } catch (err) { diff --git a/arkui/ace_ets_xcomponent/entry/src/main/cpp/BUILD.gn b/arkui/ace_ets_xcomponent/entry/src/main/cpp/BUILD.gn index 298d67dd16df28ea1b1074b5104b9a2ef2b6d31c..ce60b886b713e2d2deaec55cd3cf63fcf778b704 100644 --- a/arkui/ace_ets_xcomponent/entry/src/main/cpp/BUILD.gn +++ b/arkui/ace_ets_xcomponent/entry/src/main/cpp/BUILD.gn @@ -35,13 +35,17 @@ ohos_shared_library("nativerender") { "./render/egl_core.cpp", "./render/plugin_render.cpp", ] - if (target_cpu == "arm") { - libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] - } else if (target_cpu == "arm64") { - libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ] - } else { - libs = [] + + if (!(product_name == "m40")) { + if (target_cpu == "arm") { + libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] + } else if (target_cpu == "arm64") { + libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ] + } else { + libs = [] + } } + include_dirs = [ ".", "./common", diff --git a/arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn b/arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn index 32cb62765209e6bcfad63ae070d3e154d8f40d6a..8002ab1bf1f0ead1c684e3b6139edd97fc3b6c73 100644 --- a/arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn +++ b/arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn @@ -31,13 +31,16 @@ config("public_config") { ohos_shared_library("teststring") { sources = [ "./napi/test_string.cpp" ] - if (target_cpu == "arm") { - libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] - } else if (target_cpu == "arm64") { - libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ] - } else { - libs = [] + if (!(product_name == "m40")) { + if (target_cpu == "arm") { + libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] + } else if (target_cpu == "arm64") { + libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ] + } else { + libs = [] + } } + include_dirs = [ "//test/xts/acts/arkui/ace_napi_test/entry/src/main/cpp" ] configs = [ ":config" ] diff --git a/arkui/ace_standard/BUILD.gn b/arkui/ace_standard/BUILD.gn index c236820f246aec7eb16cc2be6cde661faf2a7ca4..a8e4bcd9e4f78b864cff0fb228de2ffe4d91545a 100644 --- a/arkui/ace_standard/BUILD.gn +++ b/arkui/ace_standard/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ace_standard_test") { +ohos_js_hap_suite("ActsAceStandardTest") { hap_profile = "./src/main/config.json" deps = [ ":ace_js_assets", diff --git a/arkui/ace_standard/src/main/js/default/pages/toolbar/router/index.js b/arkui/ace_standard/src/main/js/default/pages/toolbar/router/index.js index 9ef441a7c96e8512e390a613c74b9d42e9778f91..6a0e77252a1716f7e5286b914ae7922666ae4bd1 100644 --- a/arkui/ace_standard/src/main/js/default/pages/toolbar/router/index.js +++ b/arkui/ace_standard/src/main/js/default/pages/toolbar/router/index.js @@ -118,7 +118,7 @@ export default { style3:styleValue3, style4:styleValue4, style5:styleValue5, - style6:styleValue6, + style6:styleValue6 } }, diff --git a/arkui/ace_standard_video/BUILD.gn b/arkui/ace_standard_video/BUILD.gn index 5e9b4d08a7f41008e1e0be6058119aa93330cb47..15647634299b0e0443e5f557c53b0d65501bedac 100644 --- a/arkui/ace_standard_video/BUILD.gn +++ b/arkui/ace_standard_video/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ace_standard_video_test") { +ohos_js_hap_suite("ActsAceStandardVideoTest") { hap_profile = "./src/main/config.json" deps = [ ":ace_js_assets", diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets b/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets index c264f34d7b11c62ea88341f43d9fa46b55758ab9..070788296ee729ffe09fa5b7cc6473bc2ca91a68 100644 --- a/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets +++ b/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets @@ -23,87 +23,87 @@ import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager' export default function edmCallbackTest() { describe('edmCallback_test', function () { - // /** - // * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0001 - // * @tc.name test enableAdmin method in callback mode without user id - // * @tc.desc enable admin in callback mode - // */ - // it('enableAdmin_test_002', 0, async function (done) { - // var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - // enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent); - // async function OnReceiveEvent(err, datainfo) { - // console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - // expect(datainfo).assertTrue(); - - // var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - // console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - // expect(isEnabled).assertTrue(); - - // retValue = await enterpriseDeviceManager.disableAdmin(WANT1); - // console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - // expect(retValue).assertTrue(); - - // isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - // console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - // expect(isEnabled).assertFalse(); - // done(); - // } - // }) - - // /** - // * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0004 - // * @tc.name test enableAdmin method in callback mode with ADMIN_TYPE_SUPER param without user id - // * @tc.desc enable super admin in callback mode - // */ - // it('enableAdmin_test_004', 0, async function (done) { - // var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - // enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, OnReceiveEvent); - // async function OnReceiveEvent(err, datainfo) { - // console.log('enterpriseDeviceManager.enableAdmin : ' + retValue); - // expect(datainfo).assertTrue(); - - // var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); - // console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); - // expect(isEnabled).assertTrue(); - - // retValue = await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - // console.log('enterpriseDeviceManager.disableSuperAdmin : ' + retValue); - // expect(retValue).assertTrue(); - - // isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); - // console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); - // expect(isEnabled).assertFalse(); - // done(); - // } - // }) - - // /** - // * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0006 - // * @tc.name test enableAdmin method in callback mode without user id - // * @tc.desc enable admin in callback mode - // */ - // it('enableAdmin_test_006', 0, async function (done) { - // console.log(' enableAdmin()'); - // var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - // enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent); - // async function OnReceiveEvent(err, datainfo) { - // console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - // expect(datainfo).assertTrue(); - - // var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - // console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - // expect(isEnabled).assertTrue(); - - // retValue = await enterpriseDeviceManager.disableAdmin(WANT1); - // console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - // expect(retValue).assertTrue(); - - // isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - // console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - // expect(isEnabled).assertFalse(); - // done(); - // } - // }) + /** + * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0001 + * @tc.name test enableAdmin method in callback mode without user id + * @tc.desc enable admin in callback mode + */ + it('enableAdmin_test_002', 0, async function (done) { + await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent); + async function OnReceiveEvent(err, datainfo) { + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); + expect(datainfo).assertTrue(); + + var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); + console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); + expect(isEnabled).assertTrue(); + + var retValue = await enterpriseDeviceManager.disableAdmin(WANT1); + console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); + expect(retValue).assertTrue(); + + isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); + console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); + expect(isEnabled).assertFalse(); + done(); + } + }) + + /** + * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0004 + * @tc.name test enableAdmin method in callback mode with ADMIN_TYPE_SUPER param without user id + * @tc.desc enable super admin in callback mode + */ + it('enableAdmin_test_004', 0, async function (done) { + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, OnReceiveEvent); + async function OnReceiveEvent(err, datainfo) { + console.log('enterpriseDeviceManager.enableAdmin : ' + retValue); + expect(datainfo).assertTrue(); + + var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); + expect(isEnabled).assertTrue(); + + var retValue = await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.disableSuperAdmin : ' + retValue); + expect(retValue).assertTrue(); + + isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); + expect(isEnabled).assertFalse(); + done(); + } + }) + + /** + * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0006 + * @tc.name test enableAdmin method in callback mode without user id + * @tc.desc enable admin in callback mode + */ + it('enableAdmin_test_006', 0, async function (done) { + console.log(' enableAdmin()'); + await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent); + async function OnReceiveEvent(err, datainfo) { + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); + expect(datainfo).assertTrue(); + + var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); + console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); + expect(isEnabled).assertTrue(); + + var retValue = await enterpriseDeviceManager.disableAdmin(WANT1); + console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); + expect(retValue).assertTrue(); + + isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); + console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); + expect(isEnabled).assertFalse(); + done(); + } + }) /** * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0008 diff --git a/distributeddatamgr/BUILD.gn b/distributeddatamgr/BUILD.gn index 076d6369f267ea23abf563534f452a5b24a8123e..13262e64259d525ae46649ec45f21e60517c8c17 100644 --- a/distributeddatamgr/BUILD.gn +++ b/distributeddatamgr/BUILD.gn @@ -19,6 +19,7 @@ group("distributeddatamgr") { "appdatamgrjstest/hap:appdatamgr_js_test", "distributeddataObjectjstest/hap:distributeddataObject_js_test", "distributeddatamgrjstest/hap:distributeddatamgr_js_test", + "windowStage:windowStage", ] } else { deps = [ diff --git a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareCombinationRdb.ets b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareCombinationRdb.ets index 93ddbbe319d7325acc6bb3881ef35f0c5c94a98e..3679c6f36e7ffb1e7881eb5f431a5d23b703a9ee 100644 --- a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareCombinationRdb.ets +++ b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareCombinationRdb.ets @@ -1,17 +1,17 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' import dataShare from '@ohos.data.dataShare' @@ -214,8 +214,8 @@ export default function DataShareCombinationRdb() { expect(err).assertFail(); } }) - - /* + + /* * @tc.number : SUB_DDM_DataShare_ETS_DataShareCombinationRdb005 * @tc.name : Use getEntries get the value by mixing the string key * @tc.desc : Off off @@ -237,7 +237,6 @@ export default function DataShareCombinationRdb() { } }) - /* * @tc.number : SUB_DDM_DataShare_ETS_DataShareCombinationRdb0106 * @tc.name : Use getEntries get the value by mixing the string key diff --git a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePredicatesRdb.ets b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePredicatesRdb.ets index 61396e9ea91b27e007fb1198cd084696f58328e3..9e363a4e127aef53771928ba0c6333d55b6c7767 100644 --- a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePredicatesRdb.ets +++ b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePredicatesRdb.ets @@ -1,17 +1,17 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' import dataShare from '@ohos.data.dataShare' @@ -79,7 +79,7 @@ Between.between("age", 18, 19) let NotBetween = new dataSharePredicates.DataSharePredicates(); NotBetween.notBetween("age", 19, 20); let Distinct = new dataSharePredicates.DataSharePredicates(); -Distinct.equalTo("age", 18).distinct("age"); +Distinct.equalTo("age", 18).distinct(); let GroupBy = new dataSharePredicates.DataSharePredicates(); GroupBy.groupBy(["name"]); let IndexedBy = new dataSharePredicates.DataSharePredicates(); @@ -1035,8 +1035,8 @@ export default function DataSharePredicatesRdb() { done(); } }) - - /* + + /* * @tc.number : SUB_DDM_DataShare_ETS_DataSharePredicatesRdb0124 * @tc.name : Use getEntries get the value by mixing the string key * @tc.desc : DataShare Supports Predicates @@ -1079,7 +1079,7 @@ export default function DataSharePredicatesRdb() { try { await pubfun.publicinsert(globalThis.helper, uri, Insert).then((data) => { console.info("TestDataShare going batchInsert = " + data); - IndexedBy.indexedBy(data); + IndexedBy.indexedBy(globalThis.insertdata); }) await pubfun.publicquery(globalThis.helper, uri, IndexedBy, ["*"]).then((data) => { console.info("TestDataShare going query = " + data); diff --git a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePublicfunction_Callback.ets b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePublicfunction_Callback.ets index ff4ee98593fc5da7509d35826181877e3e1e8ea9..d423eac42cd7a53dd238054a24720d6a7af8aeb0 100644 --- a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePublicfunction_Callback.ets +++ b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePublicfunction_Callback.ets @@ -1,20 +1,19 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import file from '@system.file'; +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import file from '@system.file'; import { describe, it, expect } from 'hypium/index' import dataShare from '@ohos.data.dataShare' import dataSharePredicates from '@ohos.data.dataSharePredicates' @@ -24,7 +23,8 @@ import DataShareResultSet from '@ohos.data.DataShareResultSet' function publicinsert(helper, uri, DataShareValuesBucket) { return new Promise(function (resolve, reject) { helper.insert(uri, DataShareValuesBucket, (err, data) => { - console.info("TestDataShare publicinsert Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicinsert Callback=" + JSON.stringify(data)); + globalThis.insertdata = data; if (err) { console.info("test insert err information: " + JSON.stringify(err)); reject(err); @@ -55,7 +55,7 @@ async function publicdelete(helper, uri, DataSharePredicates) { function publicquery(helper, uri, DataSharePredicates, columns) { return new Promise(function (resolve, reject) { helper.query(uri, DataSharePredicates, columns, (err, data) => { - console.info("TestDataShare publicquery Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicquery Callback=" + JSON.stringify(data)); globalThis.ResultSet = data; if (err) { console.info("test query err information: " + JSON.stringify(err)); @@ -71,7 +71,7 @@ function publicquery(helper, uri, DataSharePredicates, columns) { function publicupdate(helper, uri, DataSharePredicates, DataShareValuesBucket) { return new Promise(function (resolve, reject) { helper.update(uri, DataSharePredicates, DataShareValuesBucket, (err, data) => { - console.info("TestDataShare publicupdate Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicupdate Callback=" + JSON.stringify(data)); if (err) { console.info("test update err information: " + JSON.stringify(err)); reject(err); @@ -86,7 +86,7 @@ function publicupdate(helper, uri, DataSharePredicates, DataShareValuesBucket) { function publicbatchInsert(helper, uri, DataShareValuesBucket) { return new Promise(function (resolve, reject) { helper.batchInsert(uri, DataShareValuesBucket, (err, data) => { - console.info("TestDataShare publicbatchInsert Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicbatchInsert Callback=" + JSON.stringify(data)); if (err) { console.info("test batchInsert err information: " + JSON.stringify(err)); reject(err); @@ -101,7 +101,7 @@ function publicbatchInsert(helper, uri, DataShareValuesBucket) { function publicgetType(helper, uri) { return new Promise(function (resolve, reject) { helper.getType(uri, (err, data) => { - console.info("TestDataShare publicgetType Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicgetType Callback=" + JSON.stringify(data)); if (err) { console.info("test getType err information: " + JSON.stringify(err)); reject(err); @@ -116,7 +116,7 @@ function publicgetType(helper, uri) { function publicgetFileTypes(helper, uri, mimeTypeFilter) { return new Promise(function (resolve, reject) { helper.getFileTypes(uri, mimeTypeFilter, (err, data) => { - console.info("TestDataShare publicgetFileTypes Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicgetFileTypes Callback=" + JSON.stringify(data)); if (err) { console.info("test getFileTypes err information: " + JSON.stringify(err)); reject(err); @@ -131,7 +131,7 @@ function publicgetFileTypes(helper, uri, mimeTypeFilter) { function publicnormalizeUri(helper, uri) { return new Promise(function (resolve, reject) { helper.normalizeUri(uri, (err, data) => { - console.info("TestDataShare publicnormalizeUri Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicnormalizeUri Callback=" + JSON.stringify(data)); if (err) { console.info("test normalizeUri err information: " + JSON.stringify(err)); reject(err); @@ -146,7 +146,7 @@ function publicnormalizeUri(helper, uri) { function publicdenormalizeUri(helper, uri) { return new Promise(function (resolve, reject) { helper.denormalizeUri(uri, (err, data) => { - console.info("TestDataShare publicdenormalizeUri Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicdenormalizeUri Callback=" + JSON.stringify(data)); if (err) { console.info("test denormalizeUri err information: " + JSON.stringify(err)); reject(err); @@ -161,7 +161,7 @@ function publicdenormalizeUri(helper, uri) { function publicopenFile(helper, uri, mode) { return new Promise(function (resolve, reject) { helper.denormalizeUri(uri, mode, (err, data) => { - console.info("TestDataShare publicopenFile Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicopenFile Callback=" + JSON.stringify(data)); if (err) { console.info("test openFile err information: " + JSON.stringify(err)); reject(err); diff --git a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePublicfunction_Promise.ets b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePublicfunction_Promise.ets index 0cba17215286696b67508033f047a0509ffc5e85..a5f6785c2ab68db883121cd095a49409dc66b377 100644 --- a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePublicfunction_Promise.ets +++ b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataSharePublicfunction_Promise.ets @@ -1,18 +1,19 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import file from '@system.file'; import { describe, it, expect } from 'hypium/index' import dataShare from '@ohos.data.dataShare' import dataSharePredicates from '@ohos.data.dataSharePredicates' @@ -22,7 +23,8 @@ import DataShareResultSet from '@ohos.data.DataShareResultSet' function publicinsert(helper, uri, DataShareValuesBucket) { return new Promise(function (resolve, reject) { helper.insert(uri, DataShareValuesBucket).then((data) => { - console.info("TestDataShare publicinsert Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicinsert Callback=" + JSON.stringify(data)); + globalThis.insertdata = data; resolve(data); }).catch((err) => { console.info("test insert err information: " + JSON.stringify(err)); @@ -35,7 +37,7 @@ function publicinsert(helper, uri, DataShareValuesBucket) { function publicdelete(helper, uri, DataSharePredicates) { return new Promise(function (resolve, reject) { helper.delete(uri, DataSharePredicates).then((data) => { - console.info("TestDataShare publicdelete Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicdelete Callback=" + JSON.stringify(data)); resolve(data); }).catch((err) => { console.info("test delete err information: " + JSON.stringify(err)); @@ -48,7 +50,7 @@ function publicdelete(helper, uri, DataSharePredicates) { function publicquery(helper, uri, columns, DataSharePredicates) { return new Promise(function (resolve, reject) { helper.query(uri, columns, DataSharePredicates).then((data) => { - console.info("TestDataShare publicquery Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicquery Callback=" + JSON.stringify(data)); globalThis.ResultSet = data; resolve(data); }).catch((err) => { @@ -62,7 +64,7 @@ function publicquery(helper, uri, columns, DataSharePredicates) { function publicupdate(helper, uri, DataShareValuesBucket, DataSharePredicates) { return new Promise(function (resolve, reject) { helper.update(uri, DataShareValuesBucket, DataSharePredicates).then((data) => { - console.info("TestDataShare publicupdate Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicupdate Callback=" + JSON.stringify(data)); resolve(data); }).catch((err) => { console.info("test update err information: " + JSON.stringify(err)); @@ -75,7 +77,7 @@ function publicupdate(helper, uri, DataShareValuesBucket, DataSharePredicates) { function publicbatchInsert(helper, uri, DataShareValuesBucket) { return new Promise(function (resolve, reject) { helper.batchInsert(uri, DataShareValuesBucket).then((data) => { - console.info("TestDataShare publicbatchInsert Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicbatchInsert Callback=" + JSON.stringify(data)); resolve(data); }).catch((err) => { console.info("test batchInsert err information: " + JSON.stringify(err)); @@ -88,7 +90,7 @@ function publicbatchInsert(helper, uri, DataShareValuesBucket) { function publicgetType(helper, uri) { return new Promise(function (resolve, reject) { helper.getType(uri).then((data) => { - console.info("TestDataShare publicgetType Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicgetType Callback=" + JSON.stringify(data)); resolve(data); }).catch((err) => { console.info("test getType err information: " + JSON.stringify(err)); @@ -101,7 +103,7 @@ function publicgetType(helper, uri) { function publicgetFileTypes(helper, uri, mimeTypeFilter) { return new Promise(function (resolve, reject) { helper.getFileTypes(uri, mimeTypeFilter).then((data) => { - console.info("TestDataShare publicgetFileTypes Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicgetFileTypes Callback=" + JSON.stringify(data)); resolve(data); }).catch((err) => { console.info("test getFileTypes err information: " + JSON.stringify(err)); @@ -114,7 +116,7 @@ function publicgetFileTypes(helper, uri, mimeTypeFilter) { function publicnormalizeUri(helper, uri) { return new Promise(function (resolve, reject) { helper.normalizeUri(uri).then((data) => { - console.info("TestDataShare publicnormalizeUri Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicnormalizeUri Callback=" + JSON.stringify(data)); resolve(data); }).catch((err) => { console.info("test normalizeUri err information: " + JSON.stringify(err)); @@ -127,7 +129,7 @@ function publicnormalizeUri(helper, uri) { function publicdenormalizeUri(helper, uri) { return new Promise(function (resolve, reject) { helper.denormalizeUri(uri).then((data) => { - console.info("TestDataShare publicdenormalizeUri Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicdenormalizeUri Callback=" + JSON.stringify(data)); resolve(data); }).catch((err) => { console.info("test denormalizeUri err information: " + JSON.stringify(err)); @@ -140,7 +142,7 @@ function publicdenormalizeUri(helper, uri) { function publicopenFile(helper, uri, mode) { return new Promise(function (resolve, reject) { helper.openFile(uri, mode).then((data) => { - console.info("TestDataShare publicopenFile Callback=" + JSON.stringify(data)); + console.info("[ttt] [TestDataShare] publicopenFile Callback=" + JSON.stringify(data)); resolve(data); }).catch((err) => { console.info("test openFile err information: " + JSON.stringify(err)); diff --git a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareSingleRdb_Callback.ets b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareSingleRdb_Callback.ets index dfccde40363ad92f3e4803422c8eaf3f8386d15e..2d9f966a40f13f8f646629848eddb388623e9557 100644 --- a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareSingleRdb_Callback.ets +++ b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareSingleRdb_Callback.ets @@ -1,17 +1,17 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' import dataShare from '@ohos.data.dataShare' @@ -39,6 +39,7 @@ let UpdateString = { "name": "suns" }; let UpdateBoolean = { "isStudent": false }; let UpdateUint8Array = { "Binary": new Uint8Array([1, 2, 3, 4]) }; let UpdateNull = { "name": "1" }; +globalThis.Uint8 = new Uint8Array([1, 2, 3]); //Predicates let PredicatesNumber = new dataSharePredicates.DataSharePredicates(); @@ -48,7 +49,7 @@ PredicatesString.equalTo("name", "sun"); let PredicatesBoolean = new dataSharePredicates.DataSharePredicates(); PredicatesBoolean.equalTo("isStudent", true); let PredicatesUint8Array = new dataSharePredicates.DataSharePredicates(); -PredicatesUint8Array.equalTo("Binary", new Uint8Array([1, 2, 3])); +PredicatesUint8Array.equalTo("Binary", globalThis.Uint8); let PredicatesNull = new dataSharePredicates.DataSharePredicates(); PredicatesNull.equalTo("name", ""); let PredicatesAll = new dataSharePredicates.DataSharePredicates(); diff --git a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareSingleRdb_Promise.ets b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareSingleRdb_Promise.ets index d3f2b860ae6d2c890f1454d2dd3d991c94891b08..93cbf7510567ca41dceeacd81102f7515683165f 100644 --- a/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareSingleRdb_Promise.ets +++ b/distributeddatamgr/windowStage/dataShareRdbtest/entry/src/main/ets/Test/DataShareSingleRdb_Promise.ets @@ -1,17 +1,17 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' import dataShare from '@ohos.data.dataShare' @@ -39,6 +39,7 @@ let UpdateString = { "name": "suns" }; let UpdateBoolean = { "isStudent": false }; let UpdateUint8Array = { "Binary": new Uint8Array([1, 2, 3, 4]) }; let UpdateNull = { "name": "1" }; +globalThis.Uint8 = new Uint8Array([1, 2, 3]); //Predicates let PredicatesNumber = new dataSharePredicates.DataSharePredicates(); @@ -48,7 +49,7 @@ PredicatesString.equalTo("name", "sun"); let PredicatesBoolean = new dataSharePredicates.DataSharePredicates(); PredicatesBoolean.equalTo("isStudent", true); let PredicatesUint8Array = new dataSharePredicates.DataSharePredicates(); -PredicatesUint8Array.equalTo("Binary", new Uint8Array([1, 2, 3])); +PredicatesUint8Array.equalTo("Binary", globalThis.Uint8); let PredicatesNull = new dataSharePredicates.DataSharePredicates(); PredicatesNull.equalTo("name", ""); let PredicatesAll = new dataSharePredicates.DataSharePredicates(); @@ -103,7 +104,7 @@ export default function DataShareSingleRdb_Promise() { }) /* - * @tc.number : SUB_DDM_DataShare_JS_DataShareInsertRdb0101 + * @tc.number : SUB_DDM_DataShare_ETS_DataShareInsertRdb0101 * @tc.name : Use getEntries get the value by mixing the string key * @tc.desc : Insert number type data in Rdb * @tc.size : MediumTest @@ -917,7 +918,7 @@ export default function DataShareSingleRdb_Promise() { }) /* - * @tc.number : SUB_DDM_DataShare_ETS_DataShareGetFileTypes0101 + * @tc.number : DataShareGetFileTypes0101 * @tc.name : Use getEntries get the value by mixing the string key * @tc.desc : Support GetFileTypes function * @tc.size : MediumTest diff --git a/distributeddatamgr/windowStage/server/rdbService/BUILD.gn b/distributeddatamgr/windowStage/server/rdbService/BUILD.gn index 8c437f27e44d66b09546a020dae1b72c33359e88..7dcd432675f739bf1d2a5de30be44f6b6bede343 100644 --- a/distributeddatamgr/windowStage/server/rdbService/BUILD.gn +++ b/distributeddatamgr/windowStage/server/rdbService/BUILD.gn @@ -22,23 +22,23 @@ ohos_hap("ActsRdbServiceHap") { "${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap" js_build_mode = "debug" deps = [ - ":kvService_js_assets", - ":kvService_resources", + ":rdbService_js_assets", + ":rdbService_resources", ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" } -ohos_app_scope("dataSharekv_app_profile") { +ohos_app_scope("dataSharerdb_app_profile") { app_profile = "AppScope/app.json" sources = [ "AppScope/resources" ] } -ohos_js_assets("kvService_js_assets") { +ohos_js_assets("rdbService_js_assets") { source_dir = "./entry/src/main/ets" } -ohos_resources("kvService_resources") { +ohos_resources("rdbService_resources") { sources = [ "./entry/src/main/resources" ] - deps = [ ":dataSharekv_app_profile" ] + deps = [ ":dataSharerdb_app_profile" ] hap_profile = "./entry/src/main/module.json" } diff --git a/graphic/vkgl/comm.gni b/graphic/vkgl/comm.gni index 8eefc6e19480f21c4eacc6cd53be7f7d884d2cdf..7f48b3cc2a3364af30c3230f89724e31172e2f47 100644 --- a/graphic/vkgl/comm.gni +++ b/graphic/vkgl/comm.gni @@ -22,7 +22,7 @@ common_include = [ "//foundation/graphic/standard/rosen/modules/render_service_client", "//foundation/graphic/standard/interfaces/innerkits/vsync_module", "//foundation/graphic/standard/rosen/include/common", - "//foundation/windowmanager/interfaces/innerkits/wm", + "//foundation/window/window_manager/interfaces/innerkits/wm", "//third_party/VK-GL-CTS", "//third_party/VK-GL-CTS/framework/delibs/debase", "//third_party/VK-GL-CTS/framework/delibs/decpp", @@ -60,7 +60,7 @@ common_depends = [ "//foundation/graphic/standard/rosen/modules/render_service_base:librender_service_base", "//foundation/graphic/standard/rosen/modules/render_service_client:librender_service_client", "//foundation/graphic/standard/rosen/samples/2d_graphics:drawing_sample_rs", - "//foundation/windowmanager/wm:libwm", + "//foundation/window/window_manager/wm:libwm", "//third_party/zlib:libz", "//third_party/VK-GL-CTS/framework/common:libdeqp_tcutil", "//third_party/VK-GL-CTS/framework/delibs/decpp:libdeqp_decpp", @@ -89,10 +89,10 @@ common_depends = [ "//foundation/graphic/standard/rosen/modules/render_service_client:librender_service_client", "//third_party/zlib:libz", - "//foundation/windowmanager/dm:libdm", - "//foundation/windowmanager/dmserver:libdms", - "//foundation/windowmanager/wm:libwm", - "//foundation/windowmanager/wmserver:libwms", + "//foundation/window/window_manager/dm:libdm", + "//foundation/window/window_manager/dmserver:libdms", + "//foundation/window/window_manager/wm:libwm", + "//foundation/window/window_manager/wmserver:libwms", "//third_party/VK-GL-CTS/framework/platform/ohos/rosen_context:rosen_context", ] diff --git a/miscservices/screenlock_js/src/main/js/test/screenlock_service_test.js b/miscservices/screenlock_js/src/main/js/test/screenlock_service_test.js index db7cb8e08c04421973ee53384d2398129ee6d219..c09d7dc31251ce0713a7cdafab8d61961500fa19 100644 --- a/miscservices/screenlock_js/src/main/js/test/screenlock_service_test.js +++ b/miscservices/screenlock_js/src/main/js/test/screenlock_service_test.js @@ -13,21 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import screenLock from '@ohos.app.screenlockability'; +import screenLock from '@ohos.screenLock'; import {describe, expect, it} from 'deccjsunit/index' -const SCREEN_STATE_BEGIN_OFF = 0; -const SCREEN_STATE_END_OFF = 1; -const SCREEN_STATE_BEGIN_ON = 2; -const SCREEN_STATE_END_ON = 3; const INTERACTIVE_STATE_END_SLEEP = 0; -const INTERACTIVE_STATE_BEGIN_WAKEUP = 1; -const INTERACTIVE_STATE_END_WAKEUP = 2; +const INTERACTIVE_STATE_USERID = 2; const INTERACTIVE_STATE_BEGIN_SLEEP = 3; const SLEEP_TIME = 1000; describe('ScreenLockServiceTest', function () { - console.log("-----------------------ScreenlockTest is starting-----------------------"); + console.info("-----------------------ScreenlockTest is starting-----------------------"); function sleep(numberMillis) { var now = new Date(); @@ -48,24 +43,16 @@ describe('ScreenLockServiceTest', function () { it("ScreenLock_Test_0100", 0, async function (done) { console.info("------------------start ScreenLock_Test_0100-------------------"); try { - var isScreenLocked = true; - screenLock.test_setScreenLocked(isScreenLocked, (err, data) => { - console.log("ScreenLock_Test_0100 test_setScreenLocked data is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); screenLock.isScreenLocked((err, data) => { - console.log("ScreenLock_Test_0100 isScreenLocked's status is " + data); + console.info("ScreenLock_Test_0100 isScreenLocked's status is " + data); expect(data == true).assertTrue(); - done(); }); } catch (error) { - console.log("logMessage ScreenLock_Test_0100: error = " + error); + console.info("logMessage ScreenLock_Test_0100: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end ScreenLock_Test_0100-------------------"); + done(); }); /* @@ -77,30 +64,16 @@ describe('ScreenLockServiceTest', function () { it("ScreenLock_Test_0200", 0, async function (done) { console.info("------------------start ScreenLock_Test_0200-------------------"); try { - var isScreenLocked = false; - screenLock.test_setScreenLocked(isScreenLocked, (err, data) => { - console.log("ScreenLock_Test_0200 test_setScreenLocked data is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); screenLock.isScreenLocked((err, data) => { - console.log("ScreenLock_Test_0200 isScreenLocked's status is " + data); + console.info("ScreenLock_Test_0200 isScreenLocked's status is " + data); expect(data == false).assertTrue(); }); - - var resetIsScreenLocked = true; - screenLock.test_setScreenLocked(resetIsScreenLocked, (err, data) => { - console.log("ScreenLock_Test_0200 test_setScreenLocked data is " + data); - expect(data == true).assertTrue(); - done(); - }); } catch (error) { - console.log("logMessage ScreenLock_Test_0200: error = " + error); + console.info("logMessage ScreenLock_Test_0200: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end ScreenLock_Test_0200-------------------"); + done(); }); /* @@ -113,16 +86,15 @@ describe('ScreenLockServiceTest', function () { console.info("------------------start ScreenLock_Test_0300-------------------"); try { screenLock.isSecureMode((err, data) => { - console.log("ScreenLock_Test_0300 isSecureMode's result is " + data); + console.info("ScreenLock_Test_0300 isSecureMode's result is " + data); expect(data == false).assertTrue(); - done(); }); } catch (error) { - console.log("logMessage ScreenLock_Test_0300: error = " + error); + console.info("logMessage ScreenLock_Test_0300: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end ScreenLock_Test_0300-------------------"); + done(); }); /* @@ -134,41 +106,29 @@ describe('ScreenLockServiceTest', function () { it("Screenlock_Test_0400", 0, async function (done) { console.info("------------------start Screenlock_Test_0400-------------------"); try { - var isScreenLocked = true; - screenLock.test_setScreenLocked(isScreenLocked, (err, data) => { - console.log("Screenlock_Test_0400: test_setScreenLocked setting " + data + " result is successfull"); - }); - - sleep(SLEEP_TIME); screenLock.unlockScreen(() => { - console.log("Screenlock_Test_0400: send unlockScreen issue success"); + console.info("Screenlock_Test_0400: send unlockScreen issue success"); }); sleep(SLEEP_TIME); var unlockScreenResult = 0; var eventType = 'unlockScreenResult'; screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.log("Screenlock_Test_0400: sendScreenLockEvent result is " + data); + console.info("Screenlock_Test_0400: sendScreenLockEvent result is " + data); expect(data == true).assertTrue(); }); sleep(SLEEP_TIME); screenLock.isScreenLocked((err, data) => { - console.log("Screenlock_Test_0400: isScreenLocked result is " + data); + console.info("Screenlock_Test_0400: isScreenLocked result is " + data); expect(data == false).assertTrue(); }); - - sleep(SLEEP_TIME); - screenLock.test_setScreenLocked(isScreenLocked, (err, data) => { - console.log("Screenlock_Test_0400: test_setScreenLocked setting " + data + " result is successfull"); - done(); - }); } catch (error) { console.info("Screenlock_Test_1400: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end Screenlock_Test_0400-------------------"); + done(); }); /* @@ -180,36 +140,29 @@ describe('ScreenLockServiceTest', function () { it("Screenlock_Test_0500", 0, async function (done) { console.info("------------------start Screenlock_Test_0500-------------------"); try { - var isScreenLocked = true; - screenLock.test_setScreenLocked(isScreenLocked, (err, data) => { - console.log("Screenlock_Test_0500: test_setScreenLocked setting " + data + " result is successfull"); - }); - - sleep(SLEEP_TIME); screenLock.unlockScreen(() => { - console.log("Screenlock_Test_0500: send unlockScreen issue success"); + console.info("Screenlock_Test_0500: send unlockScreen issue success"); }); sleep(SLEEP_TIME); var unlockScreenResult = 1; var eventType = 'unlockScreenResult'; screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.log("Screenlock_Test_0500: sendScreenLockEvent result is " + data); + console.info("Screenlock_Test_0500: sendScreenLockEvent result is " + data); expect(data == true).assertTrue(); }); sleep(SLEEP_TIME); screenLock.isScreenLocked((err, data) => { - console.log("Screenlock_Test_0500: isScreenLocked result is " + data); + console.info("Screenlock_Test_0500: isScreenLocked result is " + data); expect(data == true).assertTrue(); - done(); }); } catch (error) { console.info("logMessage Screenlock_Test_0500: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end Screenlock_Test_0500-------------------"); + done(); }); /* @@ -224,41 +177,34 @@ describe('ScreenLockServiceTest', function () { console.info("------------------start Screenlock_Test_2100-------------------"); try { screenLock.isScreenLocked((err, data) => { - console.log("Screenlock_Test_2100: isScreenLocked result is " + data); + console.info("Screenlock_Test_2100: isScreenLocked result is " + data); expect(data == true).assertTrue(); }); sleep(SLEEP_TIME); screenLock.unlockScreen(() => { - console.log("Screenlock_Test_2100: send unlockScreen issue success"); + console.info("Screenlock_Test_2100: send unlockScreen issue success"); }); sleep(SLEEP_TIME); var unlockScreenResult = 0; var eventType = 'unlockScreenResult'; screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.log("Screenlock_Test_2100: sendScreenLockEvent result is " + data); + console.info("Screenlock_Test_2100: sendScreenLockEvent result is " + data); expect(data == true).assertTrue(); }); sleep(SLEEP_TIME); screenLock.isScreenLocked((err, data) => { - console.log("Screenlock_Test_2100: isScreenLocked result is " + data); + console.info("Screenlock_Test_2100: isScreenLocked result is " + data); expect(data == false).assertTrue(); }); - - sleep(SLEEP_TIME); - var isScreenLockedValue = true; - screenLock.test_setScreenLocked(isScreenLockedValue, (err, data) => { - console.log("Screenlock_Test_2100: test_setScreenLocked setting " + data + " result is successfull"); - done(); - }); } catch (error) { console.info("Screenlock_Test_2100: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end Screenlock_Test_2100-------------------"); + done(); }); /* @@ -268,33 +214,21 @@ describe('ScreenLockServiceTest', function () { * @tc.level 0 */ it("Screenlock_Test_2200", 0, async function (done) { - console.log("------------------start Screenlock_Test_2200-------------------"); + console.info("------------------start Screenlock_Test_2200-------------------"); try { - var isScreenlockedValue = false; - screenLock.test_setScreenLocked(isScreenlockedValue, (err, data) => { - console.log("Screenlock_Test_2200: test_setScreenLocked is successful,result is " + data); - }); - - sleep(SLEEP_TIME); screenLock.isScreenLocked((err, data) => { - console.log("Screenlock_Test_2200: isScreenLocked is successful, result is " + data); + console.info("Screenlock_Test_2200: isScreenLocked is successful, result is " + data); expect(data == false).assertTrue(); }); - - sleep(SLEEP_TIME); - isScreenlockedValue = true; - screenLock.test_setScreenLocked(isScreenlockedValue, (err, data) => { - console.log("Screenlock_Test_2200: test_setScreenLocked is successful, result is " + data); - done(); - }); } catch (error) { - console.log("logMessage Screenlock_Test_2200: error = " + error); + console.info("logMessage Screenlock_Test_2200: error = " + error); expect(true).assertTrue(); - done(); } - console.log("------------------end ScreenLock_Test_2200-------------------"); + console.info("------------------end ScreenLock_Test_2200-------------------"); + done(); }); + /* * @tc.number Screenlock_Test_2300 * @tc.name After the systemUI is started, it is in the locked state, the lock management sends @@ -328,356 +262,266 @@ describe('ScreenLockServiceTest', function () { screenLock.isScreenLocked((err, data) => { console.log("Screenlock_Test_2300: isScreenLocked result is " + data); expect(data == true).assertTrue(); - done(); }); } catch (error) { console.info("Screenlock_Test_2300: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end Screenlock_Test_2300-------------------"); + done(); }); + /* * @tc.number Screenlock_Test_2400 - * @tc.name Device management causes the screen to go off, and run "beginSleep" operate + * @tc.name Device management causes the screen to go off, and run "beginWakeUp" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_2400", 0, async function (done) { console.log("------------------start Screenlock_Test_2400-------------------"); try { - var eventType = 'beginSleep'; - var reasonForSleep = 1; - screenLock.test_runtimeNotify(eventType, reasonForSleep, (err, data) => { - console.log("Screenlock_Test_2400: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_2400: test_getRuntimeState is successful, result is " + data); - expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue(); - done(); + var eventType = 'beginWakeUp'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2400: test_getRuntimeState beginWakeUp is successful" ); }); } catch (error) { console.log("end Screenlock_Test_2400: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_2400-------------------"); + done(); }); /* * @tc.number Screenlock_Test_2500 - * @tc.name Device management causes the screen to go off, and run "endSleep" operate + * @tc.name Device management causes the screen to go off, and run "endWakeUp" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_2500", 0, async function (done) { console.log("------------------start Screenlock_Test_2500-------------------"); try { - var eventType = 'endSleep'; - var reasonForSleep = 1; - screenLock.test_runtimeNotify(eventType, reasonForSleep, (err, data) => { - console.log("Screenlock_Test_2500: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_2500: test_getRuntimeState is successful, result is " + data); - expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue(); - done(); + var eventType = 'endWakeUp'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2500: test_getRuntimeState endWakeUp is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_2500: error = " + error); + console.log("end Screenlock_Test_2500: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_2500-------------------"); + done(); }); /* * @tc.number Screenlock_Test_2600 - * @tc.name Device management causes the screen to go off, and run "beginScreenOff" operate + * @tc.name Device management causes the screen to go off, and run "beginScreenOn" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_2600", 0, async function (done) { console.log("------------------start Screenlock_Test_2600-------------------"); try { - var eventType = 'beginScreenOff'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_2600: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_2600: test_getRuntimeState is successful, result is " + data); - expect(data == SCREEN_STATE_BEGIN_OFF).assertTrue(); - done(); + var eventType = 'beginScreenOn'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2600: test_getRuntimeState beginScreenOn is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_2600: error = " + error); + console.log("end Screenlock_Test_2600: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_2600-------------------"); + done(); }); /* * @tc.number Screenlock_Test_2700 - * @tc.name Device management causes the screen to go off, and run "endScreenOff" operate + * @tc.name Device management causes the screen to go off, and run "endScreenOn" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_2700", 0, async function (done) { console.log("------------------start Screenlock_Test_2700-------------------"); try { - var eventType = 'endScreenOff'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_2700: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_2700: test_getRuntimeState is successful, result is " + data); - expect(data == SCREEN_STATE_END_OFF).assertTrue(); - done(); + var eventType = 'beginScreenOn'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2700: test_getRuntimeState endScreenOn is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_2700: error = " + error); + console.log("end Screenlock_Test_2700: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_2700-------------------"); + done(); }); /* * @tc.number Screenlock_Test_2800 - * @tc.name User causes the screen to go off, and run "beginSleep" operate + * @tc.name User causes the screen to go off, and run "beginScreenOff" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_2800", 0, async function (done) { console.log("------------------start Screenlock_Test_2800-------------------"); try { - var eventType = 'beginSleep'; - var reasonForSleep = 2; - screenLock.test_runtimeNotify(eventType, reasonForSleep, (err, data) => { - console.log("Screenlock_Test_2800: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_2800: test_getRuntimeState is successful, result is " + data); - expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue(); - done(); + var eventType = 'beginScreenOff'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2800: test_getRuntimeState beginScreenOff is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_2800: error = " + error); + console.log("end Screenlock_Test_2800: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_2800-------------------"); + done(); }); /* * @tc.number Screenlock_Test_2900 - * @tc.name User causes the screen to go off, and run "endSleep" operate + * @tc.name User causes the screen to go off, and run "endScreenOff" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_2900", 0, async function (done) { console.log("------------------start Screenlock_Test_2900-------------------"); try { - var eventType = 'endSleep'; - var reasonForSleep = 2; - screenLock.test_runtimeNotify(eventType, reasonForSleep, (err, data) => { - console.log("Screenlock_Test_2900: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_2900: test_getRuntimeState is successful, result is " + data); - expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue(); - done(); + var eventType = 'endScreenOff'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2900: test_getRuntimeState endScreenOff is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_2900: error = " + error); + console.log("end Screenlock_Test_2900: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_2900-------------------"); + done(); }); /* * @tc.number Screenlock_Test_3000 - * @tc.name User causes the screen to go off, and run "beginScreenOff" operate + * @tc.name User causes the screen to go off, and run "unlockScreen" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_3000", 0, async function (done) { console.log("------------------start Screenlock_Test_3000-------------------"); try { - var eventType = 'beginScreenOff'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_3000: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3000: test_getRuntimeState is successful, result is " + data); - expect(data == SCREEN_STATE_BEGIN_OFF).assertTrue(); - done(); + var eventType = 'unlockScreen'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3000: test_getRuntimeState unlockScreen is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3000: error = " + error); + console.log("end Screenlock_Test_3000: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3000-------------------"); + done(); }); /* * @tc.number Screenlock_Test_3100 - * @tc.name User causes the screen to go off, and run "endScreenOff" operate + * @tc.name User causes the screen to go off, and run "beginExitAnimation" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_3100", 0, async function (done) { console.log("------------------start Screenlock_Test_3100-------------------"); try { - var eventType = 'endScreenOff'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_3100: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3100: test_getRuntimeState is successful, result is " + data); - expect(data == SCREEN_STATE_END_OFF).assertTrue(); - done(); + var eventType = 'beginExitAnimation'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3100: test_getRuntimeState beginExitAnimation is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3100: error = " + error); + console.log("end Screenlock_Test_3100: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3100-------------------"); + done(); }); /* * @tc.number Screenlock_Test_3200 - * @tc.name No operation for a long time causes the screen to go off, and run "beginSleep" operate + * @tc.name No operation for a long time causes the screen to go off, and run "screenlockEnabled" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_3200", 0, async function (done) { console.log("------------------start Screenlock_Test_3200-------------------"); try { - var eventType = 'beginSleep'; - var reasonForSleep = 3; - screenLock.test_runtimeNotify(eventType, reasonForSleep, (err, data) => { - console.log("Screenlock_Test_3200: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3200: test_getRuntimeState is successful, result is " + data); - expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue(); - done(); + var eventType = 'screenlockEnabled'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3200: test_getRuntimeState screenlockEnabled is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3200: error = " + error); + console.log("end Screenlock_Test_3200: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3200-------------------"); + done(); }); /* * @tc.number Screenlock_Test_3300 - * @tc.name No operation for a long time causes the screen to go off, and run "endSleep" operate + * @tc.name No operation for a long time causes the screen to go off, and run "beginSleep" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_3300", 0, async function (done) { console.log("------------------start Screenlock_Test_3300-------------------"); try { - var eventType = 'endSleep'; - var reasonForSleep = 3; - screenLock.test_runtimeNotify(eventType, reasonForSleep, (err, data) => { - console.log("Screenlock_Test_3300: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3300: test_getRuntimeState is successful, result is " + data); - expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue(); - done(); + var eventType = 'beginSleep'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3300: test_getRuntimeState beginSleep is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3300: error = " + error); + console.log("end Screenlock_Test_3300: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3300-------------------"); + done(); }); /* * @tc.number Screenlock_Test_3400 - * @tc.name No operation for a long time causes the screen to go off, and run "beginScreenOff" operate + * @tc.name No operation for a long time causes the screen to go off, and run "endSleep" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_3400", 0, async function (done) { console.log("------------------start Screenlock_Test_3400-------------------"); try { - var eventType = 'beginScreenOff'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_3400: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3400: test_getRuntimeState is successful, result is " + data); - expect(data == SCREEN_STATE_BEGIN_OFF).assertTrue(); - done(); + var eventType = 'endSleep'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3400: test_getRuntimeState endSleep is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3400: error = " + error); + console.log("end Screenlock_Test_3400: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3400-------------------"); + done(); }); /* * @tc.number Screenlock_Test_3500 - * @tc.name No operation for a long time causes the screen to go off, and run "endScreenOff" operate + * @tc.name No operation for a long time causes the screen to go off, and run "changeUser" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_3500", 0, async function (done) { console.log("------------------start Screenlock_Test_3500-------------------"); try { - var eventType = 'endScreenOff'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_3500: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3500: test_getRuntimeState is successful, result is " + data); - expect(data == SCREEN_STATE_END_OFF).assertTrue(); - done(); + var eventType = 'changeUser'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3500: test_getRuntimeState changeUser is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3500: error = " + error); + console.log("end Screenlock_Test_3500: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3500-------------------"); + done(); }); /* @@ -690,22 +534,15 @@ describe('ScreenLockServiceTest', function () { console.log("------------------start Screenlock_Test_3600-------------------"); try { var eventType = 'beginWakeUp'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_3600: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3600: test_getRuntimeState is successful, result is " + data); - expect(data == INTERACTIVE_STATE_BEGIN_WAKEUP).assertTrue(); - done(); + screenLock.on(eventType, () => { + console.log("Screenlock_Test_3600: test_getRuntimeState beginWakeUp is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3600: error = " + error); + console.log("end Screenlock_Test_3600: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3600-------------------"); + done(); }); /* @@ -718,22 +555,15 @@ describe('ScreenLockServiceTest', function () { console.log("------------------logMessage Screenlock_Test_3700-------------------"); try { var eventType = 'endWakeUp'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_3700: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3700: test_getRuntimeState is successful, result is " + data); - expect(data == INTERACTIVE_STATE_END_WAKEUP).assertTrue(); - done(); + screenLock.on(eventType, () => { + console.log("Screenlock_Test_3700: test_getRuntimeState endWakeUp is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3700: error = " + error); + console.log("end Screenlock_Test_3700: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3700-------------------"); + done(); }); /* @@ -746,22 +576,15 @@ describe('ScreenLockServiceTest', function () { console.log("------------------start Screenlock_Test_3800-------------------"); try { var eventType = 'beginScreenOn'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_3800: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3800: test_getRuntimeState is successful, result is " + data); - expect(data == SCREEN_STATE_BEGIN_ON).assertTrue(); - done(); + screenLock.on(eventType, () => { + console.log("Screenlock_Test_3800: test_getRuntimeState beginScreenOn is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3800: error = " + error); + console.log("end Screenlock_Test_3800: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3800-------------------"); + done(); }); /* @@ -774,145 +597,104 @@ describe('ScreenLockServiceTest', function () { console.log("------------------start Screenlock_Test_3900-------------------"); try { var eventType = 'endScreenOn'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_3900: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_3900: test_getRuntimeState is successful, result is " + data); - expect(data == SCREEN_STATE_END_ON).assertTrue(); - done(); + screenLock.on(eventType, () => { + console.log("Screenlock_Test_3900: test_getRuntimeState endScreenOn is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_3900: error = " + error); + console.log("end Screenlock_Test_3900: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_3900-------------------"); + done(); }); /* * @tc.number Screenlock_Test_4000 - * @tc.name Modify the user ID to 2, and the modification is successful + * @tc.name Responding to bright screen events, and run "beginScreenOff" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_4000", 0, async function (done) { console.log("------------------start Screenlock_Test_4000-------------------"); try { - var eventType = 'changeUser'; - var userId = 2; - screenLock.test_runtimeNotify(eventType, userId, (err, data) => { - console.log("Screenlock_Test_4000: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4000: test_getRuntimeState is successful, result is " + data); - expect(data == userId).assertTrue(); - done(); + var eventType = 'beginScreenOff'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_4000: test_getRuntimeState beginScreenOff is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_4000: error = " + error); + console.log("end Screenlock_Test_4000: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_4000-------------------"); + done(); }); /* * @tc.number Screenlock_Test_4100 - * @tc.name Modify the user ID to 0, and the modification is successful + * @tc.name Responding to bright screen events, and run "endScreenOff" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_4100", 0, async function (done) { console.log("------------------logMessage Screenlock_Test_4100-------------------"); try { - var eventType = 'changeUser'; - var userId = 0; - screenLock.test_runtimeNotify(eventType, userId, (err, data) => { - console.log("Screenlock_Test_4100: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4100: test_getRuntimeState is successful, result is " + data); - expect(data == userId).assertTrue(); - done(); + var eventType = 'endScreenOff'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_4100: test_getRuntimeState endScreenOff is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_4100: error = " + error); + console.log("end Screenlock_Test_4100: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_4100-------------------"); + done(); }); /* * @tc.number Screenlock_Test_4200 - * @tc.name Modify the user ID to -3, and the modification is failed + * @tc.name Responding to bright screen events, and run "unlockScreen" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_4200", 0, async function (done) { console.log("------------------start Screenlock_Test_4200-------------------"); try { - var eventType = 'changeUser'; - var userId = -3; - screenLock.test_runtimeNotify(eventType, userId, (err, data) => { - console.log("Screenlock_Test_4200: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - var oldUserId = 0; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4200: test_getRuntimeState is successful, result is " + data); - expect(data == oldUserId).assertTrue(); - done(); + var eventType = 'unlockScreen'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_4200: test_getRuntimeState unlockScreen is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_4200: error = " + error); + console.log("end Screenlock_Test_4200: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_4200-------------------"); + done(); }); /* * @tc.number Screenlock_Test_4300 - * @tc.name Modify the user ID to 99999999999999, and the modification is failed + * @tc.name Responding to bright screen events, and run "beginExitAnimation" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_4300", 0, async function (done) { console.log("------------------start Screenlock_Test_4300-------------------"); try { - var eventType = 'changeUser'; - var userId = 99999999999999; - screenLock.test_runtimeNotify(eventType, userId, (err, data) => { - console.log("Screenlock_Test_4300: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - var oldUserId = 0; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4300: test_getRuntimeState is successful, result is" + data); - expect(data == oldUserId).assertTrue(); - done(); + var eventType = 'beginExitAnimation'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_4300: test_getRuntimeState beginExitAnimation is successful" ); }); } catch (error) { - console.log("logMessage Screenlock_Test_4300: error = " + error); + console.log("end Screenlock_Test_4300: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_4300-------------------"); + done(); }); /* * @tc.number Screenlock_Test_4400 - * @tc.name Modify the user ID to 'abc', and the modification is failed + * @tc.name Responding to bright screen events, and run "beginSleep" operate * @tc.desc Function test * @tc.level 0 */ @@ -920,104 +702,81 @@ describe('ScreenLockServiceTest', function () { console.log("------------------start Screenlock_Test_4400-------------------"); try { var eventType = 'changeUser'; - var userId = 'abc'; - screenLock.test_runtimeNotify(eventType, userId, (err, data) => { - console.log("Screenlock_Test_4400: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); - var oldUserId = 0; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4400: test_getRuntimeState is successful, result is" + data); - expect(data == oldUserId).assertTrue(); - done(); + screenLock.on(eventType, (err, data) => { + console.log("Screenlock_Test_4400: test_getRuntimeState beginSleep is successful"); + expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue(); }); } catch (error) { console.log("logMessage Screenlock_Test_4400: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_4400-------------------"); + done(); }); /* * @tc.number Screenlock_Test_4500 - * @tc.name Settings can lock the screen + * @tc.name Responding to bright screen events, and run "endSleep" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_4500", 0, async function (done) { console.log("------------------start Screenlock_Test_4500-------------------"); try { - var eventType = 'screenlockEnabled'; - var isScreenlockEnabled = 0; - screenLock.test_runtimeNotify(eventType, isScreenlockEnabled, (err, data) => { - console.log("Screenlock_Test_4500: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); + var eventType = 'endSleep'; screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4500: test_getRuntimeState is successful, result is" + data); - expect(data == isScreenlockEnabled).assertTrue(); - done(); + console.log("Screenlock_Test_4500: test_getRuntimeState endSleep is successful"); + expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue(); }); } catch (error) { console.log("logMessage Screenlock_Test_4500: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_4500-------------------"); + done(); }); /* * @tc.number Screenlock_Test_4600 - * @tc.name Setting can not lock screen + * @tc.name Responding to bright screen events, and run "changeUser" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_4600", 0, async function (done) { console.log("------------------start Screenlock_Test_4600-------------------"); try { - var eventType = 'screenlockEnabled'; - var isScreenlockEnabled = 1; - screenLock.test_runtimeNotify(eventType, isScreenlockEnabled, (err, data) => { - console.log("Screenlock_Test_4600: test_runtimeNotify is successful, result is " + data); - }); - - sleep(SLEEP_TIME); + var eventType = 'changeUser'; screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4600: test_getRuntimeState is successful, result is" + data); - expect(data == isScreenlockEnabled).assertTrue(); - done(); + console.log("Screenlock_Test_4600: test_getRuntimeState changeUser is successfuls"); + expect(data == INTERACTIVE_STATE_USERID).assertTrue(); }); } catch (error) { console.log("logMessage Screenlock_Test_4600: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_4600-------------------"); + done(); }); /* * @tc.number Screenlock_Test_4700 - * @tc.name Run 'beginExitAnimation' operate + * @tc.name Responding to bright screen events, and run "screenlockEnabled" operate * @tc.desc Function test * @tc.level 0 */ it("Screenlock_Test_4700", 0, async function (done) { console.log("------------------start Screenlock_Test_4700-------------------"); try { - var eventType = 'beginExitAnimation'; - screenLock.test_runtimeNotify(eventType, -100, (err, data) => { - console.log("Screenlock_Test_4700: test_runtimeNotify is successful, result is " + data); + var eventType = 'screenlockEnabled'; + screenLock.test_getRuntimeState(eventType, (err, data) => { + console.log("Screenlock_Test_4700: test_getRuntimeState screenlockEnabled is successfuls"); expect(data == true).assertTrue(); - done(); }); } catch (error) { console.log("logMessage Screenlock_Test_4700: error = " + error); expect(true).assertTrue(); - done(); } console.log("------------------end Screenlock_Test_4700-------------------"); - }); + done(); + }); }) \ No newline at end of file diff --git a/miscservices/screenlock_js/src/main/js/test/screenlock_service_test_promise.js b/miscservices/screenlock_js/src/main/js/test/screenlock_service_test_promise.js index bc11d63386f12b46f29713d25056b31008dc9101..7f8ad52ce011017023a90ddf3c8f56dcd3482456 100644 --- a/miscservices/screenlock_js/src/main/js/test/screenlock_service_test_promise.js +++ b/miscservices/screenlock_js/src/main/js/test/screenlock_service_test_promise.js @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import screenLock from '@ohos.app.screenlockability'; +import screenLock from '@ohos.screenLock'; import {describe, expect, it} from 'deccjsunit/index' const SLEEP_TIME = 1000; describe('ScreenLockServicePromiseTest', function () { - console.log("-----------------------ScreenlockPromiseTest is starting-----------------------"); + console.info("-----------------------ScreenlockPromiseTest is starting-----------------------"); function sleep(numberMillis) { var now = new Date(); @@ -41,21 +41,16 @@ describe('ScreenLockServicePromiseTest', function () { console.info("------------------start ScreenLock_Test_Promise_0100-------------------"); var isScreenLocked = true; try { - screenLock.test_setScreenLocked(isScreenLocked).then((data) => { - console.log("ScreenLock_Test_Promise_0100 test_setScreenLocked result is " + data); - expect(data == true).assertTrue(); - screenLock.isScreenLocked().then((data) => { - console.log("ScreenLock_Test_Promise_0100 isScreenLocked result is " + data); - expect(data == true).assertTrue(); - done(); - }) + screenLock.isScreenLocked().then((data) => { + console.info("ScreenLock_Test_Promise_0100 isScreenLocked result is " + data); + expect(data == true).assertTrue() }) } catch (error) { - console.log("ScreenLock_Test_Promise_0100 test_setScreenLocked : error = " + error); - expect(true).assertTrue(); - done(); + console.info("ScreenLock_Test_Promise_0100 test_setScreenLocked : error = " + error); + expect(true).assertTrue(); } console.info("------------------end ScreenLock_Test_Promise_0100-------------------"); + done(); }); /* @@ -68,21 +63,16 @@ describe('ScreenLockServicePromiseTest', function () { console.info("------------------start ScreenLock_Test_Promise_0200-------------------"); var isScreenLocked = false; try { - screenLock.test_setScreenLocked(isScreenLocked).then((data) => { - console.log("ScreenLock_Test_Promise_0200 test_setScreenLocked result is " + data); - expect(data == true).assertTrue(); - screenLock.isScreenLocked().then((data) => { - console.log("ScreenLock_Test_Promise_0200 isScreenLocked result is " + data); - expect(data == false).assertTrue(); - done(); - }); + screenLock.isScreenLocked().then((data) => { + console.info("ScreenLock_Test_Promise_0200 isScreenLocked result is " + data); + expect(data == false).assertTrue(); }); } catch (error) { - console.log("ScreenLock_Test_Promise_0200 test_setScreenLocked : error = " + error); + console.info("ScreenLock_Test_Promise_0200 test_setScreenLocked : error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end ScreenLock_Test_Promise_0200-------------------"); + done(); }); /* @@ -95,16 +85,15 @@ describe('ScreenLockServicePromiseTest', function () { console.info("------------------start ScreenLock_Test_Promise_0300-------------------"); try { screenLock.isSecureMode().then((data) => { - console.log("ScreenLock_Test_Promise_0300 isScreenLocked result is " + data); + console.info("ScreenLock_Test_Promise_0300 isScreenLocked result is " + data); expect(data == false).assertTrue(); - done(); }); } catch (error) { - console.log("ScreenLock_Test_Promise_0300 isScreenLocked TRUE: error = " + error); + console.info("ScreenLock_Test_Promise_0300 isScreenLocked TRUE: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end ScreenLock_Test_Promise_0300-------------------"); + done(); }); /* @@ -116,41 +105,27 @@ describe('ScreenLockServicePromiseTest', function () { it("ScreenLock_Test_Promise_0400", 0, async function (done) { console.info("------------------start ScreenLock_Test_Promise_0400-------------------"); try { - var isScreenLocked = true; - screenLock.test_setScreenLocked(isScreenLocked).then((data) => { - console.log("ScreenLock_Test_Promise_0400: test_setScreenLocked1 " + data + " result is successfull"); - }); - - sleep(SLEEP_TIME); screenLock.unlockScreen().then(() => { - console.log("ScreenLock_Test_Promise_0400: send unlockScreen issue success"); + console.info("ScreenLock_Test_Promise_0400: send unlockScreen issue success"); }); - sleep(SLEEP_TIME); var unlockScreenResult = 0; var eventType = 'unlockScreenResult'; screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => { - console.log("ScreenLock_Test_Promise_0400: sendScreenLockEvent result is " + data); + console.info("ScreenLock_Test_Promise_0400: sendScreenLockEvent result is " + data); expect(data == true).assertTrue(); }); - sleep(SLEEP_TIME); screenLock.isScreenLocked().then((data) => { - console.log("ScreenLock_Test_Promise_0400: isScreenLocked result is " + data); + console.info("ScreenLock_Test_Promise_0400: isScreenLocked result is " + data); expect(data == false).assertTrue(); }); - - sleep(SLEEP_TIME); - screenLock.test_setScreenLocked(isScreenLocked).then((data) => { - console.log("ScreenLock_Test_Promise_0400: test_setScreenLocked2 " + data + " result is successfull"); - done(); - }); } catch (error) { console.info("Screenlock_Test_1400: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end ScreenLock_Test_Promise_0400-------------------"); + done(); }); /* @@ -162,36 +137,30 @@ describe('ScreenLockServicePromiseTest', function () { it("ScreenLock_Test_Promise_0500", 0, async function (done) { console.info("------------------start ScreenLock_Test_Promise_0500-------------------"); try { - var isScreenLocked = true; - screenLock.test_setScreenLocked(isScreenLocked).then((data) => { - console.log("ScreenLock_Test_Promise_0500: test_setScreenLocked " + data + " result is successfull"); - }); - - sleep(SLEEP_TIME); screenLock.unlockScreen().then(() => { - console.log("ScreenLock_Test_Promise_0500: send unlockScreen issue success"); + console.info("ScreenLock_Test_Promise_0500: send unlockScreen issue success"); }); sleep(SLEEP_TIME); var unlockScreenResult = 1; var eventType = 'unlockScreenResult'; screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => { - console.log("ScreenLock_Test_Promise_0500: sendScreenLockEvent result is " + data); + console.info("ScreenLock_Test_Promise_0500: sendScreenLockEvent result is " + data); expect(data == true).assertTrue(); }); sleep(SLEEP_TIME); screenLock.isScreenLocked().then((data) => { - console.log("ScreenLock_Test_Promise_0500: isScreenLocked result is " + data); + console.info("ScreenLock_Test_Promise_0500: isScreenLocked result is " + data); expect(data == true).assertTrue(); done(); }); } catch (error) { console.info("logMessage ScreenLock_Test_Promise_0500: error = " + error); expect(true).assertTrue(); - done(); } console.info("------------------end ScreenLock_Test_Promise_0500-------------------"); + done(); }); }) \ No newline at end of file diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index e1d88fe4d64038e84052234b4b742f01400a9d31..784c956cb354f54105e799b6603055b51b53cf24 100644 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -31,9 +31,9 @@ group("multimedia") { "media/media_js_standard/audioPlayer:audio_player_js_hap", "media/media_js_standard/audioRecorder:audio_recorder_js_hap", "media/media_js_standard/recorderFormat:recorder_format_js_hap", + "media/media_js_standard/recorderProfile:recorder_profile_js_hap", "media/media_js_standard/videoPlayer:video_player_js_hap", - - #"medialibrary/mediaLibrary_js_standard:mediaLibrary_js_hap", + "medialibrary/mediaLibrary_js_standard:mediaLibrary_js_hap", ] } else { deps = [ diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js b/multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js index c6836665b6f3dd6a92af906a2d8cfe5b34ec179f..7c58349630dbc7b6262cfdbf5629ac4a02b71003 100644 --- a/multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js @@ -17,7 +17,7 @@ import image from '@ohos.multimedia.image' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { testPng } from '../../../../../image/src/main/js/test/testImg' -describe('Image', function () { +describe('AddImage', function () { beforeAll(async function () { console.info('beforeAll case'); diff --git a/multimedia/media/media_js_standard/recorderProfile/BUILD.gn b/multimedia/media/media_js_standard/recorderProfile/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8583743ca67c5cc6d6eb7c27d3c0f7b73a6db2ef --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("recorder_profile_js_hap") { + hap_profile = "./src/main/config.json" + js2abc = true + deps = [ + ":profile_js_assets", + ":profile_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsRecorderProfileJsTest" +} +ohos_js_assets("profile_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("profile_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/media/media_js_standard/recorderProfile/Test.json b/multimedia/media/media_js_standard/recorderProfile/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..6624ef255cc873ce11f4763f62ea5c9e556d42ba --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for profile Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "2000000", + "package": "ohos.acts.multimedia.recorder.profile", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsRecorderProfileJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b b/multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..02772ce36b607a459e0e124b0240997e7e0c5523 Binary files /dev/null and b/multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b differ diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/config.json b/multimedia/media/media_js_standard/recorderProfile/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..9762efe9aab05ea71459ba37a87425326cc2ccc9 --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/config.json @@ -0,0 +1,96 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.recorder.profile", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.recorder.profile.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "phone", + "tablet", + "tv", + "wearable" + ], + "reqPermissions": [ + { + "name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", + "reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS" + }, + { + "name" : "ohos.permission.MEDIA_LOCATION", + "reason" : "use ohos.permission.MEDIA_LOCATION" + }, + { + "name" : "ohos.permission.READ_MEDIA", + "reason" : "use ohos.permission.READ_MEDIA" + }, + { + "name" : "ohos.permission.WRITE_MEDIA", + "reason" : "use ohos.permission.WRITE_MEDIA" + } + ], + "mainAbility": "ohos.acts.multimedia.recorder.profile.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.multimedia.recorder.profile", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/app.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..830070d196d86b127cea947d168bfd116f446205 --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/en-US.json b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/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/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/zh-CN.json b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.css b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..c9195944a956c0d5628c701b7a3d9d2ed525cd2d --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.css @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.hml b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..8d0e2061b88c99c91488405f0f2ead0c77de1a9e --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..67f8b8567ccc4932331b7a18a6b947340d84fb40 --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6492bb6b7a46537d14cd12d20ec8f548e147f17d --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +require('./ProfileTestCallback.test.js') +require('./ProfileTestPromise.test.js') +require('./ProfileAbnormalTestCallback.test.js') +require('./ProfileAbnormalTestPromise.test.js') \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f6773a65f5d755e85e73e32e40d52b0c800aafd8 --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js @@ -0,0 +1,344 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import media from '@ohos.multimedia.media' +import * as base from './ProfileTestBase.js'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ProfileAbnormalTestCallback', function () { + beforeAll(function () { + console.info('beforeAll case'); + }) + + beforeEach(async function () { + console.info('beforeEach case'); + }) + + afterEach(function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + + + async function callbackAbnormalGetVideoProfile(sourceId, qualityLevel, done){ + media.getMediaCapability((err, mediaCaps) => { + expect(err).assertUndefined(); + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel, (err, videoCapsArray) => { + expect(err).assertUndefined(); + base.checkVideoCapsArray(videoCapsArray); + console.info('getVideoRecorderProfile success'); + done(); + }) + } else { + console.info('mediaCaps is not defined'); + expect().assertFail(); + done(); + } + }) + } + + + async function callbackAbnormalAudioRecoderConfigSupported(audioProfile, done) { + media.getMediaCapability((err, mediaCaps) => { + expect(err).assertUndefined(); + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.isAudioRecoderConfigSupported(audioProfile, (err, ean) => { + expect(err).assertUndefined(); + expect(ean).assertEqual(false); + console.info('isAudioRecoderConfigSupported: success'); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }) + } + + async function callbackAbnormalHasVideoProfile(sourceId, qualityLevel, done) { + media.getMediaCapability((err, mediaCaps) => { + expect(err).assertUndefined(); + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel, (err, ean) => { + expect(err).assertUndefined(); + expect(ean).assertEqual(false); + console.info('hasVideoRecorderProfile success'); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }) + } + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0100 + * @tc.name : test isAudioRecoderConfigSupported false + * @tc.desc : 5 args all set wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0100', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalAll, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0200 + * @tc.name : test isAudioRecoderConfigSupported false + * @tc.desc : FormatType is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0200', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalFormatType, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0300 + * @tc.name : test isAudioRecoderConfigSupported fasle + * @tc.desc : CodecMimeType is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0300', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalCodecMimeType, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0400 + * @tc.name : test isAudioRecoderConfigSupported false + * @tc.desc : bitrate is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0400', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalBitrate, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0500 + * @tc.name : test isAudioRecoderConfigSupported false + * @tc.desc : sampleRate is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0500', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleRate, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0600 + * @tc.name : test isAudioRecoderConfigSupported false + * @tc.desc : channel is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0600', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleChannel, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0700 + * @tc.name : test hasVideoRecorderProfile + * @tc.desc : sourceId 1 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0700', 0, async function (done) { + console.info('test hasVideoRecorderProfile'); + callbackAbnormalHasVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0800 + * @tc.name : test hasVideoRecorderProfile sourceId -1 + * @tc.desc : sourceId -1 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0800', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + callbackAbnormalHasVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0900 + * @tc.name : test hasVideoRecorderProfile qualityLevel -1 + * @tc.desc : sourceId 0 qualityLevel -1 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_0900', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + callbackAbnormalHasVideoProfile(0, -1, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1000 + * @tc.name : test hasVideoRecorderProfile sourceId 65536 + * @tc.desc : sourceId 65535 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1000', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + callbackAbnormalHasVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1100 + * @tc.name : test hasVideoRecorderProfile sourceId 65536 + * @tc.desc : sourceId 65536 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1100', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + callbackAbnormalHasVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1200 + * @tc.name : test hasVideoRecorderProfile qualityLevel 65536 + * @tc.desc : sourceId 0 qualityLevel 65535 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1200', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + callbackAbnormalHasVideoProfile(0, 65535, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1300 + * @tc.name : test hasVideoRecorderProfile qualityLevel 65536 + * @tc.desc : sourceId 0 qualityLevel 65536 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1300', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + callbackAbnormalHasVideoProfile(0, 65536, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1400 + * @tc.name : test getVideoRecorderProfile sourceId -1 + * @tc.desc : sourceId -1 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1400', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + callbackAbnormalGetVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1500 + * @tc.name : test getVideoRecorderProfile qualityLevel -1 + * @tc.desc : sourceId 0 qualityLevel -1 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1500', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + callbackAbnormalGetVideoProfile(0, -1, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1600 + * @tc.name : test getVideoRecorderProfile sourceId 65535 + * @tc.desc : sourceId 65535 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1600', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + callbackAbnormalGetVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1700 + * @tc.name : test getVideoRecorderProfile sourceId 65536 + * @tc.desc : sourceId 65536 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1700', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + callbackAbnormalGetVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1800 + * @tc.name : test getVideoRecorderProfile qualityLevel 65535 + * @tc.desc : sourceId 0 qualityLevel 65535 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1800', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + callbackAbnormalGetVideoProfile(0, 65535, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1900 + * @tc.name : test getVideoRecorderProfile qualityLevel 65536 + * @tc.desc : sourceId 0 qualityLevel 65536 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_CALLBACK_1900', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + callbackAbnormalGetVideoProfile(0, 65536, done); + }) +}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestPromise.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestPromise.test.js new file mode 100644 index 0000000000000000000000000000000000000000..af8173dfdeab2e7d19210a03fc606e68f338b5af --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestPromise.test.js @@ -0,0 +1,353 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * Distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * Limitations under the License. + */ + +import media from '@ohos.multimedia.media' +import * as base from './ProfileTestBase.js'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ProfileAbnormalTestPromise', function () { + beforeAll(function () { + console.info('beforeAll case'); + }) + + beforeEach(async function () { + console.info('beforeEach case'); + }) + + afterEach(function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + async function promiseAbnormalGetVideoProfile(sourceId, qualityLevel, done) { + media.getMediaCapability().then(async (mediaCaps) => { + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel).then(async (videoCapsArray) => { + base.checkVideoCapsArray(videoCapsArray); + console.info('getVideoRecorderProfile success'); + done(); + }, err => { + expect(err).assertUndefined(); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } + + async function promiseAbnormalAudioRecoderConfigSupported(audioProfile, done) { + media.getMediaCapability().then(async (mediaCaps) => { + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.isAudioRecoderConfigSupported(audioProfile).then(async (ean) => { + console.info('isAudioRecoderConfigSupported: success' + ean); + expect(ean).assertEqual(false); + console.info('isAudioRecoderConfigSupported: success'); + done(); + }, err => { + expect(err).assertUndefined(); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } + + async function promiseAbnormalHasVideoProfile(sourceId, qualityLevel, done) { + media.getMediaCapability().then(async (mediaCaps) => { + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel).then(async (ean) => { + expect(ean).assertEqual(false); + console.info('hasVideoRecorderProfile success'); + done(); + }, err => { + expect(err).assertUndefined(); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } + + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0100 + * @tc.name : test isAudioRecoderConfigSupported false + * @tc.desc : 5 args all set wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0100', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalAll, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0200 + * @tc.name : test isAudioRecoderConfigSupported false + * @tc.desc : FormatType is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0200', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalFormatType, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0300 + * @tc.name : test isAudioRecoderConfigSupported + * @tc.desc : CodecMimeType is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0300', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalCodecMimeType, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0400 + * @tc.name : test isAudioRecoderConfigSupported + * @tc.desc : bitrate is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0400', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalBitrate, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0500 + * @tc.name : test isAudioRecoderConfigSupported + * @tc.desc : sampleRate is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0500', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleRate, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0600 + * @tc.name : test isAudioRecoderConfigSupported + * @tc.desc : channel is wrong + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0600', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleChannel, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0700 + * @tc.name : test hasVideoRecorderProfile + * @tc.desc : sourceId 1 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0700', 0, async function (done) { + console.info('test hasVideoRecorderProfile'); + promiseAbnormalHasVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0800 + * @tc.name : test hasVideoRecorderProfile sourceId -1 + * @tc.desc : sourceId -1 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0800', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + promiseAbnormalHasVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_0900 + * @tc.name : test hasVideoRecorderProfile qualityLevel -1 + * @tc.desc : sourceId 0 qualityLevel -1 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_0900', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + promiseAbnormalHasVideoProfile(0, -1, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1000 + * @tc.name : test hasVideoRecorderProfile sourceId 65536 + * @tc.desc : sourceId 65535 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1000', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + promiseAbnormalHasVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1100 + * @tc.name : test hasVideoRecorderProfile sourceId 65536 + * @tc.desc : sourceId 65536 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1100', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + promiseAbnormalHasVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1200 + * @tc.name : test hasVideoRecorderProfile qualityLevel 65536 + * @tc.desc : sourceId 0 qualityLevel 65535 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1200', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + promiseAbnormalHasVideoProfile(0, 65535, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1300 + * @tc.name : test hasVideoRecorderProfile qualityLevel 65536 + * @tc.desc : sourceId 0 qualityLevel 65536 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1300', 0, async function (done) { + console.info("test hasVideoRecorderProfile"); + promiseAbnormalHasVideoProfile(0, 65536, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1400 + * @tc.name : test getVideoRecorderProfile sourceId -1 + * @tc.desc : sourceId -1 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1400', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + promiseAbnormalGetVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1500 + * @tc.name : test getVideoRecorderProfile qualityLevel -1 + * @tc.desc : sourceId 0 qualityLevel -1 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1500', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + promiseAbnormalGetVideoProfile(0, -1, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1600 + * @tc.name : test getVideoRecorderProfile sourceId 65535 + * @tc.desc : sourceId 65535 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1600', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + promiseAbnormalGetVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1700 + * @tc.name : test getVideoRecorderProfile sourceId 65536 + * @tc.desc : sourceId 65536 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1700', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + promiseAbnormalGetVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1800 + * @tc.name : test getVideoRecorderProfile qualityLevel 65535 + * @tc.desc : sourceId 0 qualityLevel 65535 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1800', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + promiseAbnormalGetVideoProfile(0, 65535, done); + }) + + /* * + * @tc.number : SUB_PROFILE_ABNORMAL_PROMISE_1900 + * @tc.name : test getVideoRecorderProfile qualityLevel 65536 + * @tc.desc : sourceId 0 qualityLevel 65536 + * @tc.size : MediumTest + * @tc.type : Abnormal test + * @tc.level : Level2 + */ + it('SUB_PROFILE_ABNORMAL_PROMISE_1900', 0, async function (done) { + console.info("test getVideoRecorderProfile"); + promiseAbnormalGetVideoProfile(0, 65536, done); + }) +}) diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestBase.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestBase.js new file mode 100644 index 0000000000000000000000000000000000000000..497819610311bbf538dfda8847ffb33ec199a362 --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestBase.js @@ -0,0 +1,330 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * Distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * Limitations under the License. + */ + +import media from '@ohos.multimedia.media' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +const audioRecorderCaps = { + outputFormat: media.ContainerFormatType.CFT_MPEG_4A, + audioEncoderMime: media.CodecMimeType.AUDIO_AAC, + sampleRates: [8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000], + bitrateRange: { min: 1, max: 384000 }, + channelRange: { min: 1, max: 2 }, +} +const audioRecorderCapsArray = [audioRecorderCaps]; + +const videoRecorderCaps = { + audioRecorderCaps, + outputFormat: media.ContainerFormatType.CFT_MPEG_4, + videoEncoderMime: media.CodecMimeType.VIDEO_MPEG4, + videoWidthRange: { min: 2, max: 1920 }, + videoBitrateRange: { min: 1, max: 3000000 }, + videoFramerateRange: { min: 1, max: 30 }, + videoHeightRange: { min: 2, max: 1080 }, +} +const videoRecorderCaps2 = { + audioRecorderCaps, + outputFormat: media.ContainerFormatType.CFT_MPEG_4, + videoEncoderMime: media.CodecMimeType.VIDEO_AVC, + videoWidthRange: { min: 2, max: 1920 }, + videoBitrateRange: { min: 1, max: 3000000 }, + videoFramerateRange: { min: 1, max: 30 }, + videoHeightRange: { min: 2, max: 1080 }, +} +const videoRecorderCapsArray = [videoRecorderCaps, videoRecorderCaps2]; + +export const recorderQualityLowPara = { + audioBitrate: 96000, + audioChannels: 2, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: 48000, + durationTime: 30, + fileFormat: media.ContainerFormatType.CFT_MPEG_4, + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, + videoBitrate: 192000, + videoCodec: media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth: 176, + videoFrameHeight: 144, + videoFrameRate: 30 +}; + +export const recorderQualityHighPara = { + audioBitrate: 192000, + audioChannels: 2, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: 48000, + durationTime: 30, + fileFormat: media.ContainerFormatType.CFT_MPEG_4, + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH, + videoBitrate: 17000000, + videoCodec: media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth: 1920, + videoFrameHeight: 1080, + videoFrameRate: 30 +}; + +export const recorderQualityQcifPara = { + audioBitrate: 96000, + audioChannels: 2, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: 48000, + durationTime: 30, + fileFormat: media.ContainerFormatType.CFT_MPEG_4, + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF, + videoBitrate: 192000, + videoCodec: media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth: 176, + videoFrameHeight: 144, + videoFrameRate: 30 +}; + +export const recorderQualityCifPara = { + audioBitrate: 96000, + audioChannels: 2, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: 48000, + durationTime: 30, + fileFormat: media.ContainerFormatType.CFT_MPEG_4, + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF, + videoBitrate: 1536000, + videoCodec: media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth: 352, + videoFrameHeight: 288, + videoFrameRate: 30 +}; + +export const recorderQuality480PPara = { + audioBitrate: 96000, + audioChannels: 2, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: 48000, + durationTime: 30, + fileFormat: media.ContainerFormatType.CFT_MPEG_4, + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P, + videoBitrate: 5000000, + videoCodec: media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth: 640, + videoFrameHeight: 480, + videoFrameRate: 30 +}; + +export const recorderQuality720PPara = { + audioBitrate: 192000, + audioChannels: 2, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: 48000, + durationTime: 30, + fileFormat: media.ContainerFormatType.CFT_MPEG_4, + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P, + videoBitrate: 12000000, + videoCodec: media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth: 1280, + videoFrameHeight: 720, + videoFrameRate: 30 +}; + +export const recorderQuality1080PPara = { + audioBitrate: 192000, + audioChannels: 2, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: 48000, + durationTime: 30, + fileFormat: media.ContainerFormatType.CFT_MPEG_4, + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P, + videoBitrate: 17000000, + videoCodec: media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth: 1920, + videoFrameHeight: 1080, + videoFrameRate: 30 +}; + +export const recorderQualityQvgaPara = { + audioBitrate: 96000, + audioChannels: 2, + audioCodec: media.CodecMimeType.AUDIO_AAC, + audioSampleRate: 48000, + durationTime: 30, + fileFormat: media.ContainerFormatType.CFT_MPEG_4, + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA, + videoBitrate: 1200000, + videoCodec: media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth: 320, + videoFrameHeight: 240, + videoFrameRate: 30 +}; + +export const recorderQualityLowParaSourceId1 = { + audioBitrate: 0, + audioChannels: 0, + audioCodec: '', + audioSampleRate: 0, + durationTime: 0, + fileFormat: '', + qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, + videoBitrate: 0, + videoCodec: '', + videoFrameWidth: 0, + videoFrameHeight: 0, + videoFrameRate: 0 +}; + +export const audioRecorderPara1 = { + outputFormat: media.ContainerFormatType.CFT_MPEG_4, + audioEncoderMime: media.CodecMimeType.AUDIO_AAC, + bitrate: 96000, + sampleRate: 48000, + channel: 2 +}; + +export const audioRecorderPara2 = { + outputFormat: media.ContainerFormatType.CFT_MPEG_4, + audioEncoderMime: media.CodecMimeType.AUDIO_AAC, + bitrate: 192000, + sampleRate: 48000, + channel: 2 +}; + +export const audioRecorderAbnormalAll = { + outputFormat: 'aaa', + audioEncoderMime: 'aaa', + bitrate: 655360, + sampleRate: 655360, + channel: 0 +}; + +export const audioRecorderAbnormalFormatType = { + outputFormat: 'aaa', + audioEncoderMime: media.CodecMimeType.AUDIO_AAC, + bitrate: 96000, + sampleRate: 48000, + channel: 2 +}; + +export const audioRecorderAbnormalCodecMimeType = { + outputFormat: media.ContainerFormatType.CFT_MPEG_4, + audioEncoderMime: 'aaa', + bitrate: 96000, + sampleRate: 48000, + channel: 2 +}; + +export const audioRecorderAbnormalBitrate = { + outputFormat: media.ContainerFormatType.CFT_MPEG_4, + audioEncoderMime: media.CodecMimeType.AUDIO_AAC, + bitrate: 655360, + sampleRate: 48000, + channel: 2 +}; + +export const audioRecorderAbnormalSampleRate = { + outputFormat: media.ContainerFormatType.CFT_MPEG_4, + audioEncoderMime: media.CodecMimeType.AUDIO_AAC, + bitrate: 96000, + sampleRate: 655360, + channel: 2 +}; + +export const audioRecorderAbnormalSampleChannel = { + outputFormat: media.ContainerFormatType.CFT_MPEG_4, + audioEncoderMime: media.CodecMimeType.AUDIO_AAC, + bitrate: 96000, + sampleRate: 4800, + channel: 0 +}; + +export function checkVideoCapsArray(videoCapsArray) { + let expectProfile = { + audioBitrate: 0, + audioChannels: 0, + audioCodec:'', + audioSampleRate: 0, + durationTime: 0, + fileFormat: '', + qualityLevel: 0, + videoBitrate: 0, + videoCodec: '', + videoFrameWidth: 0, + videoFrameHeight: 0, + videoFrameRate: 0, + }; + expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length); + let keys = Object.keys(videoCapsArray); + if (keys.length != 0) { + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; + expect(videoCapsArray[key]).assertEqual(expectProfile[key]); + console.info('check videoCapsArray success'); + } + } else { + console.info('check videoCapsArray failed'); + } +} + +export function checkAudioArray(audioCapsArray, done) { + expect(audioCapsArray.length).assertEqual(audioRecorderCapsArray.length); + for (let i = 0; i < audioCapsArray.length; i++) { + expect(audioCapsArray[i].outputFormat).assertEqual(audioRecorderCapsArray[i].outputFormat); + expect(audioCapsArray[i].audioEncoderMime).assertEqual(audioRecorderCapsArray[i].audioEncoderMime); + for (let j = 0; j < audioCapsArray[i].sampleRates.length; j++) { + expect(audioCapsArray[i].sampleRates[j]).assertEqual(audioRecorderCapsArray[i].sampleRates[j]); + } + expect(audioCapsArray[i].bitrateRange.min).assertEqual(audioRecorderCapsArray[i].bitrateRange.min); + expect(audioCapsArray[i].bitrateRange.max).assertEqual(audioRecorderCapsArray[i].bitrateRange.max); + expect(audioCapsArray[i].channelRange.min).assertEqual(audioRecorderCapsArray[i].channelRange.min); + expect(audioCapsArray[i].channelRange.max).assertEqual(audioRecorderCapsArray[i].channelRange.max); + } + done(); +} + +export function checkVideoArray(videoCapsArray, done) { + expect(videoCapsArray.length).assertEqual(videoRecorderCapsArray.length); + for (let i = 0; i < videoCapsArray.length; i++) { + expect(videoCapsArray[i].audioEncoderMime).assertEqual + (videoRecorderCapsArray[i].audioRecorderCaps.audioEncoderMime); + for (let j = 0; j < videoCapsArray[i].audioSampleRates.length; j++) { + expect(videoCapsArray[i].audioSampleRates[j]).assertEqual + (videoRecorderCapsArray[i].audioRecorderCaps.sampleRates[j]); + } + expect(videoCapsArray[i].audioBitrateRange.min).assertEqual + (videoRecorderCapsArray[i].audioRecorderCaps.bitrateRange.min); + expect(videoCapsArray[i].audioBitrateRange.max).assertEqual + (videoRecorderCapsArray[i].audioRecorderCaps.bitrateRange.max); + expect(videoCapsArray[i].audioChannelRange.min).assertEqual + (videoRecorderCapsArray[i].audioRecorderCaps.channelRange.min); + expect(videoCapsArray[i].audioChannelRange.max).assertEqual + (videoRecorderCapsArray[i].audioRecorderCaps.channelRange.max); + expect(videoCapsArray[i].outputFormat).assertEqual + (videoRecorderCapsArray[i].outputFormat); + expect(videoCapsArray[i].videoWidthRange.min).assertEqual + (videoRecorderCapsArray[i].videoWidthRange.min); + expect(videoCapsArray[i].videoWidthRange.max).assertEqual + (videoRecorderCapsArray[i].videoWidthRange.max); + expect(videoCapsArray[i].videoBitrateRange.min).assertEqual + (videoRecorderCapsArray[i].videoBitrateRange.min); + expect(videoCapsArray[i].videoBitrateRange.max).assertEqual + (videoRecorderCapsArray[i].videoBitrateRange.max); + expect(videoCapsArray[i].videoFramerateRange.min).assertEqual + (videoRecorderCapsArray[i].videoFramerateRange.min); + expect(videoCapsArray[i].videoFramerateRange.max).assertEqual + (videoRecorderCapsArray[i].videoFramerateRange.max); + expect(videoCapsArray[i].videoHeightRange.min).assertEqual + (videoRecorderCapsArray[i].videoHeightRange.min); + expect(videoCapsArray[i].videoHeightRange.max).assertEqual + (videoRecorderCapsArray[i].videoHeightRange.max); + expect(videoCapsArray[i].videoEncoderMime).assertEqual + (videoRecorderCapsArray[i].videoEncoderMime); + } + done(); +} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestCallback.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestCallback.test.js new file mode 100644 index 0000000000000000000000000000000000000000..1389817d478b7b7dac77291fb374cc35ce60c75f --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestCallback.test.js @@ -0,0 +1,341 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import media from '@ohos.multimedia.media' +import * as base from './ProfileTestBase.js'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ProfileTestCallback', function () { + beforeAll(function () { + console.info('beforeAll case'); + }) + + beforeEach(async function () { + console.info('beforeEach case'); + }) + + afterEach(function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + async function getAudioRecorderCapsTest(done) { + media.getMediaCapability((err, mediaCaps) => { + expect(err).assertUndefined(); + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.getAudioRecorderCaps((err, audioCapsArray) => { + expect(err).assertUndefined(); + console.info('getAudioRecorderCaps success'); + if (typeof (audioCapsArray) != 'undefined') { + base.checkAudioArray(audioCapsArray, done); + } else { + console.info('audioCaps is not defined'); + expect().assertFail(); + done(); + } + + }) + } else { + console.info('mediaCaps is not defined'); + expect().assertFail(); + done(); + } + }) + } + + async function getVideoRecorderCapsTest(done) { + media.getMediaCapability((err, mediaCaps) => { + expect(err).assertUndefined(); + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.getVideoRecorderCaps((err, videoCapsArray) => { + expect(err).assertUndefined(); + console.info('getVideoRecorderCapsTest success'); + if (typeof (videoCapsArray) != 'undefined') { + base.checkVideoArray(videoCapsArray, done); + } else { + console.info('videoCaps is not defined'); + expect().assertFail(); + done(); + } + }) + } else { + console.info('mediaCaps is not defined'); + expect().assertFail(); + done(); + } + }) + } + + async function callbackGetVideoProfile(sourceId, qualityLevel, expectProfile, done) { + media.getMediaCapability((err, mediaCaps) => { + expect(err).assertUndefined(); + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel, (err, videoCapsArray) => { + expect(err).assertUndefined(); + console.info('getVideoRecorderProfile success'); + expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length); + let keys = Object.keys(videoCapsArray); + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; + expect(videoCapsArray[key]).assertEqual(expectProfile[key]); + } + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }) + } + + async function callbackAudioRecoderConfigSupported(audioProfile, done) { + media.getMediaCapability((err, mediaCaps) => { + expect(err).assertUndefined(); + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.isAudioRecoderConfigSupported(audioProfile, (err, ean) => { + expect(err).assertUndefined(); + expect(ean).assertEqual(true); + console.info('isAudioRecoderConfigSupported: success'); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }) + } + + async function callbackHasVideoProfile(sourceId, qualityLevel, done) { + media.getMediaCapability((err, mediaCaps) => { + expect(err).assertUndefined(); + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel, (err, ean) => { + expect(err).assertUndefined(); + expect(ean).assertEqual(true); + console.info('hasVideoRecorderProfile success'); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }) + } + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0100 + * @tc.name : test getAudioRecorderCaps + * @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0100', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + getAudioRecorderCapsTest(done); + console.info("test getAudioRecorderCaps success "); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0200 + * @tc.name : test getVideoRecorderCapsTest + * @tc.desc : outputFormat/audioEncoderMime/audioSampleRates/videoEncoderMime/audioBitrateRange/ + audioChannelRange/videoBitrateRange/videoFramerateRange/videoWidthRange/videoHeightRange + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0200', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + getVideoRecorderCapsTest(done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0300 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0300', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(0,media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, + base.recorderQualityLowPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0400 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 1 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0400', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH, + base.recorderQualityHighPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0500 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0500', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF, + base.recorderQualityQcifPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0600 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 3 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0600', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF, + base.recorderQualityCifPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0700 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 4 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0700', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P, + base.recorderQuality480PPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0800 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 5 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0800', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P, + base.recorderQuality720PPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0900 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 6 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_0900', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P, + base.recorderQuality1080PPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1000 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 7 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_1000', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA, + base.recorderQualityQvgaPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1100 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 1 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_1100', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackGetVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, + base.recorderQualityLowParaSourceId1, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1200 + * @tc.name : test isAudioRecoderConfigSupported + * @tc.desc : isAudioRecoderConfigSupported true + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_1200', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackAudioRecoderConfigSupported(base.audioRecorderPara1, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1300 + * @tc.name : test isAudioRecoderConfigSupported + * @tc.desc : isAudioRecoderConfigSupported true + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_1300', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + callbackAudioRecoderConfigSupported(base.audioRecorderPara2, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1400 + * @tc.name : test hasVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_CALLBACK_1400', 0, async function (done) { + console.info('test hasVideoRecorderProfile'); + callbackHasVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + +}) \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestPromise.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestPromise.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d36acf2c3a7343c6430c7d163de2e8292837572c --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileTestPromise.test.js @@ -0,0 +1,361 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * Distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * Limitations under the License. + */ + +import media from '@ohos.multimedia.media' +import * as base from './ProfileTestBase.js'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' + +describe('ProfileTestPromise', function () { + beforeAll(function () { + console.info('beforeAll case'); + }) + + beforeEach(async function () { + console.info('beforeEach case'); + }) + + afterEach(function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + async function getAudioRecorderCapsTest(done) { + media.getMediaCapability().then(async (mediaCaps) => { + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.getAudioRecorderCaps().then(async (audioCapsArray) => { + console.info('getAudioRecorderCaps success'); + if (typeof (audioCapsArray) != 'undefined') { + base.checkAudioArray(audioCapsArray, done); + } else { + console.info('audioCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } + + async function getVideoRecorderCapsTest(done) { + media.getMediaCapability().then(async (mediaCaps) => { + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.getVideoRecorderCaps().then(async (videoCapsArray) => { + console.info('getVideoRecorderCaps success'); + if (typeof (videoCapsArray) != 'undefined') { + base.checkVideoArray(videoCapsArray, done); + } else { + console.info('audioCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } + + async function promiseGetVideoProfile(sourceId, qualityLevel, expectProfile, done) { + media.getMediaCapability().then(async (mediaCaps) => { + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel).then(async (videoCapsArray) => { + console.info('getVideoRecorderProfile success'); + expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length); + let keys = Object.keys(videoCapsArray); + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; + expect(videoCapsArray[key]).assertEqual(expectProfile[key]); + } + done(); + }, err => { + expect(err).assertUndefined(); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } + + async function promiseAudioRecoderConfigSupported(audioProfile, done) { + media.getMediaCapability().then(async (mediaCaps) => { + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.isAudioRecoderConfigSupported(audioProfile).then(async (ean) => { + console.info('isAudioRecoderConfigSupported: success' + ean); + expect(ean).assertEqual(true); + console.info('isAudioRecoderConfigSupported: success'); + done(); + }, err => { + expect(err).assertUndefined(); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } + + async function promiseHasVideoProfile(sourceId, qualityLevel, done) { + media.getMediaCapability().then(async (mediaCaps) => { + console.info('getMediaCapability success'); + if (typeof (mediaCaps) != 'undefined') { + mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel).then(async (ean) => { + expect(ean).assertEqual(true); + console.info('hasVideoRecorderProfile success'); + done(); + }, err => { + expect(err).assertUndefined(); + done(); + }) + } else { + console.info('mediaCaps is undefined'); + expect().assertFail(); + done(); + } + }, err => { + expect(err).assertUndefined(); + done(); + }) + } + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0100 + * @tc.name : test getAudioRecorderCaps + * @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0100', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + getAudioRecorderCapsTest(done); + console.info("test getAudioRecorderCaps success "); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0200 + * @tc.name : test getVideoRecorderCapsTest + * @tc.desc : outputFormat/audioEncoderMime/audioSampleRates/videoEncoderMime/audioBitrateRange/ + audioChannelRange/videoBitrateRange/videoFramerateRange/videoWidthRange/videoHeightRange + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level0 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0200', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + getVideoRecorderCapsTest(done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0300 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0300', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(0,media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, + base.recorderQualityLowPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0400 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 1 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0400', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH, + base.recorderQualityHighPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0500 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 2 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0500', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF, + base.recorderQualityQcifPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0600 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 3 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0600', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF, + base.recorderQualityCifPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0700 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 4 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0700', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P, + base.recorderQuality480PPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0800 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 5 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0800', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P, + base.recorderQuality720PPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0900 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 6 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_0900', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P, + base.recorderQuality1080PPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1000 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 7 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_1000', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA, + base.recorderQualityQvgaPara, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1100 + * @tc.name : test getVideoRecorderProfile + * @tc.desc : sourceId 1 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_1100', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseGetVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, + base.recorderQualityLowParaSourceId1, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1200 + * @tc.name : test isAudioRecoderConfigSupported + * @tc.desc : isAudioRecoderConfigSupported true + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_1200', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseAudioRecoderConfigSupported(base.audioRecorderPara1, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1300 + * @tc.name : test isAudioRecoderConfigSupported + * @tc.desc : isAudioRecoderConfigSupported true + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_1300', 0, async function (done) { + console.info("test getAudioRecorderCaps"); + promiseAudioRecoderConfigSupported(base.audioRecorderPara2, done); + }) + + /* * + * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1400 + * @tc.name : test hasVideoRecorderProfile + * @tc.desc : sourceId 0 qualityLevel 0 + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level1 + */ + it('SUB_PROFILE_FUNCTION_PROMISE_1400', 0, async function (done) { + console.info('test hasVideoRecorderProfile'); + promiseHasVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); + }) + +}) diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json b/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png b/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png differ diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/List.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/List.test.ets index bd0c92994a7b4dd0047e47cc0e29d7d0fc78d11c..cc10b98cdfcf9e32a09e514190955758ac3ee409 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/List.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/List.test.ets @@ -15,51 +15,51 @@ import getPermissionTest from './getPermission.test.ets' import albumGetFileAssetsCallbackTest from './albumGetFileAssetsCallback.test.ets' import albumGetFileAssetsPromiseTest from './albumGetFileAssetsPromise.test.ets' -//import favoriteTestCallBackTest from './favoriteTestCallBack.test.ets' -//import favoriteTestPromiseTest from './favoriteTestPromise.test.ets' -//import fetchFileResultCallBackTest from './fetchFileResultCallBack.test.ets' -//import fetchFileResultPromiseTest from './fetchFileResultPromise.test.ets' -//import fileAssetCallBack2Test from './fileAssetCallBack2.test.ets' +import favoriteTestCallBackTest from './favoriteTestCallBack.test.ets' +import favoriteTestPromiseTest from './favoriteTestPromise.test.ets' +import fetchFileResultCallBackTest from './fetchFileResultCallBack.test.ets' +import fetchFileResultPromiseTest from './fetchFileResultPromise.test.ets' +import fileAssetCallBack2Test from './fileAssetCallBack2.test.ets' import FileAssetGetThumbnailCallBackTest from './FileAssetGetThumbnailCallBack.test.ets' import FileAssetGetThumbnailPromiseTest from './FileAssetGetThumbnailPromise.test.ets' -//import fileAssetPromise2Test from './fileAssetPromise2.test.ets' -//import fileAssetTestCallbackTest from './fileAssetTestCallback.test.ets' -//import fileAssetTestPromiseTest from './fileAssetTestPromise.test.ets' +import fileAssetPromise2Test from './fileAssetPromise2.test.ets' +import fileAssetTestCallbackTest from './fileAssetTestCallback.test.ets' +import fileAssetTestPromiseTest from './fileAssetTestPromise.test.ets' import fileAssetUriTestCallBackTest from './fileAssetUriTestCallBack.test.ets' import fileAssetUriTestPromiseTest from './fileAssetUriTestPromise.test.ets' import filekeyTestCallBackTest from './filekeyTestCallBack.test.ets' import filekeyTestPromiseTest from './filekeyTestPromise.test.ets' import fileTestCallBackTest from './fileTestCallBack.test.ets' import fileTestPromiseTest from './fileTestPromise.test.ets' -//import mediaLibraryTestCallBackTest from './mediaLibraryTestCallBack.test.ets' -//import mediaLibraryTestPromiseTest from './mediaLibraryTestPromise.test.ets' -//import albumTestCallBackTest from './albumTestCallBack.test.ets' -//import albumTestPromiseTest from './albumTestPromise.test.ets' -//import mediaLibraryTestPromiseOnOffTest from './mediaLibraryTestPromiseOnOff.test.ets' +import mediaLibraryTestCallBackTest from './mediaLibraryTestCallBack.test.ets' +import mediaLibraryTestPromiseTest from './mediaLibraryTestPromise.test.ets' +import albumTestCallBackTest from './albumTestCallBack.test.ets' +import albumTestPromiseTest from './albumTestPromise.test.ets' +import mediaLibraryTestPromiseOnOffTest from './mediaLibraryTestPromiseOnOff.test.ets' export default function testsuite(abilityContext) { getPermissionTest() albumGetFileAssetsCallbackTest(abilityContext) albumGetFileAssetsPromiseTest(abilityContext) - //favoriteTestCallBackTest(abilityContext) - //favoriteTestPromiseTest(abilityContext) - //fetchFileResultCallBackTest(abilityContext) - //fetchFileResultPromiseTest(abilityContext) - //fileAssetCallBack2Test(abilityContext) + favoriteTestCallBackTest(abilityContext) + favoriteTestPromiseTest(abilityContext) + fetchFileResultCallBackTest(abilityContext) + fetchFileResultPromiseTest(abilityContext) + fileAssetCallBack2Test(abilityContext) FileAssetGetThumbnailCallBackTest(abilityContext) FileAssetGetThumbnailPromiseTest(abilityContext) - //fileAssetPromise2Test(abilityContext) - //fileAssetTestCallbackTest(abilityContext) - //fileAssetTestPromiseTest(abilityContext) + fileAssetPromise2Test(abilityContext) + fileAssetTestCallbackTest(abilityContext) + fileAssetTestPromiseTest(abilityContext) fileAssetUriTestCallBackTest(abilityContext) fileAssetUriTestPromiseTest(abilityContext) filekeyTestCallBackTest(abilityContext) filekeyTestPromiseTest(abilityContext) fileTestCallBackTest(abilityContext) fileTestPromiseTest(abilityContext) - //mediaLibraryTestCallBackTest(abilityContext) - //mediaLibraryTestPromiseTest(abilityContext) - //albumTestCallBackTest(abilityContext) - //albumTestPromiseTest(abilityContext) - //mediaLibraryTestPromiseOnOffTest(abilityContext) -} \ No newline at end of file + mediaLibraryTestCallBackTest(abilityContext) + mediaLibraryTestPromiseTest(abilityContext) + albumTestCallBackTest(abilityContext) + albumTestPromiseTest(abilityContext) + mediaLibraryTestPromiseOnOffTest(abilityContext) +} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/albumTestCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/albumTestCallBack.test.ets index fdba461d64b524863a63b11baec18bc7b83a66a8..31a6c32cc057f25d325cbcc8838027254544694c 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/albumTestCallBack.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/albumTestCallBack.test.ets @@ -354,147 +354,6 @@ export default function albumTestCallBackTest(abilityContext){ // ------------------------------ 001 test end ------------------------- // ------------------------------ 002 test start ------------------------- - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_01 - * @tc.name : getAlbums - * @tc.desc : Get Album by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_01', 0, async function (done) { - try { - media.getAlbums(666, (err, albumList) => { - if (albumList == undefined) { - console.info('ALBUM_CALLBACK getalbum 002_01 passed'); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - console.info('ALBUM_CALLBACK getalbum 002_01 failed'); - done(); - } - }); - - } catch (error) { - console.info('ALBUM_CALLBACK getalbum 002_01 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_02 - * @tc.name : getAlbums - * @tc.desc : Get Album by '666' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_02', 0, async function (done) { - try { - media.getAlbums('666', (err, albumList) => { - if (albumList == undefined) { - console.info('ALBUM_CALLBACK getalbum 002_02 passed'); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - console.info('ALBUM_CALLBACK getalbum 002_02 failed'); - done(); - } - }); - } catch (error) { - console.info('ALBUM_CALLBACK getalbum 002_02 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_03 - * @tc.name : getAlbums - * @tc.desc : Get Album by 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_03', 0, async function (done) { - try { - media.getAlbums(0, (err, albumList) => { - if (albumList == undefined) { - console.info('ALBUM_CALLBACK getalbum 002_03 passed'); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - console.info('ALBUM_CALLBACK getalbum 002_03 failed'); - done(); - } - }); - } catch (error) { - console.info('ALBUM_CALLBACK getalbum 002_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_04 - * @tc.name : getAlbums - * @tc.desc : Get Album by true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_04', 0, async function (done) { - try { - media.getAlbums(true, (err, albumList) => { - if (albumList == undefined) { - console.info('ALBUM_CALLBACK getalbum 002_04 passed'); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - console.info('ALBUM_CALLBACK getalbum 002_04 failed'); - done(); - } - }); - } catch (error) { - console.info('ALBUM_CALLBACK getalbum 002_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_05 - * @tc.name : getAlbums - * @tc.desc : Get Album by false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_CALLBACK_002_05', 0, async function (done) { - try { - media.getAlbums(false, (err, albumList) => { - if (albumList == undefined) { - console.info('ALBUM_CALLBACK getalbum 002_05 passed'); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - console.info('ALBUM_CALLBACK getalbum 002_05 failed'); - done(); - } - }); - } catch (error) { - console.info('ALBUM_CALLBACK getalbum 002_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_CALLBACK_002_06 * @tc.name : album.getFileAssets @@ -685,9 +544,9 @@ export default function albumTestCallBackTest(abilityContext){ const albumId = album.albumId; console.info('ALBUM_CALLBACK Modify 003_03 album.albumName(old) = ' + album.albumName); - let newName = true; + let newName = ""; for (var i = 0; i < 1200; i++) { - newName += 'i'; + newName += i.toString(); } album.albumName = newName; @@ -712,83 +571,6 @@ export default function albumTestCallBackTest(abilityContext){ } done(); }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_04 - * @tc.name : commitModify - * @tc.desc : Modify Album name true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_04', 0, async function (done) { - try { - const albumList = await media.getAlbums(allTypefetchOp); - const album = albumList[0]; - const albumId = album.albumId; - - console.info('ALBUM_CALLBACK Modify 003_04 album.albumName(old) = ' + album.albumName); - const newName = true; - album.albumName = newName; - - album.commitModify(async () => { - try { - let currentfetchOp = { - selections: fileKeyObj.ALBUM_ID + '= ?', - selectionArgs: [albumId + ''], - }; - const newAlbumList = await media.getAlbums(currentfetchOp); - - expect(newAlbumList[0].albumName == newName).assertFalse(); - done(); - } catch (error) { - console.info('ALBUM_CALLBACK Modify 003_04 commitModify failed, message = ' + error); - } - }); - } catch (error) { - console.info('ALBUM_CALLBACK Modify 003_04 passed'); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_05 - * @tc.name : commitModify - * @tc.desc : Modify Album name false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_003_05', 0, async function (done) { - try { - const albumList = await media.getAlbums(allTypefetchOp); - const album = albumList[0]; - const albumId = album.albumId; - - console.info('ALBUM_CALLBACK Modify 003_05 album.albumName(old) = ' + album.albumName); - const newName = false; - album.albumName = newName; - album.commitModify(async () => { - try { - let currentfetchOp = { - selections: fileKeyObj.ALBUM_ID + '= ?', - selectionArgs: [albumId + ''], - }; - const newAlbumList = await media.getAlbums(currentfetchOp); - - expect(newAlbumList[0].albumName == newName).assertFalse(); - done(); - } catch (error) { - console.info('ALBUM_CALLBACK Modify 003_05 commitModify failed, message = ' + error); - } - }); - } catch (error) { - console.info('ALBUM_CALLBACK Modify 003_05 passed'); - expect(true).assertTrue(); - } - done(); - }); // ------------------------------ 003 test end ------------------------- // ------------------------------ 004 test start ------------------------- @@ -835,52 +617,6 @@ export default function albumTestCallBackTest(abilityContext){ } }); // ------------------------------ 004 test end ------------------------- - - // ------------------------------ 006 test start ------------------------- - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_01 - * @tc.name : commitModify - * @tc.desc : Modify Album albumUri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_01', 0, async function (done) { - const albumList = await media.getAlbums(allTypefetchOp); - const album = albumList[0]; - try { - album.albumUri = 'testalbumUri'; - expect(false).assertTrue(); - done(); - } catch (error) { - expect(true).assertTrue(); - done(); - console.info('ALBUM_CALLBACK Modify 006_01 003 album.albumUri error = album.albumUri has no setter'); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_02 - * @tc.name : commitModify - * @tc.desc : Modify Album name false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_CALLBACK_006_02', 0, async function (done) { - const albumList = await media.getAlbums(allTypefetchOp); - const album = albumList[0]; - try { - album.coverUri = 'testcoverUri'; - expect(false).assertTrue(); - done(); - } catch (error) { - expect(true).assertTrue(); - console.info('ALBUM_CALLBACK Modify 006_01 003 album.albumUri error = album.coverUri has no setter'); - done(); - } - }); - // ------------------------------ 006 test end ------------------------- }); } diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/albumTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/albumTestPromise.test.ets index bf5880569ea960421c0f5747a62cb5995af4230c..f6ce32671d6064c5fadc0f8a1ec2a07a73560c6f 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/albumTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/albumTestPromise.test.ets @@ -313,111 +313,6 @@ export default function albumTestPromiseTest(abilityContext){ // ------------------------------ 001 test end ------------------------- // ------------------------------ 002 test start ------------------------- - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_01 - * @tc.name : getAlbums - * @tc.desc : Get Album by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_01', 0, async function (done) { - try { - await media.getAlbums(666); - expect(false).assertTrue(); - console.info('ALBUM_PROMISE getalbum 002_01 failed'); - done(); - } catch (error) { - console.info('ALBUM_PROMISE getalbum 002_01 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_02 - * @tc.name : getAlbums - * @tc.desc : Get Album by '666' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_02', 0, async function (done) { - try { - await media.getAlbums('666'); - console.info('ALBUM_PROMISE getalbum 002_02 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('ALBUM_PROMISE getalbum 002_02 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_03 - * @tc.name : getAlbums - * @tc.desc : Get Album by 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_03', 0, async function (done) { - try { - await media.getAlbums(0); - console.info('ALBUM_PROMISE getalbum 002_03 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('ALBUM_PROMISE getalbum 002_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_04 - * @tc.name : getAlbums - * @tc.desc : Get Album by true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_04', 0, async function (done) { - try { - await media.getAlbums(true); - console.info('ALBUM_PROMISE getalbum 002_04 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('ALBUM_PROMISE getalbum 002_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_05 - * @tc.name : getAlbums - * @tc.desc : Get Album by false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_GETALBUM_PROMISE_002_05', 0, async function (done) { - try { - await media.getAlbums(false); - console.info('ALBUM_PROMISE getalbum 002_05 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('ALBUM_PROMISE getalbum 002_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_06 * @tc.name : album.getFileAssets @@ -581,9 +476,9 @@ export default function albumTestPromiseTest(abilityContext){ const albumId = album.albumId; console.info('ALBUM_PROMISE Modify 003_04 album.albumName(old) = ' + album.albumName); - let newName = true; + let newName = ""; for (var i = 0; i < 1200; i++) { - newName += 'i'; + newName += i.toString(); } album.albumName = newName; @@ -603,76 +498,6 @@ export default function albumTestPromiseTest(abilityContext){ } done(); }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_05 - * @tc.name : commitModify - * @tc.desc : Modify Album name true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_05', 0, async function (done) { - try { - const albumList = await media.getAlbums(allTypefetchOp); - const album = albumList[0]; - const albumId = album.albumId; - - console.info('ALBUM_PROMISE Modify 003_05 album.albumName(old) = ' + album.albumName); - const newName = true; - album.albumName = newName; - - await album.commitModify(); - - let currentfetchOp = { - selections: fileKeyObj.ALBUM_ID + '= ?', - selectionArgs: [albumId + ''], - }; - const newAlbumList = await media.getAlbums(currentfetchOp); - - expect(newAlbumList[0].albumName === newName).assertFalse(); - done(); - } catch (error) { - console.info('ALBUM_PROMISE Modify 003_05 passed'); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_06 - * @tc.name : commitModify - * @tc.desc : Modify Album name false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_003_06', 0, async function (done) { - try { - const albumList = await media.getAlbums(allTypefetchOp); - const album = albumList[0]; - const albumId = album.albumId; - - console.info('ALBUM_PROMISE Modify 003_06 album.albumName(old) = ' + album.albumName); - const newName = false; - album.albumName = newName; - - await album.commitModify(); - - let currentfetchOp = { - selections: fileKeyObj.ALBUM_ID + '= ?', - selectionArgs: [albumId + ''], - }; - const newAlbumList = await media.getAlbums(currentfetchOp); - - expect(newAlbumList[0].albumName === newName).assertFalse(); - done(); - } catch (error) { - console.info('ALBUM_PROMISE Modify 003_06 passed'); - expect(true).assertTrue(); - } - done(); - }); // ------------------------------ 003 test end ------------------------- // ------------------------------ 004 test start ------------------------- @@ -713,54 +538,6 @@ export default function albumTestPromiseTest(abilityContext){ } }); // ------------------------------ 004 test end ------------------------- - - // ------------------------------ 006 test start ------------------------- - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_006_01 - * @tc.name : commitModify - * @tc.desc : Modify Album albumUri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_006_01', 0, async function (done) { - try { - const albumList = await media.getAlbums(allTypefetchOp); - const album = albumList[0]; - album.albumUri = 'testalbumUri'; - await album.commitModify(); - console.info('ALBUM_PROMISE Modify 006_01 failed'); - expect(false).assertTrue(); - } catch (error) { - console.info('ALBUM_PROMISE Modify 006_01 passed'); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_006_02 - * @tc.name : commitModify - * @tc.desc : Modify Album name false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_MODIFYALBUM_PROMISE_006_02', 0, async function (done) { - try { - const albumList = await media.getAlbums(allTypefetchOp); - const album = albumList[0]; - album.coverUri = 'testcoverUri'; - await album.commitModify(); - console.info('ALBUM_PROMISE Modify 006_02 failed'); - expect(false).assertTrue(); - } catch (error) { - console.info('ALBUM_PROMISE Modify 006_02 passed'); - expect(true).assertTrue(); - } - done(); - }); - // ------------------------------ 006 test end ------------------------- }); } diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favoriteTestCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favoriteTestCallBack.test.ets index 74b6d285cd151335d141530f31e14439fea48e1f..b0957222e1aa1815c1ec4c7f6b1ca7f32bc5315b 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favoriteTestCallBack.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favoriteTestCallBack.test.ets @@ -180,171 +180,6 @@ export default function favoriteTestCallBackTest(abilityContext) { } }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_03 - * @tc.name : favorite - * @tc.desc : favorite(file) by 'true' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_03', 0, async function (done) { - try { - media.getFileAssets(fileFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('true', () => { - console.info('FAV_ASSET_CALLBACK 001_03 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_03 pass'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_03 pass'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_04 - * @tc.name : favorite - * @tc.desc : favorite(file) by 'false' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_04', 0, async function (done) { - try { - media.getFileAssets(fileFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('false', () => { - console.info('FAV_ASSET_CALLBACK 001_04 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_04 pass'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_04 pass'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_05 - * @tc.name : favorite - * @tc.desc : favorite(file) by 'fav' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_05', 0, async function (done) { - try { - media.getFileAssets(fileFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('fav', () => { - console.info('FAV_ASSET_CALLBACK 001_05 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_05 pass'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_05 pass'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_06 - * @tc.name : favorite - * @tc.desc : favorite(file) by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_06', 0, async function (done) { - try { - media.getFileAssets(fileFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite(666, () => { - console.info('FAV_ASSET_CALLBACK 001_06 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_06 pass'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_06 pass'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_07 - * @tc.name : favorite - * @tc.desc : favorite(file) by no arg - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_07', 0, async function (done) { - try { - media.getFileAssets(fileFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite(() => { - console.info('FAV_ASSET_CALLBACK 001_07 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_07 pass'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 001_07 pass'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_001_08 * @tc.name : isFavorite @@ -542,171 +377,6 @@ export default function favoriteTestCallBackTest(abilityContext) { } }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_03 - * @tc.name : favorite - * @tc.desc : favorite(image) by 'true' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_03', 0, async function (done) { - try { - media.getFileAssets(imageFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('true', () => { - console.info('FAV_ASSET_CALLBACK 002_03 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_04 - * @tc.name : favorite - * @tc.desc : favorite(image) by 'false' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_04', 0, async function (done) { - try { - media.getFileAssets(imageFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('false', () => { - console.info('FAV_ASSET_CALLBACK 002_04 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_05 - * @tc.name : favorite - * @tc.desc : favorite(image) by 'fav' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_05', 0, async function (done) { - try { - media.getFileAssets(imageFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('fav', () => { - console.info('FAV_ASSET_CALLBACK 002_05 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_06 - * @tc.name : favorite - * @tc.desc : favorite(image) by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_06', 0, async function (done) { - try { - media.getFileAssets(imageFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite(666, () => { - console.info('FAV_ASSET_CALLBACK 002_06 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_07 - * @tc.name : favorite - * @tc.desc : favorite(image) by no arg - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_07', 0, async function (done) { - try { - media.getFileAssets(imageFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite(() => { - console.info('FAV_ASSET_CALLBACK 002_07 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 002_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_002_08 * @tc.name : isFavorite @@ -905,171 +575,6 @@ export default function favoriteTestCallBackTest(abilityContext) { } }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_03 - * @tc.name : favorite - * @tc.desc : favorite(video) by 'true' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_03', 0, async function (done) { - try { - media.getFileAssets(videoFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('true', () => { - console.info('FAV_ASSET_CALLBACK 003_03 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_04 - * @tc.name : favorite - * @tc.desc : favorite(video) by 'false' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_04', 0, async function (done) { - try { - media.getFileAssets(videoFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('false', () => { - console.info('FAV_ASSET_CALLBACK 003_04 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_05 - * @tc.name : favorite - * @tc.desc : favorite(video) by 'fav' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_05', 0, async function (done) { - try { - media.getFileAssets(videoFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('fav', () => { - console.info('FAV_ASSET_CALLBACK 003_05 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_06 - * @tc.name : favorite - * @tc.desc : favorite(video) by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_06', 0, async function (done) { - try { - media.getFileAssets(videoFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite(666, () => { - console.info('FAV_ASSET_CALLBACK 003_06 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_07 - * @tc.name : favorite - * @tc.desc : favorite(video) by no arg - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_07', 0, async function (done) { - try { - media.getFileAssets(videoFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite(() => { - console.info('FAV_ASSET_CALLBACK 003_07 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 003_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_003_08 * @tc.name : isFavorite @@ -1268,171 +773,6 @@ export default function favoriteTestCallBackTest(abilityContext) { } }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_03 - * @tc.name : favorite - * @tc.desc : favorite(audio) by 'true' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_03', 0, async function (done) { - try { - media.getFileAssets(audioFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('true', () => { - console.info('FAV_ASSET_CALLBACK 004_03 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_04 - * @tc.name : favorite - * @tc.desc : favorite(audio) by 'false' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_04', 0, async function (done) { - try { - media.getFileAssets(audioFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('false', () => { - console.info('FAV_ASSET_CALLBACK 004_04 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_05 - * @tc.name : favorite - * @tc.desc : favorite(audio) by 'fav' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_05', 0, async function (done) { - try { - media.getFileAssets(audioFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite('fav', () => { - console.info('FAV_ASSET_CALLBACK 004_05 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_06 - * @tc.name : favorite - * @tc.desc : favorite(audio) by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_06', 0, async function (done) { - try { - media.getFileAssets(audioFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite(666, () => { - console.info('FAV_ASSET_CALLBACK 004_06 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_07 - * @tc.name : favorite - * @tc.desc : favorite(audio) by no arg - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_07', 0, async function (done) { - try { - media.getFileAssets(audioFetchOp, (error, fileAssets) => { - fileAssets.getAllObject((error, dataList) => { - const asset = dataList[0]; - try { - asset.favorite(() => { - console.info('FAV_ASSET_CALLBACK 004_07 fail'); - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - }); - } catch (error) { - console.info('FAV_ASSET_CALLBACK 004_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_004_08 * @tc.name : isFavorite diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favoriteTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favoriteTestPromise.test.ets index 41f006991833bc2c5f1fe8ed8abe53fc30fbb5c1..5d065f4186ea802c80b30edfb77396e8c6b07635 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favoriteTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favoriteTestPromise.test.ets @@ -137,126 +137,6 @@ export default function favoriteTestPromiseTest(abilityContext) { } }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_03 - * @tc.name : favorite - * @tc.desc : favorite(file) by 'true' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_03', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(fileFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('true'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_03 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_04 - * @tc.name : favorite - * @tc.desc : favorite(file) by 'false' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_04', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(fileFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('false'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_04 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_05 - * @tc.name : favorite - * @tc.desc : favorite(file) by 'fav' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_05', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(fileFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('fav'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_05 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_06 - * @tc.name : favorite - * @tc.desc : favorite(file) by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_06', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(fileFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite(666); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_06 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_07 - * @tc.name : favorite - * @tc.desc : favorite(file) by no arg - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_07', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(fileFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite(); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_07 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 001_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_001_08 * @tc.name : isFavorite @@ -403,126 +283,6 @@ export default function favoriteTestPromiseTest(abilityContext) { } }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_03 - * @tc.name : favorite - * @tc.desc : favorite(image) by 'true' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_03', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(imageFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('true'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_03 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_04 - * @tc.name : favorite - * @tc.desc : favorite(image) by 'false' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_04', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(imageFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('false'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_04 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_05 - * @tc.name : favorite - * @tc.desc : favorite(image) by 'fav' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_05', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(imageFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('fav'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_05 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_06 - * @tc.name : favorite - * @tc.desc : favorite(image) by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_06', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(imageFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite(666); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_06 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_07 - * @tc.name : favorite - * @tc.desc : favorite(image) by no arg - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_07', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(imageFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite(); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_07 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 002_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_002_08 * @tc.name : isFavorite @@ -668,126 +428,6 @@ export default function favoriteTestPromiseTest(abilityContext) { } }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_03 - * @tc.name : favorite - * @tc.desc : favorite(video) by 'true' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_03', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(videoFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('true'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_03 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_04 - * @tc.name : favorite - * @tc.desc : favorite(video) by 'false' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_04', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(videoFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('false'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_04 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_05 - * @tc.name : favorite - * @tc.desc : favorite(video) by 'fav' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_05', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(videoFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('fav'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_05 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_06 - * @tc.name : favorite - * @tc.desc : favorite(video) by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_06', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(videoFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite(666); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_06 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_07 - * @tc.name : favorite - * @tc.desc : favorite(video) by no arg - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_07', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(videoFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite(); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_07 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 003_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_003_08 * @tc.name : isFavorite @@ -933,126 +573,6 @@ export default function favoriteTestPromiseTest(abilityContext) { } }); - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_03 - * @tc.name : favorite - * @tc.desc : favorite(audio) by 'true' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_03', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(audioFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('true'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_03 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_03 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_04 - * @tc.name : favorite - * @tc.desc : favorite(audio) by 'false' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_04', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(audioFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('false'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_04 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_04 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_05 - * @tc.name : favorite - * @tc.desc : favorite(audio) by 'fav' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_05', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(audioFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite('fav'); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_05 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_05 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_06 - * @tc.name : favorite - * @tc.desc : favorite(audio) by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_06', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(audioFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite(666); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_06 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_06 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_07 - * @tc.name : favorite - * @tc.desc : favorite(audio) by no arg - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_07', 0, async function (done) { - try { - const fileAssets = await media.getFileAssets(audioFetchOp); - const dataList = await fileAssets.getAllObject(); - const asset = dataList[0]; - await asset.favorite(); - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_07 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('MediaLibraryTest : FAV_ASSET_PROMISE 004_07 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_004_08 * @tc.name : isFavorite @@ -1115,4 +635,4 @@ export default function favoriteTestPromiseTest(abilityContext) { }); // ------------------------------ audio type end ------------------------ }); -} \ No newline at end of file +} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fetchFileResultCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fetchFileResultCallBack.test.ets index 29a48b8fc95b344551c86726a19127b05eb09ac2..145a8269638fc8dfe9ecdf37269661efbba207dc 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fetchFileResultCallBack.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fetchFileResultCallBack.test.ets @@ -71,6 +71,53 @@ export default function fetchFileResultCallBackTest(abilityContext) { afterAll(function () { }); + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FETCHRESULT_GETFIRSTOBJECT_CALLBACK_003 + * @tc.name : getFirstObject + * @tc.desc : Get FetchResult, get first object, check result + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MEDIA_MEDIALIBRARY_FETCHRESULT_GETFIRSTOBJECT_CALLBACK_003', 0, async function (done) { + try { + console.info('MediaLibraryTest : FETCHRESULT getFirstObject 003 begin'); + let mediaType = mediaLibrary.MediaType.IMAGE; + let dir = mediaLibrary.DirectoryType.DIR_IMAGE; + const path = await media.getPublicDirectory(dir); + let fileAsset = await media.createAsset(mediaType, 'forUri.jpg', path + 'myPicture/'); + if (fileAsset == undefined) { + console.info('MediaLibraryTest : FETCHRESULT createAsset fail'); + expect(false).assertTrue(); + done(); + return; + } + let fetchOption = { + selections: '', + selectionArgs: [], + uri: fileAsset.uri, + networkId: '' + } + let fetchFileResult = await media.getFileAssets(fetchOption); + fetchFileResult.getFirstObject(async (error, firstObject) => { + if (firstObject == undefined) { + expect(false).assertTrue(); + console.info('MediaLibraryTest : FETCHRESULT getFirstObject 003 fail'); + done(); + } else { + expect(firstObject.displayName == 'forUri.jpg').assertTrue(); + fetchFileResult.close(); + console.info('MediaLibraryTest : FETCHRESULT getFirstObject 003 end'); + done(); + } + }); + } catch (error) { + console.info('MediaLibraryTest : FETCHRESULT getFirstObject 003 failed, message = ' + error); + expect(false).assertTrue(); + done(); + } + }); + // ------------------------------ 004 test start ------------------------- /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FETCHRESULT_GETFIRSTOBJECT_CALLBACK_004 @@ -82,7 +129,7 @@ export default function fetchFileResultCallBackTest(abilityContext) { */ it('SUB_MEDIA_MEDIALIBRARY_FETCHRESULT_GETFIRSTOBJECT_CALLBACK_004', 0, async function (done) { try { - console.info('MediaLibraryTest : FETCHRESULT getFirstObject begin'); + console.info('MediaLibraryTest : FETCHRESULT getFirstObject 004 begin'); let fetchFileResult = await media.getFileAssets(getFirstObjectOp); fetchFileResult.getFirstObject(async (error, firstObject) => { if (firstObject == undefined) { @@ -334,7 +381,8 @@ export default function fetchFileResultCallBackTest(abilityContext) { console.info('MediaLibraryTest : FETCHRESULT getNextObject 008_01 fail'); done(); } else { - expect(0 < targetObjects.length <= 1).assertTrue(); + expect(targetObjects.length > 0).assertTrue(); + expect(targetObjects.length <= 1).assertTrue(); console.info('MediaLibraryTest : FETCHRESULT getPositionObject 008_01 end'); done(); } @@ -365,7 +413,8 @@ export default function fetchFileResultCallBackTest(abilityContext) { console.info('MediaLibraryTest : FETCHRESULT getNextObject 008_01 fail'); done(); } else { - expect(0 < targetObjects.length <= 2).assertTrue(); + expect(targetObjects.length > 0).assertTrue(); + expect(targetObjects.length <= 2).assertTrue(); console.info('MediaLibraryTest : FETCHRESULT getAllObject 008_02 targetObjects.length:' + targetObjects.length); console.info('MediaLibraryTest : FETCHRESULT getAllObject 008_02 end'); @@ -398,7 +447,8 @@ export default function fetchFileResultCallBackTest(abilityContext) { console.info('MediaLibraryTest : FETCHRESULT getNextObject 008_03 fail'); done(); } else { - expect(0 < targetObjects.length <= 100).assertTrue(); + expect(targetObjects.length > 0).assertTrue(); + expect(targetObjects.length <= 100).assertTrue(); console.info('MediaLibraryTest : FETCHRESULT getAllObject 008_03 end'); done(); } @@ -544,4 +594,4 @@ export default function fetchFileResultCallBackTest(abilityContext) { } }); }); -} \ No newline at end of file +} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fetchFileResultPromise.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fetchFileResultPromise.test.ets index e2cb4ecc2f1f6a919e5382dc37187d80bd7ebfce..c2e3702f1f35891967c04e698737a67bb01381f9 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fetchFileResultPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fetchFileResultPromise.test.ets @@ -270,7 +270,6 @@ export default function fetchFileResultPromiseTest(abilityContext){ let targetObject = await fetchFileResult.getPositionObject(0); expect(false).assertTrue(); console.info('MediaLibraryTest : FETCHRESULT close getPositionObject 003 failed'); - s done(); } catch { console.info('MediaLibraryTest : FETCHRESULT close 003 closed'); diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetCallBack2.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetCallBack2.test.ets index a5b620eb75ab6b1e844993a3c29baa6911821731..c8a5e9ebab5be23ae232527f7aada0d2c7c07907 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetCallBack2.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetCallBack2.test.ets @@ -204,76 +204,6 @@ export default function fileAssetCallBack2Test(abilityContext){ } }); - /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_005 - * @tc.name : commitModify - * @tc.desc : Modify uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_FILEASSET_commitModify_callback_005', 0, async function (done) { - try { - const fetchFileResult = await media.getFileAssets(imagesfetchOp); - const asset = await fetchFileResult.getFirstObject(); - const id = asset.id; - const newUri = 'newUri'; - - asset.uri = newUri; - - asset.commitModify(async (err) => { - if (err) { - expect(true).assertTrue(); - done(); - } else { - console.info('FileAsset commitModify 005 failed'); - expect(false).assertTrue(); - done(); - } - }); - - - } catch (error) { - console.info('FileAsset commitModify 005 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_006 - * @tc.name : commitModify - * @tc.desc : Modify mediaType - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_FILEASSET_commitModify_callback_006', 0, async function (done) { - try { - const fetchFileResult = await media.getFileAssets(imagesfetchOp); - const asset = await fetchFileResult.getFirstObject(); - const id = asset.id; - const newMediaType = 'newMediaType'; - - asset.mediaType = newMediaType; - - asset.commitModify(async (err) => { - if (err) { - expect(true).assertTrue(); - done(); - } else { - console.info('FileAsset commitModify 006 failed'); - expect(false).assertTrue(); - done(); - } - }); - } catch (error) { - console.info('FileAsset commitModify 006 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_FILEASSET_isDirectory_callback_001 * @tc.name : isDirectory diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetPromise2.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetPromise2.test.ets index b59006d9dd7cb1065cd45cb0f5d27194ddbecb97..c057a2c3146f2c0cd9a01f6acb393dcd1505be56 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetPromise2.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetPromise2.test.ets @@ -206,64 +206,6 @@ export default function fileAssetPromise2Test(abilityContext){ } }); - /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_005 - * @tc.name : commitModify - * @tc.desc : Modify uri - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_FILEASSET_commitModify_promise_005', 0, async function (done) { - try { - const fetchFileResult = await media.getFileAssets(imagesfetchOp); - const asset = await fetchFileResult.getFirstObject(); - const id = asset.id; - const newUri = 'newUri'; - - asset.uri = newUri; - - await asset.commitModify(); - - console.info('FileAsset commitModify 005 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('FileAsset commitModify 005 passed'); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_006 - * @tc.name : commitModify - * @tc.desc : Modify mediaType - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_FILEASSET_commitModify_promise_006', 0, async function (done) { - try { - const fetchFileResult = await media.getFileAssets(imagesfetchOp); - const asset = await fetchFileResult.getFirstObject(); - const id = asset.id; - const newMediaType = 'newMediaType'; - - asset.mediaType = newMediaType; - - await asset.commitModify(); - - console.info('FileAsset commitModify 006 failed'); - expect(false).assertTrue(); - done(); - } catch (error) { - console.info('FileAsset commitModify 006 passed'); - expect(true).assertTrue(); - done(); - } - }); - /** * @tc.number : SUB_MEDIA_FILEASSET_isDirectory_promise_001 * @tc.name : isDirectory diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetTestCallback.test.ets index ac7ab7cd1dfa0c250431ef2a13bc234f5cd832c8..3e87c028ec7d7f044e6baf310a157d1a112f8b57 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetTestCallback.test.ets @@ -180,6 +180,9 @@ export default function fileAssetTestCallbackTest(abilityContext){ let asset1; let fd; let fd1; + let assetProps = { + write: 4096, + } try { let type = mediaLibrary.MediaType.FILE; let fetchOp = { @@ -238,113 +241,6 @@ export default function fileAssetTestCallbackTest(abilityContext){ //======================== FILE END ================================== - //======================== ALBUM BEGIN ================================== - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_04 - * @tc.name : open('rw') - * @tc.desc : open -rw the type of ALBUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_04', 0, async function (done) { - let asset; - let fd; - try { - let type = mediaLibrary.MediaType.ALBUM; - let fetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [type.toString()], - }; - let fetchFileResult = await media.getFileAssets(fetchOp); - const dataList = await fetchFileResult.getAllObject(); - asset = dataList[0]; - asset.open('rw', async (error, fd) => { - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_04 error:' - + error); - expect(true).assertTrue(); - if (isNum(fd)) { - asset.close(fd); - } - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_05 - * @tc.name : open('r') - * @tc.desc : open -r the type of ALBUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_05', 0, async function (done) { - let asset; - let fd; - try { - let type = mediaLibrary.MediaType.ALBUM; - let fetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [type.toString()], - }; - let fetchFileResult = await media.getFileAssets(fetchOp); - const dataList = await fetchFileResult.getAllObject(); - asset = dataList[0]; - asset.open('r', async (error, fd) => { - expect(false).assertTrue(); - done(); - }); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_05 error:' - + error); - expect(true).assertTrue(); - if (isNum(fd)) { - asset.close(fd); - } - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_06 - * @tc.name : open('w') - * @tc.desc : open -w the type of ALBUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_06', 0, async function (done) { - let asset; - let fd; - try { - let type = mediaLibrary.MediaType.ALBUM; - let fetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [type.toString()], - }; - let fetchFileResult = await media.getFileAssets(fetchOp); - const dataList = await fetchFileResult.getAllObject(); - asset = dataList[0]; - asset.open('w', (error, fd) => { - expect(false).assertTrue(); - }); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_06 error:' - + error); - expect(true).assertTrue(); - if (isNum(fd)) { - asset.close(fd); - } - done(); - } - }); - - //======================== ALBUM END ================================== - //======================== IMAGE BEGIN ================================== /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_CALLBACK_005_07 @@ -700,6 +596,9 @@ export default function fileAssetTestCallbackTest(abilityContext){ let asset1; let fd; let fd1; + let assetProps = { + write: 4096, + } try { let type = mediaLibrary.MediaType.AUDIO; let fetchOp = { @@ -915,6 +814,9 @@ export default function fileAssetTestCallbackTest(abilityContext){ let asset1; let fd; let fd1; + let assetProps = { + write: 4096, + } try { let type = mediaLibrary.MediaType.VIDEO; let fetchOp = { diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetTestPromise.test.ets index 0000be634bb54f03750badead6c68a5bc61fa237..5432dc9d254dc1c0a7b41399d4fabdf261afcab9 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/fileAssetTestPromise.test.ets @@ -186,106 +186,6 @@ export default function fileAssetTestPromiseTest(abilityContext){ //======================== FILE END ================================== - //======================== ALBUM BEGIN ================================== - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_04 - * @tc.name : open('rw') - * @tc.desc : open -rw the type of ALBUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_04', 0, async function (done) { - let asset; - let fd; - try { - let type = mediaLibrary.MediaType.ALBUM; - - let fetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [type.toString()], - }; - let fetchFileResult = await media.getFileAssets(fetchOp); - const dataList = await fetchFileResult.getAllObject(); - asset = dataList[0]; - fd = await asset.open('rw'); - done(); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_03 error:' + error); - expect(true).assertTrue(); - if (isNum(fd)) { - asset.close(fd); - } - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_05 - * @tc.name : open('r') - * @tc.desc : open -r the type of ALBUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_05', 0, async function (done) { - let asset; - let fd; - try { - let type = mediaLibrary.MediaType.ALBUM; - let fetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [type.toString()], - }; - let fetchFileResult = await media.getFileAssets(fetchOp); - const dataList = await fetchFileResult.getAllObject(); - asset = dataList[0]; - fd = await asset.open('r'); - done(); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_05 error:' + error); - expect(true).assertTrue(); - if (isNum(fd)) { - asset.close(fd); - } - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_05 - * @tc.name : open('w') - * @tc.desc : open -w the type of ALBUM - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_06', 0, async function (done) { - let asset; - let fd; - try { - let type = mediaLibrary.MediaType.IMAGE; - let fetchOp = { - selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: ['Pictures/Dynamic02/', type.toString()], - }; - let fetchFileResult = await media.getFileAssets(fetchOp); - const dataList = await fetchFileResult.getAllObject(); - asset = dataList[0]; - fd = await asset.open('w'); - done(); - } catch (error) { - console.info('MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_06 error:' + error); - expect(true).assertTrue(); - if (isNum(fd)) { - asset.close(fd); - } - done(); - } - }); - - //======================== ALBUM END ================================== - //======================== IMAGE BEGIN ================================== /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_OPENANDCLOSE_ASSET_PROMISE_005_07 diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/filekeyTestCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/filekeyTestCallBack.test.ets index 7b938cbcf90966ba44137c65b6e27c530b397579..8abaa4cc486d106689b48d75cc33f5995ad452a9 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/filekeyTestCallBack.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/filekeyTestCallBack.test.ets @@ -323,6 +323,73 @@ export default function filekeyTestCallBackTest(abilityContext){ it('test_fileKey_0015', 0, async function (done) { getFileAssetsBy(done, 'audioAlbum'); }); + + /** + * @tc.number : test_fileKey_0016 + * @tc.name : getFileAssets + * @tc.desc : filekey relative_path + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('test_fileKey_0016', 0, async function (done) { + try { + let mediaType = mediaLibrary.MediaType.IMAGE; + let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; + const path = await media.getPublicDirectory(DIR_IMAGE); + let fileAsset = await media.createAsset(mediaType, 'forRelative.jpg', path); + if (fileAsset == undefined) { + console.info('MediaLibraryTest : FETCHRESULT createAsset fail'); + expect(false).assertTrue(); + done(); + return; + } + let fetchOption = { + selections: fileKeyObj.RELATIVE_PATH + '= ?', + selectionArgs: [path] + } + let fetchFileResult = await media.getFileAssets(fetchOption); + let firstObject = await fetchFileResult.getFirstObject(); + expect(firstObject.relativePath == path).assertTrue(); + done(); + } catch (error) { + console.info('ASSET_CALLBACK test_fileKey_0016 failed, message = ' + error); + } + }); + + /** + * @tc.number : test_fileKey_0017 + * @tc.name : getFileAssets + * @tc.desc : filekey display_name + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('test_fileKey_0017', 0, async function (done) { + try { + let mediaType = mediaLibrary.MediaType.IMAGE; + let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; + const path = await media.getPublicDirectory(DIR_IMAGE); + let name = 'forDisplay.jpg' + let fileAsset = await media.createAsset(mediaType, name, path); + if (fileAsset == undefined) { + console.info('MediaLibraryTest : FETCHRESULT createAsset fail'); + expect(false).assertTrue(); + done(); + return; + } + let fetchOption = { + selections: fileKeyObj.DISPLAY_NAME + '= ?', + selectionArgs: [name] + } + let fetchFileResult = await media.getFileAssets(fetchOption); + let firstObject = await fetchFileResult.getFirstObject(); + expect(firstObject.displayName == name).assertTrue(); + done(); + } catch (error) { + console.info('ASSET_CALLBACK test_fileKey_0017 failed, message = ' + error); + } + }); }); } diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestCallBack.test.ets index 2e1ada399443fea21f538e2c6581637b7e62e224..73661e129b77cb43cd8d4f5278cf1d7e83c05d9c 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestCallBack.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestCallBack.test.ets @@ -17,13 +17,6 @@ import featureAbility from '@ohos.ability.featureAbility'; import fileio from '@ohos.fileio'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; let fileKeyObj = mediaLibrary.FileKey; -let fetchOp = { - selections: fileKeyObj.PATH + ' LIKE ? ', - selectionArgs: ['/data/media/%'], - order: fileKeyObj.PATH, -}; -// let directoryTypeObj = mediaLibrary.DirectoryType; - let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; let DIR_VIDEO = mediaLibrary.DirectoryType.DIR_VIDEO; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; @@ -227,7 +220,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){ media.getFileAssets(imageRelativefetchOp, async (err, fetchFileResult) => { let count = 1; let type = 'image'; - await checkFileAssetAttr(done, fetchFileResult, type, count) + await checkFileAssetAttr(done, fetchFileResult, type, count, null) done(); }); } catch (error) { @@ -250,7 +243,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){ media.getFileAssets(videoRelativefetchOp, async (err, fetchFileResult) => { let count = 1; let type = 'video'; - await checkFileAssetAttr(done, fetchFileResult, type, count) + await checkFileAssetAttr(done, fetchFileResult, type, count, null) done(); }); } catch (error) { @@ -273,7 +266,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){ media.getFileAssets(audioRelativefetchOp, async (err, fetchFileResult) => { let count = 1; let type = 'audio'; - await checkFileAssetAttr(done, fetchFileResult, type, count) + await checkFileAssetAttr(done, fetchFileResult, type, count, null) done(); }); } catch (error) { @@ -296,7 +289,7 @@ export default function mediaLibraryTestCallBackTest(abilityContext){ media.getFileAssets(fileRelativefetchOp, async (err, fetchFileResult) => { let count = 1; let type = 'file'; - await checkFileAssetAttr(done, fetchFileResult, type, count) + await checkFileAssetAttr(done, fetchFileResult, type, count, null) done(); }); } catch (error) { @@ -980,7 +973,31 @@ export default function mediaLibraryTestCallBackTest(abilityContext){ } }); - + /** + * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_RELEASE_001 + * @tc.name : release + * @tc.desc : Release MediaLibrary instance + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_RELEASE_001', 0, async function (done) { + try { + console.info('MediaLibraryTest : release 001 begin'); + media.release((err, data) => { + if (err == undefined) { + expect(true).assertTrue(); + done(); + } else { + expect(false).assertTrue(); + done(); + }}); + } catch (error) { + console.info('MediaLibraryTest : release 001 failed, message = ' + error); + expect(false).assertTrue(); + done(); + } + }); }); } diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets index 73f85a8ca24790c679cb076c12a5e5fae9fc52b6..bae2baef28152182b00c690122866ae4a2e58cb8 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets @@ -17,13 +17,6 @@ import featureAbility from '@ohos.ability.featureAbility'; import fileio from '@ohos.fileio'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; let fileKeyObj = mediaLibrary.FileKey; -let fetchOp = { - selections: fileKeyObj.PATH + ' LIKE ? ', - selectionArgs: ['/data/media/%'], - order: fileKeyObj.PATH, -}; -// let directoryTypeObj = mediaLibrary.DirectoryType; - let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; let DIR_VIDEO = mediaLibrary.DirectoryType.DIR_VIDEO; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; @@ -248,7 +241,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext){ const fetchFileResult = await media.getFileAssets(imageRelativefetchOp); let count = 1; let type = 'image'; - await checkFileAssetAttr(done, fetchFileResult, type, count) + await checkFileAssetAttr(done, fetchFileResult, type, count, null) done(); } catch (error) { console.info(`MediaLibraryTest : getFileAssets 001 failed, error: ${error}`); @@ -270,7 +263,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext){ const fetchFileResult = await media.getFileAssets(videoRelativefetchOp); let count = 1; let type = 'video'; - await checkFileAssetAttr(done, fetchFileResult, type, count) + await checkFileAssetAttr(done, fetchFileResult, type, count, null) done(); } catch (error) { console.info(`MediaLibraryTest : getFileAssets 002 failed, error: ${error}`); @@ -292,7 +285,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext){ const fetchFileResult = await media.getFileAssets(audioRelativefetchOp); let count = 1; let type = 'audio'; - await checkFileAssetAttr(done, fetchFileResult, type, count) + await checkFileAssetAttr(done, fetchFileResult, type, count, null) done(); } catch (error) { console.info(`MediaLibraryTest : getFileAssets 003 failed, error: ${error}`); @@ -314,7 +307,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext){ const fetchFileResult = await media.getFileAssets(fileRelativefetchOp); let count = 1; let type = 'file'; - await checkFileAssetAttr(done, fetchFileResult, type, count) + await checkFileAssetAttr(done, fetchFileResult, type, count, null) done(); } catch (error) { console.info(`MediaLibraryTest : getFileAssets 004 failed, error: ${error}`); diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets index fd02fbd59367c442c3bf99fcedb716fc45a40cb0..cf6a0a0df8303bbee606cd3b54e90a8adc0d0470 100644 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets +++ b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets @@ -70,7 +70,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) expect(conut > 0).assertTrue(); @@ -104,7 +104,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) expect(conut > 0).assertTrue(); @@ -138,7 +138,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) expect(conut > 0).assertTrue(); @@ -172,7 +172,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) expect(conut > 0).assertTrue(); @@ -206,7 +206,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) expect(conut == 0).assertTrue(); @@ -242,7 +242,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) expect(conut == 0).assertTrue(); @@ -278,7 +278,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) expect(conut == 0).assertTrue(); @@ -309,7 +309,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ }); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 300) }) const fetchFileResult = await media.getFileAssets(imagesfetchOp); @@ -318,13 +318,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ media.off('imageChange'); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 600) }) await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) console.info('MediaLibraryTest : off 001 passed'); @@ -356,7 +356,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ }); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 300) }) const fetchFileResult = await media.getFileAssets(videosfetchOp); @@ -365,13 +365,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ media.off('videoChange'); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 600) }) await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) console.info('MediaLibraryTest : off 002 passed'); @@ -403,7 +403,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ }); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 300) }) const fetchFileResult = await media.getFileAssets(audiosfetchOp); @@ -412,13 +412,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ media.off('audioChange'); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 600) }) await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) console.info('MediaLibraryTest : off 003 passed'); @@ -450,7 +450,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ }); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 300) }) const fetchFileResult = await media.getFileAssets(videosfetchOp); @@ -459,13 +459,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ media.off('fileChange'); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 600) }) await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) console.info('MediaLibraryTest : off 004 passed'); @@ -497,7 +497,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ }); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 300) }) const fetchFileResult = await media.getFileAssets(videosfetchOp); @@ -506,13 +506,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ media.off('albumChange'); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 600) }) await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) console.info('MediaLibraryTest : off 005 passed'); @@ -544,7 +544,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ }); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 300) }) const fetchFileResult = await media.getFileAssets(videosfetchOp); @@ -553,13 +553,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ media.off('deviceChange'); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 600) }) await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) console.info('MediaLibraryTest : off 006 passed'); @@ -591,7 +591,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ }); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 300) }) @@ -601,13 +601,13 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext){ asset.title = asset.title + 'remoteFileChange'; await new Promise(res => { setTimeout(() => { - res() + res(true) }, 600) }) await asset.commitModify(); await new Promise(res => { setTimeout(() => { - res() + res(true) }, 1000) }) console.info('MediaLibraryTest : off 007 passed'); diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js old mode 100755 new mode 100644 index e1aba5080421eaa49c675ee07404ea72386ea21b..276ba4689085eab2ee4d1b671e91e28d2ebbb95f --- a/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js +++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/default/test/AccessToken.test.js @@ -142,4 +142,73 @@ describe('AccessTokenTest', function () { done(); }) + + /** + * @tc.number Test_verifyAccessTokenSync_0000 + * @tc.name Test_verifyAccessTokenSync_000. + * @tc.desc Test verifyAccessTokenSync, After the installation, user_grant permission is not granted by default. + */ + it('Test_verifyAccessTokenSync_000', 0, function(){ + console.info("Test_verifyAccessTokenSync_000 start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = atManager.verifyAccessTokenSync(tokenID, permissionNameUser); + console.info("Test_verifyAccessTokenSync_000 tokenID" + tokenID + "-" + result) + expect(result).assertEqual(GrantStatus.PERMISSION_DENIED); + }) + + /** + * @tc.number Test_verifyAccessTokenSync_0100 + * @tc.name Test_verifyAccessTokenSync_001. + * @tc.desc Test verifyAccessTokenSync, After the installation, system_grant permission is granted by default. + */ + it('Test_verifyAccessTokenSync_001', 0, function(){ + console.info("Test_verifyAccessTokenSync_001 start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = atManager.verifyAccessTokenSync(tokenID, permissionNameSystem); + console.info("Test_verifyAccessTokenSync_001 tokenID" + tokenID + "-" + result) + expect(result).assertEqual(GrantStatus.PERMISSION_GRANTED); + }) + + /** + * @tc.number Test_verifyAccessTokenSync_0200 + * @tc.name Test_verifyAccessTokenSync_002. + * @tc.desc Test verifyAccessTokenSync, invalid TokenID(0). + */ + it('Test_verifyAccessTokenSync_002', 0, function(){ + console.info("Test_verifyAccessTokenSync_002 start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = atManager.verifyAccessTokenSync(0, permissionNameUser); + console.info("Test_verifyAccessTokenSync_002 tokenID" + tokenID + "-" + result) + expect(result).assertEqual(GrantStatus.PERMISSION_DENIED); + }) + + /** + * @tc.number Test_verifyAccessTokenSync_0300 + * @tc.name Test_verifyAccessTokenSync_003. + * @tc.desc Test verifyAccessTokenSync, invalid permission(empty). + */ + it('Test_verifyAccessTokenSync_003', 0, function(){ + console.info("Test_verifyAccessTokenSync_003 start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = atManager.verifyAccessTokenSync(tokenID, ""); + console.info("Test_verifyAccessTokenSync_003 tokenID" + tokenID + "-" + result) + expect(result).assertEqual(GrantStatus.PERMISSION_DENIED); + }) + + /** + * @tc.number Test_verifyAccessTokenSync_0400 + * @tc.name Test_verifyAccessTokenSync_004. + * @tc.desc Test verifyAccessTokenSync, invalid permission(length exceeds 256). + */ + it('Test_verifyAccessTokenSync_004', 0, function(){ + console.info("Test_verifyAccessTokenSync_004 start"); + var atManager = abilityAccessCtrl.createAtManager(); + var permissionName = "ohos.permission.testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest" + + "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest" + + "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest"; + + var result = atManager.verifyAccessTokenSync(tokenID, permissionName); + console.info("Test_verifyAccessTokenSync_004 tokenID" + tokenID + "-" + result) + expect(result).assertEqual(GrantStatus.PERMISSION_DENIED); + }) }) diff --git a/telephony/telephonyjstest/netmanager_base/dns/Test.json b/telephony/telephonyjstest/netmanager_base/dns/Test.json index e0d8ef8a0d800fc4424af33024108fb8c29d134f..3ad5aa31cfdf9ef66c312400efff3bd1c5f7ddae 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/Test.json +++ b/telephony/telephonyjstest/netmanager_base/dns/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.dns", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/Test.json b/telephony/telephonyjstest/netmanager_base/jshttp/Test.json index c09c93e8521456fd8678f2a3d90bf070c5bf2b50..05f25c764ae46670f4a5c3dc2cafd6713c044e0a 100644 --- a/telephony/telephonyjstest/netmanager_base/jshttp/Test.json +++ b/telephony/telephonyjstest/netmanager_base/jshttp/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.jshttp", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/entry/src/main/js/test/NetworkManagerHttp.test.js b/telephony/telephonyjstest/netmanager_base/jshttp/entry/src/main/js/test/NetworkManagerHttp.test.js index 51a68b3f48e6e0b7c77f0447db0521bd3cb53eba..eea4ef00df41e2c76aa338cfe15320e598c511d5 100644 --- a/telephony/telephonyjstest/netmanager_base/jshttp/entry/src/main/js/test/NetworkManagerHttp.test.js +++ b/telephony/telephonyjstest/netmanager_base/jshttp/entry/src/main/js/test/NetworkManagerHttp.test.js @@ -42,6 +42,7 @@ describe('Telephony_NETSTACK_HTTPTest',function(){ let http = netHttp.createHttp() http.request("https://httpbin.org/user-agent").then(function(data){ expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue(); + console.info(JSON.stringify(data)); expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); done(); }) diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json index d7233dc4ef835a9676ac2a8fedcd2104216ce0a0..79882ec7b93e4c975671840862463134c9e1aec4 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.network_nopermission", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/network_wifi/Test.json b/telephony/telephonyjstest/netmanager_base/network_wifi/Test.json index 61ebec364ea70f6f580ab07d6235e817ddbfc1ab..b0b262dd1125811932f5ca640048193a07576e9a 100644 --- a/telephony/telephonyjstest/netmanager_base/network_wifi/Test.json +++ b/telephony/telephonyjstest/netmanager_base/network_wifi/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.network_wifi", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js b/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js index 1e4f84680c4841794adad0c345d1d9bb4c23085e..5a7b7af1b646ae7ae292bd88592be3d98f70fd7e 100644 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js +++ b/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js @@ -40,6 +40,9 @@ function sleepOther(timeout) { for (var t = Date.now(); Date.now() - t <= timeout;) ; } + function sleep(time) { + return new Promise((resolve)=>setTimeout(resolve,time)); + } /** *@tc.number Telephony_NetworkManager_register_Async_0100 @@ -229,13 +232,13 @@ console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); } }); - netConn.on('netBlockStatusChange', (error, value) => { + netConn.on('netCapabilitiesChange', (error, value) => { if (error) { console.info(`${caseName} register fail: ${error}`); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { @@ -2497,7 +2500,7 @@ expect().assertFail(); done(); } - + await sleep(1000); done(); }); done(); diff --git a/telephony/telephonyjstest/netmanager_base/socket/entry/src/main/js/test/NetStackSocket.test.js b/telephony/telephonyjstest/netmanager_base/socket/entry/src/main/js/test/NetStackSocket.test.js index f92d99872e3bca1705eb0e5d5dabcebd14346c28..ecddf4d11d9ea2977e42e845e85259eaad964ebb 100644 --- a/telephony/telephonyjstest/netmanager_base/socket/entry/src/main/js/test/NetStackSocket.test.js +++ b/telephony/telephonyjstest/netmanager_base/socket/entry/src/main/js/test/NetStackSocket.test.js @@ -227,6 +227,14 @@ describe('Telephony_NETSTACK_SocketTest', function () { it('Telephony_NetStack_UDPTest1200', 0, function (done) { let udp = netSocket.constructUDPSocketInstance() + udp.on('message', function () { + }) + udp.on('listening', function () { + }) + udp.on('close', function () { + }) + udp.on('error', function () { + }) udp.off('message', function () { expect().assertFail() done() @@ -246,9 +254,6 @@ describe('Telephony_NETSTACK_SocketTest', function () { done() }); - - - /** * @tc.number Telephony_NetStack_TCPTest0100 * @tc.name TCP bind,callback方式,预计无异常,错误码为undefined @@ -423,7 +428,7 @@ describe('Telephony_NETSTACK_SocketTest', function () { expect().assertFail() done() }) - tcp.on('listening', function () { + tcp.on('connect', function () { expect().assertFail() done() }) @@ -446,11 +451,19 @@ describe('Telephony_NETSTACK_SocketTest', function () { it('Telephony_NetStack_TCPTest1200', 0, function (done) { let tcp = netSocket.constructTCPSocketInstance() + tcp.on('message', function () { + }) + tcp.on('connect', function () { + }) + tcp.on('close', function () { + }) + tcp.on('error', function () { + }) tcp.off('message', function () { expect().assertFail() done() }) - tcp.off('listening', function () { + tcp.off('connect', function () { expect().assertFail() done() }) diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json b/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json index 08058699b9ec9664911c956b61d707c3d3a45305..3ccd069b60940bd4dc345d6bc05edf61c2e8ed79 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.system_fetch", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js b/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js index 127dd2339aa0c969e09a1ab9e104633e066ba58e..bbfd487b87c355f85a0d6aff6887fab8556832b4 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js @@ -18,7 +18,7 @@ import NetHttp from '@ohos.net.http'; import fetch from '@system.fetch'; import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; -describe("Telephony_NetStack_HttpTest", function () { +describe("Telephony_NetStack_HttpFetchTest", function () { /** * @tc.number Telephony_NetStack_HttpTestBasicGet_0100 @@ -44,7 +44,7 @@ describe("Telephony_NetStack_HttpTest", function () { http.request("https://httpbin.org/user-agent").then(function(data){ console.info("NetStack "+ JSON.stringify(data)); expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue() + expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); done(); }) }); @@ -174,7 +174,7 @@ describe("Telephony_NetStack_HttpTest", function () { success : function(data){ console.info("NetStack fetch success "+ JSON.stringify(data)) expect(data.code === 200).assertTrue() - expect(JSON.parse(data.data)["user-agent"] === "libcurl-agent/1.0").assertTrue() + expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); done(); }, fail : function(){ @@ -200,7 +200,7 @@ describe("Telephony_NetStack_HttpTest", function () { success : function(data){ console.info("NetStack fetch success "+ JSON.stringify(data)) expect(data.code === 200).assertTrue() - expect(data.data["user-agent"] === "libcurl-agent/1.0").assertTrue() + expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); done(); }, fail : function(){ diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js index 8023e4028ec332c3f7abd14f86bf44c192ab3a1c..35cbf44c9ccb3a53ca37f075f9ac446755412681 100644 --- a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js +++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js @@ -172,7 +172,7 @@ describe('ActsNetworkSearchTest', function () { radio.getISOCountryCodeForNetwork(SLOT_2, (err, data) => { if (err) { console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 fail err: ${err}`); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); return; } @@ -196,7 +196,7 @@ describe('ActsNetworkSearchTest', function () { expect(data.length === 0).assertTrue(); } catch (err) { console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err: ${err}`); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); return; } diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js index 63e03e8b5a4ec83f2d0621e56d9afd50701f019d..ea2afa90f6474ad0dc226ecab67eb0fd8d15b686 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js @@ -268,7 +268,7 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700'; sim.isSimActive(env.SLOTID2, (err, data) => { console.info("isSimActive async err info :" + JSON.stringify(err) + "data:" + JSON.stringify(data)); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); }); }); @@ -288,7 +288,7 @@ describe('SimManagerTest', function () { done(); }).catch(err => { console.info("isSimActive promise err info :" + JSON.stringify(err)); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); }); }); @@ -303,7 +303,7 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600'; sim.hasSimCard(env.SLOTID2, (err, data) => { if (err) { - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); console.info(`${CASE_NAME} fail, err: ${err.message}`); done(); return; @@ -323,7 +323,7 @@ describe('SimManagerTest', function () { try { let data = await sim.hasSimCard(env.SLOTID2); } catch (err) { - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); console.info(`${CASE_NAME} fail, err: ${err.message}`); done(); return; @@ -355,7 +355,7 @@ describe('SimManagerTest', function () { sim.getCardType(env.SLOTID2, (err, cardType) => { if (err) { console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); return; } @@ -376,7 +376,7 @@ describe('SimManagerTest', function () { console.info(`${CASE_NAME} test finish.`); } catch (err) { console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); } done(); });