提交 a4ae1ed7 编写于 作者: C caochuan

XTS Split 0813

 fix mediaLibrary_file Promise
Signed-off-by: Ncaochuan <weiyufeng@neusoft.com>
上级 0fe6018e
......@@ -37,6 +37,7 @@ group("multimedia") {
"media/media_js_standard/videoPlayer:video_player_js_hap",
"medialibrary/mediaLibrary_album:mediaLibrary_album_hap",
"medialibrary/mediaLibrary_favorite:mediaLibrary_favorite_hap",
"medialibrary/mediaLibrary_file:mediaLibrary_file_hap",
"medialibrary/mediaLibrary_fileAsset:mediaLibrary_fileAsset_hap",
"medialibrary/mediaLibrary_fileKey:mediaLibrary_fileKey_hap",
"medialibrary/mediaLibrary_fileResult:mediaLibrary_fileResult_hap",
......
{
"app":{
"bundleName":"ohos.acts.multimedia.mediaLibrary",
"vendor":"huawei",
"versionCode":1000000,
"versionName":"1.0.0",
"debug":false,
"icon":"$media:icon",
"label":"$string:entry_MainAbility",
"description":"$string:mainability_description",
"distributedNotificationEnabled":true,
"keepAlive":true,
"singleUser":true,
"minAPIVersion":8,
"targetAPIVersion":8,
"car":{
"apiCompatibleVersion":8,
"singleUser":false
}
}
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "MediaLibraryJSTestMain"
},
{
"name": "mainability_description",
"value": "MediaLibraryJSTestMain Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 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("mediaLibrary_file_hap") {
hap_profile = "entry/src/main/module.json"
deps = [
":mediaLibrary_js_assets",
":mediaLibrary_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsMediaLibraryFile"
}
ohos_app_scope("medialibrary_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("mediaLibrary_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("mediaLibrary_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":medialibrary_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for mediaLibrary Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "300000",
"package": "ohos.acts.multimedia.mediaLibrary",
"shell-timeout": "600000"
},
"kits": [
{
"type": "ShellKit",
"pre-push": [
],
"run-command": [
"rm -rf /storage/media/100/local/files/*",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}",
"mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata"
]
},
{
"type": "PushKit",
"pre-push": [
],
"push": [
"./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata",
"./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata",
"./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata",
"./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata"
]
},
{
"type": "ShellKit",
"run-command": [
"mkdir -pv /storage/media/100/local/files/Pictures/{Static,Dynamic}",
"mkdir -pv /storage/media/100/local/files/Videos/{Static,Dynamic}",
"mkdir -pv /storage/media/100/local/files/Audios/{Static,Dynamic}",
"mkdir -pv /storage/media/100/local/files/Documents/{Static,Dynamic}",
"for d in Static; do for i in $$(seq 6); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;",
"for d in Static; do for i in $$(seq 6); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;",
"for d in Static; do for i in $$(seq 6); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;",
"for d in Static; do for i in $$(seq 6); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;",
"cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/Dynamic/01.jpg",
"cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/Dynamic/01.mp4",
"cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/Dynamic/01.mp3",
"cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/Dynamic/01.dat",
"chmod -R 777 /storage/media/100/local/files/*",
"chmod -R 777 /data/service/el2/100/hmdfs/account/files/*",
"hilog -Q pidoff",
"hilog -p off",
"hilog -b D -D 0xD002B70",
"scanner_demo",
"sleep 10"
]
},
{
"test-file-name": [
"ActsMediaLibraryFile.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
import AbilityStage from "@ohos.application.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
console.log("[Demo] MyAbilityStage onCreate")
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onCreate(want,launchParam){
// Ability is creating, initialize resources for this ability
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
}
onDestroy() {
// Ability is destroying, release resources for this ability
console.log("[Demo] MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
}
onWindowStageDestroy() {
//Main window is destroyed, release UI related resources
console.log("[Demo] MainAbility onWindowStageDestroy")
}
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}
};
\ No newline at end of file
/*
* Copyright (c) 2021 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 {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import testsuite from "../../test/List.test.ets"
@Entry
@Component
struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
const reportExtend = new ReportExtend(file)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters))
globalThis.abilityWant.parameters.timeout = 70000;
configService.setConfig(globalThis.abilityWant.parameters)
console.info('testsuite()---->')
testsuite(globalThis.abilityContext)
core.execute()
console.info('core.execute()---->')
}
build() {
Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 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 router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ 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 fileTestPromise from './fileTestPromise.test.ets'
export default function testsuite(abilityContext) {
fileTestPromise(abilityContext)
}
......@@ -14,64 +14,36 @@
*/
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
import {
sleep,
IMAGE_TYPE,
VIDEO_TYPE,
AUDIO_TYPE,
FILE_TYPE,
checkPresetsAssets,
nameFetchOps,
checkAssetsCount,
getPermission,
fetchOps,
FILEKEY,
isNum,
} from '../../../../../../common';
let fileKeyObj = mediaLibrary.FileKey;
let fileType = mediaLibrary.MediaType.FILE;
let imageType = mediaLibrary.MediaType.IMAGE;
let videoType = mediaLibrary.MediaType.VIDEO;
let audioType = mediaLibrary.MediaType.AUDIO;
let imagesfetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: ['Pictures/Dynamic01/', imageType.toString()],
};
let videosfetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: ['Videos/Dynamic01/', videoType.toString()],
};
let audiosfetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: ['Audios/Dynamic01/', audioType.toString()],
};
let filesfetchOp = {
selections: fileKeyObj.RELATIVE_PATH + '= ? AND ' + fileKeyObj.MEDIA_TYPE + '= ?',
selectionArgs: ['Documents/Dynamic01/', fileType.toString()],
};
function checkAssetAttr(done, attr, testNum, asset, checkType) {
if (checkType && asset[attr] != checkType) {
console.info(`ASSET_PROMISE getFileAssets ${testNum} failed`);
expect(false).assertTrue();
done();
} else if (asset[attr] == undefined) {
console.info(`ASSET_PROMISE getFileAssets ${testNum} failed`);
expect(false).assertTrue();
done();
}
}
let path;
let presetAsset;
let displayName;
let id;
let mediaType;
let orientation = 0;
export default function fileTestPromiseTest(abilityContext){
export default function fileTestPromiseTest(abilityContext) {
describe('fileTestPromiseTest', function () {
var context = featureAbility.getContext();
console.info('getMediaLibrary IN');
var media = mediaLibrary.getMediaLibrary(abilityContext);
console.info('getMediaLibrary OUT');
beforeAll(function () { });
const media = mediaLibrary.getMediaLibrary(abilityContext);
beforeAll(async function () {
await getPermission();
await checkPresetsAssets(media, 'ActsMediaLibraryFile')
});
beforeEach(function () { });
afterEach(async function () { await sleep(200)});
afterEach(async function () {
await sleep()
});
afterAll(function () { });
async function copyFile(fd1, fd2) {
......@@ -80,50 +52,112 @@ export default function fileTestPromiseTest(abilityContext){
await fileio.read(fd1, buf);
await fileio.write(fd2, buf);
}
// ------------------------------- image type start ----------------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_01
* @tc.name : createAsset
* @tc.desc : Insert two database records, read a unique identifier, expectations are not equal
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_01', 0, async function (done) {
const creatAssetTest = async (done, testNum, fetchOp, path, type, name) => {
try {
path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE);
const fileAssets = await media.getFileAssets(imagesfetchOp);
const dataList = await fileAssets.getAllObject();
const asset1 = dataList[0];
presetAsset = asset1;
const creatAsset1 = await media.createAsset(
imageType,
`${new Date().getTime()}.jpg`,
path
);
const fd1 = await asset1.open('rw');
const fetchFileResult = await media.getFileAssets(fetchOp);
console.info(`${testNum} fetchOp: ${JSON.stringify(fetchOp)}`)
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchFileResult, 1);
if (!checkAssetCountPass) return;
const asset = await fetchFileResult.getFirstObject();
let displayName1 = `${new Date().getTime()}.${name}`;
const creatAsset1 = await media.createAsset(type, displayName1, path);
const fd = await asset.open('rw');
const creatAssetFd1 = await creatAsset1.open('rw');
await copyFile(fd1, creatAssetFd1);
await copyFile(fd, creatAssetFd1);
await creatAsset1.close(creatAssetFd1);
await asset1.close(fd1);
displayName = `${new Date().getTime()}.jpg`;
const asset2 = dataList[1];
const creatAsset2 = await media.createAsset(imageType, displayName, path);
const fd2 = await asset2.open('rw');
let displayName2 = `${new Date().getTime()}.${name}`;
const creatAsset2 = await media.createAsset(type, displayName2, path);
const creatAssetFd2 = await creatAsset2.open('rw');
await copyFile(fd2, creatAssetFd2);
await copyFile(fd, creatAssetFd2);
await creatAsset2.close(creatAssetFd2);
await asset2.close(fd2);
id = creatAsset2.id;
mediaType = imageType;
await asset.close(fd);
expect(creatAsset1.id != creatAsset2.id).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 001_01 failed, message = ' + error);
console.info(`${testNum} failed error: ${error}`)
expect(false).assertTrue();
done();
}
}
const checkCreatAssetProps = async (done, testNum, fetchOp, path, type, name, key, val) => {
try {
const fetchFileResult = await media.getFileAssets(fetchOp);
console.info(`${testNum} fetchOp: ${JSON.stringify(fetchOp)}`)
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchFileResult, 1);
if (!checkAssetCountPass) return;
const asset = await fetchFileResult.getFirstObject();
let displayName = `${new Date().getTime()}.${name}`;
const creatAsset = await media.createAsset(type, displayName, path);
const fd = await asset.open('rw');
const creatAssetFd = await creatAsset.open('rw');
await copyFile(fd, creatAssetFd);
await creatAsset.close(creatAssetFd);
if (val == 'displayName') {
val = displayName
}
expect(creatAsset[key]).assertEqual(val);
done();
} catch (error) {
console.info(`${testNum} failed error: ${error}`)
expect(false).assertTrue();
done();
}
}
const checkdateModified = async (done, testNum, fetchOp) => {
try {
let fetchFileResult = await media.getFileAssets(fetchOp);
console.info(`${testNum} fetchOp: ${JSON.stringify(fetchOp)}`)
let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchFileResult, 1);
if (!checkAssetCountPass) return;
let asset = await fetchFileResult.getFirstObject();
asset.title = `title_${new Date().getTime()}`;
await asset.commitModify();
const id = asset.id;
const idOP = { selections: FILEKEY.ID + '= ?', selectionArgs: ['' + id] };
fetchFileResult = await media.getFileAssets(idOP);
let newAsset = await fetchFileResult.getFirstObject();
expect(isNum(newAsset.dateModified)).assertTrue();
expect(newAsset.dateModified != asset.dateModified).assertTrue()
done();
} catch (error) {
console.info(`${testNum} failed error: ${error}`)
expect(false).assertTrue();
done();
}
}
// ------------------------------- image type start ----------------------------
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_01
* @tc.name : createAsset
* @tc.desc : Insert two database records, read a unique identifier, expectations are not equal
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_01', 0, async function (done) {
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_01';
let currentFetchOp = nameFetchOps('Pictures/Static/', '01', IMAGE_TYPE)
let name = 'jpg'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE) + '/create/'
let type = IMAGE_TYPE;
await creatAssetTest(done, testNum, currentFetchOp, path, type, name)
});
/**
......@@ -135,16 +169,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_02', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.displayName == displayName).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 001_02 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_02';
let currentFetchOp = nameFetchOps('Pictures/Static/', '02', IMAGE_TYPE)
let name = 'jpg'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE) + '/create/';
let type = IMAGE_TYPE;
let key = 'displayName';
let val = 'displayName';
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -156,15 +188,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_03', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 001_03 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_03';
let currentFetchOp = nameFetchOps('Pictures/Static/', '03', IMAGE_TYPE)
let name = 'jpg'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE) + '/create/';
let type = IMAGE_TYPE;
let key = 'relativePath';
let val = path;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -176,40 +207,9 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_07', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(imagesfetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
asset.title = `title_${new Date().getTime()}`;
await asset.commitModify();
const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0];
if (asset.dateModified != undefined) {
if (newAsset.dateModified != asset.dateModified) {
console.info('ASSET_PROMISE getFileAssets 001_07 passed');
expect(true).assertTrue();
done();
} else {
console.info('ASSET_PROMISE getFileAssets 001_07 failed');
expect(false).assertTrue();
done();
}
} else if (newAsset.dateModified != undefined) {
console.info('ASSET_PROMISE getFileAssets 001_07 passed');
expect(true).assertTrue();
done();
} else {
console.info('ASSET_PROMISE getFileAssets 001_07 failed');
expect(false).assertTrue();
done();
}
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 001_07 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_07';
let currentFetchOp = fetchOps('Pictures/Dynamic/', IMAGE_TYPE)
await checkdateModified(done, testNum, currentFetchOp)
});
/**
......@@ -221,15 +221,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_08', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 001_08 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_08';
let currentFetchOp = nameFetchOps('Pictures/Static/', '04', IMAGE_TYPE)
let name = 'jpg'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE) + '/create/';
let type = IMAGE_TYPE;
let key = 'mediaType';
let val = IMAGE_TYPE;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -241,15 +240,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_11', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.orientation == orientation).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 001_11 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_001_11';
let currentFetchOp = nameFetchOps('Pictures/Static/', '05', IMAGE_TYPE)
let name = 'jpg'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_IMAGE) + '/create/';
let type = IMAGE_TYPE;
let key = 'orientation';
let val = 0;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
// ------------------------------- image type end -----------------------------
......@@ -264,39 +262,12 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_01', 0, async function (done) {
try {
path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
const fileAssets = await media.getFileAssets(videosfetchOp);
const dataList = await fileAssets.getAllObject();
const asset1 = dataList[0];
const creatAsset1 = await media.createAsset(
videoType,
`${new Date().getTime()}.mp4`,
path
);
const fd1 = await asset1.open('rw');
const creatAssetFd1 = await creatAsset1.open('rw');
await copyFile(fd1, creatAssetFd1);
await creatAsset1.close(creatAssetFd1);
await asset1.close(fd1);
displayName = `${new Date().getTime()}.mp4`;
const asset2 = dataList[0];
const creatAsset2 = await media.createAsset(videoType, displayName, path);
const fd2 = await asset2.open('rw');
const creatAssetFd2 = await creatAsset2.open('rw');
await copyFile(fd2, creatAssetFd2);
await creatAsset2.close(creatAssetFd2);
await asset2.close(fd2);
id = creatAsset2.id;
mediaType = videoType;
expect(creatAsset1.id != creatAsset2.id).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 002_01 failed' + error);
expect(false).assertTrue();
done();
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_01';
let currentFetchOp = nameFetchOps('Videos/Static/', '01', VIDEO_TYPE)
let name = 'mp4'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO) + '/create/'
let type = VIDEO_TYPE;
await creatAssetTest(done, testNum, currentFetchOp, path, type, name)
});
/**
......@@ -308,16 +279,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_02', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.displayName == displayName).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 002_02 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_02';
let currentFetchOp = nameFetchOps('Videos/Static/', '02', VIDEO_TYPE)
let name = 'mp4'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO) + '/create/';
let type = VIDEO_TYPE;
let key = 'displayName';
let val = 'displayName';
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -329,16 +298,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_03', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 002_03 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_03';
let currentFetchOp = nameFetchOps('Videos/Static/', '03', VIDEO_TYPE)
let name = 'mp4'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO) + '/create/';
let type = VIDEO_TYPE;
let key = 'relativePath';
let val = path;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -350,40 +317,9 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_07', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(videosfetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
asset.title = `title_${new Date().getTime()}`;
await asset.commitModify();
const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0];
if (asset.dateModified != undefined) {
if (newAsset.dateModified != asset.dateModified) {
console.info('ASSET_PROMISE getFileAssets 002_07 passed');
expect(true).assertTrue();
done();
} else {
console.info('ASSET_PROMISE getFileAssets 002_07 failed');
expect(false).assertTrue();
done();
}
} else if (newAsset.dateModified != undefined) {
console.info('ASSET_PROMISE getFileAssets 002_07 passed');
expect(true).assertTrue();
done();
} else {
console.info('ASSET_PROMISE getFileAssets 002_07 failed');
expect(false).assertTrue();
done();
}
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 002_07 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_07';
let currentFetchOp = fetchOps('Videos/Dynamic/', VIDEO_TYPE)
await checkdateModified(done, testNum, currentFetchOp)
});
/**
......@@ -395,15 +331,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_08', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 002_08 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_08';
let currentFetchOp = nameFetchOps('Videos/Static/', '04', VIDEO_TYPE)
let name = 'mp4'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO) + '/create/';
let type = VIDEO_TYPE;
let key = 'mediaType';
let val = VIDEO_TYPE;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -415,15 +350,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_11', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.orientation == orientation).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 002_11 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_002_11';
let currentFetchOp = nameFetchOps('Videos/Static/', '05', VIDEO_TYPE)
let name = 'mp4'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO) + '/create/';
let type = VIDEO_TYPE;
let key = 'orientation';
let val = 0;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
// ------------------------------- video type end -----------------------------
......@@ -437,38 +371,12 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_01', 0, async function (done) {
try {
path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_AUDIO);
const fileAssets = await media.getFileAssets(audiosfetchOp);
const dataList = await fileAssets.getAllObject();
const asset1 = dataList[0];
const creatAsset1 = await media.createAsset(
audioType,
`${new Date().getTime()}.mp3`,
path
);
const fd1 = await asset1.open('rw');
const creatAssetFd1 = await creatAsset1.open('rw');
await copyFile(fd1, creatAssetFd1);
await creatAsset1.close(creatAssetFd1);
await asset1.close(fd1);
displayName = `${new Date().getTime()}.mp3`;
const asset2 = dataList[0];
const creatAsset2 = await media.createAsset(audioType, displayName, path);
const fd2 = await asset2.open('rw');
const creatAssetFd2 = await creatAsset2.open('rw');
await copyFile(fd2, creatAssetFd2);
await creatAsset2.close(creatAssetFd2);
await asset2.close(fd2);
id = creatAsset2.id;
mediaType = audioType;
expect(creatAsset1.id != creatAsset2.id).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 003_01 failed');
expect(false).assertTrue();
done();
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_01';
let currentFetchOp = nameFetchOps('Audios/Static/', '01', AUDIO_TYPE)
let name = 'mp3'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_AUDIO) + '/create/'
let type = AUDIO_TYPE;
await creatAssetTest(done, testNum, currentFetchOp, path, type, name)
});
/**
......@@ -480,16 +388,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_02', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.displayName == displayName).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 003_02 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_02';
let currentFetchOp = nameFetchOps('Audios/Static/', '02', AUDIO_TYPE)
let name = 'mp3'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_AUDIO) + '/create/';
let type = AUDIO_TYPE;
let key = 'displayName';
let val = 'displayName';
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -501,15 +407,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_03', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 003_03 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_03';
let currentFetchOp = nameFetchOps('Audios/Static/', '03', AUDIO_TYPE)
let name = 'mp3'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_AUDIO) + '/create/';
let type = AUDIO_TYPE;
let key = 'relativePath';
let val = path;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -521,29 +426,9 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_07', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(audiosfetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
asset.title = `title_${new Date().getTime()}`;
await asset.commitModify();
const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0];
if (asset.dateModified != undefined) {
expect(newAsset.dateModified != asset.dateModified).assertTrue()
done();
} else {
expect(newAsset.dateModified != undefined).assertTrue();
done();
}
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 003_07 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_07';
let currentFetchOp = fetchOps('Audios/Dynamic/', AUDIO_TYPE)
await checkdateModified(done, testNum, currentFetchOp)
});
/**
......@@ -555,15 +440,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_08', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 003_08 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_003_08';
let currentFetchOp = nameFetchOps('Audios/Static/', '05', AUDIO_TYPE)
let name = 'mp3'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_AUDIO) + '/create/';
let type = AUDIO_TYPE;
let key = 'mediaType';
let val = AUDIO_TYPE;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
// ------------------------------- audio type end -----------------------------
......@@ -578,38 +462,12 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_01', 0, async function (done) {
try {
path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOWNLOAD);
const fileAssets = await media.getFileAssets(filesfetchOp);
const dataList = await fileAssets.getAllObject();
const asset1 = dataList[0];
const creatAsset1 = await media.createAsset(
fileType,
`${new Date().getTime()}.bat`,
path
);
const fd1 = await asset1.open('rw');
const creatAssetFd1 = await creatAsset1.open('rw');
await copyFile(fd1, creatAssetFd1);
await creatAsset1.close(creatAssetFd1);
await asset1.close(fd1);
displayName = `${new Date().getTime()}.bat`;
const asset2 = dataList[0];
const creatAsset2 = await media.createAsset(fileType, displayName, path);
const fd2 = await asset2.open('rw');
const creatAssetFd2 = await creatAsset2.open('rw');
await copyFile(fd2, creatAssetFd2);
await creatAsset2.close(creatAssetFd2);
await asset2.close(fd2);
id = creatAsset2.id;
mediaType = fileType;
expect(creatAsset1.id != creatAsset2.id).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 004_01 failed' + error);
expect(false).assertTrue();
done();
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_01';
let currentFetchOp = nameFetchOps('Documents/Static/', '01', FILE_TYPE)
let name = 'dat'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOCUMENTS) + '/create/'
let type = FILE_TYPE;
await creatAssetTest(done, testNum, currentFetchOp, path, type, name)
});
/**
......@@ -621,15 +479,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_02', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.displayName == displayName).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 004_02 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_02';
let currentFetchOp = nameFetchOps('Documents/Static/', '02', FILE_TYPE)
let name = 'dat'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOCUMENTS) + '/create/';
let type = FILE_TYPE;
let key = 'displayName';
let val = 'displayName';
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -641,15 +498,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_03', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.relativePath == path).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 004_03 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_03';
let currentFetchOp = nameFetchOps('Documents/Static/', '03', FILE_TYPE)
let name = 'dat'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOCUMENTS) + '/create/';
let type = FILE_TYPE;
let key = 'relativePath';
let val = path;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
/**
......@@ -661,40 +517,9 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_07', 0, async function (done) {
try {
const fileAssets = await media.getFileAssets(filesfetchOp);
const dataList = await fileAssets.getAllObject();
const asset = dataList[0];
asset.title = `title_${new Date().getTime()}`;
await asset.commitModify();
const id = asset.id;
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const newAssets = await media.getFileAssets(idOP);
const newdataList = await newAssets.getAllObject();
const newAsset = newdataList[0];
if (asset.dateModified != undefined) {
if (newAsset.dateModified != asset.dateModified) {
console.info('ASSET_PROMISE getFileAssets 004_07 passed');
expect(true).assertTrue();
done();
} else {
console.info('ASSET_PROMISE getFileAssets 004_07 failed');
expect(false).assertTrue();
done();
}
} else if (newAsset.dateModified != undefined) {
console.info('ASSET_PROMISE getFileAssets 004_07 passed');
expect(true).assertTrue();
done();
} else {
console.info('ASSET_PROMISE getFileAssets 004_07 failed');
expect(false).assertTrue();
done();
}
} catch (error) {
console.info('ASSET_PROMISE getFileAssets 004_07 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_07';
let currentFetchOp = fetchOps('Documents/Dynamic/', FILE_TYPE)
await checkdateModified(done, testNum, currentFetchOp)
});
/**
......@@ -706,15 +531,14 @@ export default function fileTestPromiseTest(abilityContext){
* @tc.level : Level 0
*/
it('SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_08', 0, async function (done) {
try {
const idOP = { selections: fileKeyObj.ID + '= ?', selectionArgs: ['' + id] };
const fileAssets = await media.getFileAssets(idOP);
const asset = await fileAssets.getFirstObject();
expect(asset.mediaType == mediaType).assertTrue();
done();
} catch (error) {
console.info('ASSET_PROMISE createAsset 004_08 failed, message = ' + error);
}
let testNum = 'SUB_MEDIA_MEDIALIBRARY_CREATEASSET_PROMISE_004_08';
let currentFetchOp = nameFetchOps('Documents/Static/', '04', FILE_TYPE)
let name = 'dat'
let path = await media.getPublicDirectory(mediaLibrary.DirectoryType.DIR_DOCUMENTS) + '/create/';
let type = FILE_TYPE;
let key = 'mediaType';
let val = FILE_TYPE;
await checkCreatAssetProps(done, testNum, currentFetchOp, path, type, name, key, val)
});
// ------------------------------- file type end -----------------------------
......
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:mainability_description",
"mainElement": "MainAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [
{
"name": "ohos.acts.multimedia.mediaLibrary.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:mainability_description",
"icon": "$media:icon",
"label": "$string:entry_MainAbility",
"visible": true,
"orientation": "portrait",
"skills": [
{
"actions": [
"action.system.home"
],
"entities":[
"entity.system.home"
]
}
]
}
],
"requestPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "use ohos.permission.GET_BUNDLE_INFO"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"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"
}
]
}
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "MediaLibraryJSTestMain"
},
{
"name": "mainability_description",
"value": "MediaLibraryJSTestMain Ability"
}
]
}
\ No newline at end of file
{
"src": [
"pages/index/index",
"pages/second/second"
]
}
\ No newline at end of file
......@@ -20,7 +20,6 @@ import fileAssetTestCallbackTest from './fileAssetTestCallback.test.ets'
import fileAssetUriTestCallBackTest from './fileAssetUriTestCallBack.test.ets'
import fileAssetUriTestPromiseTest from './fileAssetUriTestPromise.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 mediaLibraryTestPromiseOnOffTest from './mediaLibraryTestPromiseOnOff.test.ets'
......@@ -34,7 +33,6 @@ export default function testsuite(abilityContext) {
fileAssetUriTestCallBackTest(abilityContext)
fileAssetUriTestPromiseTest(abilityContext)
fileTestCallBackTest(abilityContext)
fileTestPromiseTest(abilityContext)
mediaLibraryTestCallBackTest(abilityContext)
mediaLibraryTestPromiseTest(abilityContext)
mediaLibraryTestPromiseOnOffTest(abilityContext)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册