提交 466888d4 编写于 作者: Y yaocui

Merge branch 'master' of https://gitee.com/yaocui_moring/xts_acts

......@@ -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====<begin');
var subscriber;
var id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppB:onCreateonForeground",
let subscriber;
let id;
let result;
let checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppB:onCreateonForeground",
"AppA:onForegroundonAcceptWantCalledId1"];
var checkIndex = 0;
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppB:onCreateonForeground",
let checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId3", "AppB:onCreateonForeground",
"AppA:onCreateonForegroundonAcceptWantCalledId2"];
var checkIndex = 0;
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppC:onCreateonForeground",
let result;
let checkEventResults = ["AppA:onForegroundonAcceptWantCalledId1", "AppC:onCreateonForeground",
"AppA:onForegroundonAcceptWantCalledId1"];
var checkIndex = 0;
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppC:onCreateonForeground",
"AppA:onCreateonForegroundonAcceptWantCalledId2"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppA:onForegroundonAcceptWantCalledId3", "AppC:onForeground",
"AppA:onForegroundonAcceptWantCalledId2"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1",
"AppA:onCreateonForegroundonAcceptWantCalledId2"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppA:onForegroundonAcceptWantCalledId1",
"AppA:onForegroundonAcceptWantCalledId2"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppB:onCreateonForeground",
"AppC:onCreateonForeground", "AppA:onForegroundonAcceptWantCalledId1"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppA:onForegroundonAcceptWantCalledId1", "AppB:onCreateonForeground",
"AppC:onForeground", "AppA:onForegroundonAcceptWantCalledId1"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppB:onCreateonForeground",
"AppC:onCreateonForeground", "AppA:onCreateonForegroundonAcceptWantCalledId2"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppA:onForegroundonAcceptWantCalledId3", "AppB:onCreateonForeground",
"AppC:onForeground", "AppA:onCreateonForegroundonAcceptWantCalledId2"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppB:onCreateonForeground", "AppA:onCreateonForegroundonAcceptWantCalledId1",
"AppC:onCreateonForeground", "AppA:onForegroundonAcceptWantCalledId1"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppB:onCreateonForeground", "AppA:onForegroundonAcceptWantCalledId1",
"AppC:onForeground", "AppA:onForegroundonAcceptWantCalledId1"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppB:onCreateonForeground", "AppA:onCreateonForegroundonAcceptWantCalledId1",
"AppC:onCreateonForeground", "AppA:onCreateonForegroundonAcceptWantCalledId2"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppB:onCreateonForeground", "AppA:onForegroundonAcceptWantCalledId1",
"AppC:onForeground", "AppA:onForegroundonAcceptWantCalledId2"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppD:onCreateonForegroundonAcceptWantCalledId1", "AppD:onCreateonForeground",
let result;
let checkEventResults = ["AppD:onCreateonForegroundonAcceptWantCalledId1", "AppD:onCreateonForeground",
"AppD:onCreateonForeground", "AppD:onForegroundonAcceptWantCalledId1"];
var checkIndex = 0;
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppD:onCreateonForegroundonAcceptWantCalledId1", "AppD:onCreateonForeground",
"AppD:onCreateonForeground", "AppD:onCreateonForegroundonAcceptWantCalledId2"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppD:onCreateonForegroundonAcceptWantCalledId2", "AppD:onCreateonForeground",
"AppD:onForeground", "AppD:onForegroundonAcceptWantCalledId1"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppB:onCreateonForeground", "AppB:onCreateonForeground"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppB:onCreateonForeground", "AppB:onCreateonForeground"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppE:onInitonShow", "AppA:onCreateonForegroundonAcceptWantCalledId1"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppE:onInitonShow", "AppA:onForegroundonAcceptWantCalledId1"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId1", "AppE:onInitonShow"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppA:onForegroundonAcceptWantCalledId2", "AppE:onInitonShow"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId-1"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId-1"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>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====<begin');
var subscriber;
let subscriber;
let id;
var result;
var checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId-2"];
var checkIndex = 0;
let result;
let checkEventResults = ["AppA:onCreateonForegroundonAcceptWantCalledId-2"];
let checkIndex = 0;
function subscribeCallBack(err, data) {
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
......
......@@ -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){
......
......@@ -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){
......
......@@ -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",
]
}
......@@ -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"
......
......@@ -10,7 +10,7 @@
"kits": [
{
"test-file-name": [
"AceEtsComponentTest.hap"
"ActsAceEtsComponentTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -17,7 +17,11 @@
@Entry
@Component
struct GlobalExample {
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
onPageShow() {
console.info("global page called")
}
build() {
......
......@@ -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))
}
})
......
......@@ -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"
......
......@@ -10,7 +10,7 @@
"kits": [
{
"test-file-name": [
"AceEtsComponentFiveTest.hap"
"ActsAceEtsComponentFiveTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -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();
});
})
......
......@@ -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"
......
......@@ -10,7 +10,7 @@
"kits": [
{
"test-file-name": [
"AceEtsComponentFourTest.hap"
"ActsAceEtsComponentFourTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -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')
})
......
......@@ -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)
......
......@@ -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
......
......@@ -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();
});
......
......@@ -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"
......
......@@ -10,7 +10,7 @@
"kits": [
{
"test-file-name": [
"AceEtsComponentThreeTest.hap"
"ActsAceEtsComponentThreeTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -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);
......
......@@ -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:('
......
......@@ -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,
......
......@@ -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"
......
......@@ -10,7 +10,7 @@
"kits": [
{
"test-file-name": [
"AceEtsComponentTwoTest.hap"
"ActsAceEtsComponentTwoTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -48,6 +48,7 @@ struct LoadingProgressExample {
.width('90%')
.key('LP')
LoadingProgress()
.height(50)
.color(Color.Black)
}.width('100%').margin({ top: 6 })
}
......
......@@ -70,7 +70,6 @@ struct PageTransitionExample1 {
onPageShow() {
console.info('active page show called');
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
var stateChangeEventOne = {
eventId: 145,
......
......@@ -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));
......
......@@ -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);
......
......@@ -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 {
......
......@@ -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)
......
......@@ -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();
});
......
......@@ -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")
......
......@@ -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();
});
......
......@@ -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) {
......
......@@ -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",
......
......@@ -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" ]
......
......@@ -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",
......
......@@ -118,7 +118,7 @@ export default {
style3:styleValue3,
style4:styleValue4,
style5:styleValue5,
style6:styleValue6,
style6:styleValue6
}
},
......
......@@ -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",
......
......@@ -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
......
......@@ -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 = [
......
/*
* 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
......
/*
* 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);
......
/*
* 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);
......
/*
* 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));
......
/*
* 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();
......
/*
* 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
......
......@@ -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"
}
......@@ -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",
]
......
......@@ -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
......@@ -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 = [
......
......@@ -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');
......
# 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"
}
{
"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
{
"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
}
}
]
}
}
/*
* 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');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of 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.
*/
.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;
}
}
<!--
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.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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
/*
* 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
/*
* 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
/*
* 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);
})
})
/*
* 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();
}
/*
* 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
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
......@@ -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)
}
......@@ -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 -------------------------
});
}
......
......@@ -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');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册