未验证 提交 852a3961 编写于 作者: O openharmony_ci 提交者: Gitee

!9667 add cameraShotKey xts tests

Merge pull request !9667 from shenshensun/cameraShotKey
...@@ -80,6 +80,7 @@ export function photoFetchOption(testNum, key, value) : photoAccessHelper.FetchO ...@@ -80,6 +80,7 @@ export function photoFetchOption(testNum, key, value) : photoAccessHelper.FetchO
photoKeys.POSITION, photoKeys.POSITION,
photoKeys.DATE_TRASHED, photoKeys.DATE_TRASHED,
photoKeys.HIDDEN, photoKeys.HIDDEN,
photoKeys.CAMERA_SHOT_KEY,
], ],
predicates: predicates predicates: predicates
}; };
......
...@@ -32,7 +32,7 @@ export default function unRegisterChangeTest () { ...@@ -32,7 +32,7 @@ export default function unRegisterChangeTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_UNREGISTERCHANGE_0100 * @tc.number : SUB_PHOTOACCESS_UNREGISTERCHANGE_0100
* @tc.name : unRegisterChange_001 * @tc.name : unRegisterChange_001
* @tc.desc : unRegister listening motify file displayName * @tc.desc : unRegister listening motify file title
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
import photoAccessHelper from '@ohos.file.photoAccessHelper' import photoAccessHelper from '@ohos.file.photoAccessHelper'
import { describe, beforeAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, it, expect } from 'deccjsunit/index'
import { import {
photoKeys,
photoFetchOption,
getFileAsset,
getPermission getPermission
} from '../../../../../../common' } from '../../../../../../common'
...@@ -72,6 +75,34 @@ export default function createAssetTest () { ...@@ -72,6 +75,34 @@ export default function createAssetTest () {
} }
} }
async function createAssetCallback3 (done, testNum, displayName, createOption, fetchOps) {
let asset: photoAccessHelper.PhotoAsset;
try {
helper.createAsset(displayName, createOption, async(err, createAsset) => {
try {
if (err !== undefined) {
console.info(`${testNum} createAsset failed; err: ${err}`);
expect(false).assertTrue();
} else {
let fd = await createAsset.open("rw");
await createAsset.close(fd);
expect(createAsset.displayName).assertEqual(displayName);
asset = await getFileAsset(testNum, fetchOps);
console.info(`${testNum} createAsset displayName: ${asset.displayName}`);
expect(asset.displayName).assertEqual(displayName);
}
} catch (error) {
console.info(`${testNum} createAsset failed; error: ${error}`);
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
}
async function createAssetAbnormalCallback1 (done, testNum, displayName) { async function createAssetAbnormalCallback1 (done, testNum, displayName) {
try { try {
helper.createAsset(displayName, (err, createAsset) => { helper.createAsset(displayName, (err, createAsset) => {
...@@ -93,12 +124,17 @@ export default function createAssetTest () { ...@@ -93,12 +124,17 @@ export default function createAssetTest () {
async function createAssetAbnormalCallback2 (done, testNum, displayName, createOption) { async function createAssetAbnormalCallback2 (done, testNum, displayName, createOption) {
try { try {
helper.createAsset(displayName, createOption, (err, createAsset) => { helper.createAsset(displayName, createOption, (err, createAsset) => {
try {
if (err !== undefined) { if (err !== undefined) {
console.info(`${testNum} createAsset failed; err: ${err}`); console.info(`${testNum} createAsset failed; err: ${err}`);
expect(true).assertTrue(); expect(true).assertTrue();
} else { } else {
console.info(`${testNum} createAsset success`);
expect(false).assertTrue(); expect(false).assertTrue();
} }
} catch(error) {
console.info(`${testNum} error: ${error}`);
}
done(); done();
}) })
} catch (error) { } catch (error) {
...@@ -134,6 +170,26 @@ export default function createAssetTest () { ...@@ -134,6 +170,26 @@ export default function createAssetTest () {
} }
} }
async function createAssetPromise3 (done, testNum, displayName, createOption, fetchOps) {
try {
let createAsset : photoAccessHelper.PhotoAsset;
createAsset = await helper.createAsset(displayName, createOption);
expect(createAsset.displayName).assertEqual(displayName);
let fd = await createAsset.open("rw");
await createAsset.close(fd);
expect(createAsset.displayName).assertEqual(displayName);
let asset: photoAccessHelper.PhotoAsset;
asset = await getFileAsset(testNum, fetchOps);
console.info(`${testNum} createAsset displayName: ${asset.displayName}`);
expect(asset.displayName).assertEqual(displayName);
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
}
async function createAssetAbnormalPromise1 (done, testNum, displayName) { async function createAssetAbnormalPromise1 (done, testNum, displayName) {
try { try {
await helper.createAsset(displayName); await helper.createAsset(displayName);
...@@ -163,7 +219,7 @@ export default function createAssetTest () { ...@@ -163,7 +219,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0000 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0000
* @tc.name : createAsset_callback_000 * @tc.name : createAsset_callback_000
* @tc.desc : createAsset * @tc.desc : createAsset by displayname
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
...@@ -211,7 +267,7 @@ export default function createAssetTest () { ...@@ -211,7 +267,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0400 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0400
* @tc.name : createAsset_callback_004 * @tc.name : createAsset_callback_004
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname is undefined and no createoption
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -224,7 +280,7 @@ export default function createAssetTest () { ...@@ -224,7 +280,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0500 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0500
* @tc.name : createAsset_callback_005 * @tc.name : createAsset_callback_005
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname is not has extension and no createoption
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -238,7 +294,7 @@ export default function createAssetTest () { ...@@ -238,7 +294,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0600 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0600
* @tc.name : createAsset_callback_006 * @tc.name : createAsset_callback_006
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset with too long displayname
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -256,7 +312,7 @@ export default function createAssetTest () { ...@@ -256,7 +312,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0700 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0700
* @tc.name : createAsset_callback_007 * @tc.name : createAsset_callback_007
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset with undefined displayname
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -272,7 +328,7 @@ export default function createAssetTest () { ...@@ -272,7 +328,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0800 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0800
* @tc.name : createAsset_callback_008 * @tc.name : createAsset_callback_008
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname is not has extension and subtype is DEFAULT
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -289,7 +345,7 @@ export default function createAssetTest () { ...@@ -289,7 +345,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0900 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_0900
* @tc.name : createAsset_callback_009 * @tc.name : createAsset_callback_009
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset with too long displayname and subtype is DEFAULT
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -307,11 +363,125 @@ export default function createAssetTest () { ...@@ -307,11 +363,125 @@ export default function createAssetTest () {
await createAssetAbnormalCallback2(done, testNum, displayName, createOption); await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
}); });
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_01000
* @tc.name : createAsset_callback_0010
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and subtype is DEFAULT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_0010', 2, async function (done) {
const testNum = 'createAsset_callback_0010';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_callback_0010aaaaa';
const fetchOps = photoFetchOption(testNum, photoKeys.CAMERA_SHOT_KEY, cameraShotKey);
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
cameraShotKey: cameraShotKey,
};
await createAssetCallback3(done, testNum, displayName, createOption, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_01100
* @tc.name : createAsset_callback_0011
* @tc.desc : createAsset with cameraShotKey.length is greater than or equal to 30 and has no subtype
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_0011', 2, async function (done) {
const testNum = 'createAsset_callback_0011';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_callback_0011aaaaa';
const fetchOps = photoFetchOption(testNum, photoKeys.CAMERA_SHOT_KEY, cameraShotKey);
const createOption: photoAccessHelper.PhotoCreateOptions = {
cameraShotKey: cameraShotKey,
};
await createAssetCallback3(done, testNum, displayName, createOption, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_01200
* @tc.name : createAsset_callback_0012
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and subtype is SCREENSHOT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_0012', 2, async function (done) {
const testNum = 'createAsset_callback_0012';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_callback_0012aaaaa';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.SCREENSHOT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_01300
* @tc.name : createAsset_callback_0013
* @tc.desc : createAsset with abnormal cameraShotKey.length is less than 30 and has no subtype
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_0013', 2, async function (done) {
const testNum = 'createAsset_callback_0013';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_callback_0013a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_01400
* @tc.name : createAsset_callback_0014
* @tc.desc : createAsset with abnormal cameraShotKey.length is less than 30 and subtype is DEFAULT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_0014', 2, async function (done) {
const testNum = 'createAsset_callback_0014';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_callback_0014a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_01500
* @tc.name : createAsset_callback_0015
* @tc.desc : createAsset with abnormal cameraShotKey.length is less than 30 and subtype is SCREENSHOT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_0015', 2, async function (done) {
const testNum = 'createAsset_callback_0015';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_callback_0015a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.SCREENSHOT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
});
//promise //promise
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0000 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0000
* @tc.name : createAsset_promise_000 * @tc.name : createAsset_promise_000
* @tc.desc : createAsset * @tc.desc : createAsset by displayname
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
...@@ -342,7 +512,7 @@ export default function createAssetTest () { ...@@ -342,7 +512,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0200 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0200
* @tc.name : createAsset_promise_002 * @tc.name : createAsset_promise_002
* @tc.desc : createAsset with createOption(PhotoSubtype.SCREENSHOT) * @tc.desc : createAsset by displayname with createOption(PhotoSubtype.SCREENSHOT)
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -359,7 +529,7 @@ export default function createAssetTest () { ...@@ -359,7 +529,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0400 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0400
* @tc.name : createAsset_promise_004 * @tc.name : createAsset_promise_004
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname has no extension
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -372,7 +542,7 @@ export default function createAssetTest () { ...@@ -372,7 +542,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0500 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0500
* @tc.name : createAsset_promise_005 * @tc.name : createAsset_promise_005
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname has no extension
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -386,7 +556,7 @@ export default function createAssetTest () { ...@@ -386,7 +556,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0600 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0600
* @tc.name : createAsset_promise_006 * @tc.name : createAsset_promise_006
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname is too long
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -404,7 +574,7 @@ export default function createAssetTest () { ...@@ -404,7 +574,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0700 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0700
* @tc.name : createAsset_promise_007 * @tc.name : createAsset_promise_007
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset with undefined displayname
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -420,7 +590,7 @@ export default function createAssetTest () { ...@@ -420,7 +590,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0800 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0800
* @tc.name : createAsset_promise_008 * @tc.name : createAsset_promise_008
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname has no extension
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -437,7 +607,7 @@ export default function createAssetTest () { ...@@ -437,7 +607,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0900 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_0900
* @tc.name : createAsset_promise_009 * @tc.name : createAsset_promise_009
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname is too long with subtype is DEFAULT
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -455,12 +625,126 @@ export default function createAssetTest () { ...@@ -455,12 +625,126 @@ export default function createAssetTest () {
await createAssetAbnormalPromise2(done, testNum, displayName, createOption); await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
}); });
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_01000
* @tc.name : createAsset_promise_0010
* @tc.desc : createAsset with normal cameraShotKey.length is is greater than or equal to 30 and has no subtype
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_0010', 2, async function (done) {
const testNum = 'createAsset_promise_0010';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_promise_0010aaaaaa';
const fetchOps = photoFetchOption(testNum, photoKeys.CAMERA_SHOT_KEY, cameraShotKey);
const createOption: photoAccessHelper.PhotoCreateOptions = {
cameraShotKey: cameraShotKey,
};
await createAssetPromise3(done, testNum, displayName, createOption, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_01100
* @tc.name : createAsset_promise_0011
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and subtype is DEFAULT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_0011', 2, async function (done) {
const testNum = 'createAsset_promise_0011';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_promise_0011aaaaaa';
const fetchOps = photoFetchOption(testNum, photoKeys.CAMERA_SHOT_KEY, cameraShotKey);
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
cameraShotKey: cameraShotKey,
};
await createAssetPromise3(done, testNum, displayName, createOption, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_01200
* @tc.name : createAsset_promise_0012
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and subtype is SCREENSHOT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_0012', 2, async function (done) {
const testNum = 'createAsset_promise_0012';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_promise_0012aaaaaa';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.SCREENSHOT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_01300
* @tc.name : createAsset_promise_0013
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and subtype is SCREENSHOT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_0013', 2, async function (done) {
const testNum = 'createAsset_promise_0013';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_promise_0013a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.SCREENSHOT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_01400
* @tc.name : createAsset_promise_0014
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and subtype is DEFAULT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_0014', 2, async function (done) {
const testNum = 'createAsset_promise_0014';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_promise_0014a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_01500
* @tc.name : createAsset_promise_0015
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and has no subtype
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_0015', 2, async function (done) {
const testNum = 'createAsset_promise_0015';
const displayName = testNum + '.jpg';
const cameraShotKey = 'createAsset_promise_0015a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
});
//video //video
//callback //callback
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1100 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1100
* @tc.name : createAsset_callback_011 * @tc.name : createAsset_callback_011
* @tc.desc : createAsset * @tc.desc : createAsset by displayname
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
...@@ -508,7 +792,7 @@ export default function createAssetTest () { ...@@ -508,7 +792,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1500 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1500
* @tc.name : createAsset_callback_015 * @tc.name : createAsset_callback_015
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset with displayname is too long
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -526,7 +810,7 @@ export default function createAssetTest () { ...@@ -526,7 +810,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1600 * @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1600
* @tc.name : createAsset_callback_016 * @tc.name : createAsset_callback_016
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset with displayname is too long and subtype is DEFAULT
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -544,11 +828,125 @@ export default function createAssetTest () { ...@@ -544,11 +828,125 @@ export default function createAssetTest () {
await createAssetAbnormalCallback2(done, testNum, displayName, createOption); await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
}); });
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1700
* @tc.name : createAsset_callback_017
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and subtype is DEFAULT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_017', 2, async function (done) {
const testNum = 'createAsset_callback_017';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_callback_0170aaaaa';
const fetchOps = photoFetchOption(testNum, photoKeys.CAMERA_SHOT_KEY, cameraShotKey);
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
cameraShotKey: cameraShotKey,
};
await createAssetCallback3(done, testNum, displayName, createOption, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1800
* @tc.name : createAsset_callback_0180
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and has no subtype
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_018', 2, async function (done) {
const testNum = 'createAsset_callback_018';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_callback_0180aaaaa';
const fetchOps = photoFetchOption(testNum, photoKeys.CAMERA_SHOT_KEY, cameraShotKey);
const createOption: photoAccessHelper.PhotoCreateOptions = {
cameraShotKey: cameraShotKey,
};
await createAssetCallback3(done, testNum, displayName, createOption, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_1900
* @tc.name : createAsset_callback_019
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and subtype is SCREENSHOT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_019', 2, async function (done) {
const testNum = 'createAsset_callback_019';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_callback_0190aaaaa';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.SCREENSHOT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_2000
* @tc.name : createAsset_callback_020
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and has no subtype
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_020', 2, async function (done) {
const testNum = 'createAsset_callback_020';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_callback_020a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_2100
* @tc.name : createAsset_callback_021
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and subtype is DEFAULT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_021', 2, async function (done) {
const testNum = 'createAsset_callback_021';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_callback_021a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_CREATE_ASSET_2200
* @tc.name : createAsset_callback_022
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and subtype is SCREENSHOT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_callback_022', 2, async function (done) {
const testNum = 'createAsset_callback_022';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_callback_022a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.SCREENSHOT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalCallback2(done, testNum, displayName, createOption);
});
//promise //promise
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1100 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1100
* @tc.name : createAsset_promise_011 * @tc.name : createAsset_promise_011
* @tc.desc : createAsset * @tc.desc : createAsset by displayname
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
...@@ -596,7 +994,7 @@ export default function createAssetTest () { ...@@ -596,7 +994,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1500 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1500
* @tc.name : createAsset_promise_015 * @tc.name : createAsset_promise_015
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset with displayname is too long
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -614,7 +1012,7 @@ export default function createAssetTest () { ...@@ -614,7 +1012,7 @@ export default function createAssetTest () {
/** /**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1600 * @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1600
* @tc.name : createAsset_promise_016 * @tc.name : createAsset_promise_016
* @tc.desc : createAsset abnormal param * @tc.desc : createAsset displayname is too long with subtype is DEFAULT
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 2 * @tc.level : Level 2
...@@ -631,5 +1029,119 @@ export default function createAssetTest () { ...@@ -631,5 +1029,119 @@ export default function createAssetTest () {
}; };
await createAssetAbnormalPromise2(done, testNum, displayName, createOption); await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
}); });
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1700
* @tc.name : createAsset_promise_017
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and has no subtype
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_017', 2, async function (done) {
const testNum = 'createAsset_promise_017';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_promise_0170aaaaaa';
const fetchOps = photoFetchOption(testNum, photoKeys.CAMERA_SHOT_KEY, cameraShotKey);
const createOption: photoAccessHelper.PhotoCreateOptions = {
cameraShotKey: cameraShotKey,
};
await createAssetPromise3(done, testNum, displayName, createOption, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1800
* @tc.name : createAsset_promise_018
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and subtype is DEFAULT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_018', 2, async function (done) {
const testNum = 'createAsset_promise_018';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_promise_0180aaaaaa';
const fetchOps = photoFetchOption(testNum, photoKeys.CAMERA_SHOT_KEY, cameraShotKey);
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
cameraShotKey: cameraShotKey,
};
await createAssetPromise3(done, testNum, displayName, createOption, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_1900
* @tc.name : createAsset_promise_019
* @tc.desc : createAsset with normal cameraShotKey.length is greater than or equal to 30 and subtype is SCREENSHOT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_019', 2, async function (done) {
const testNum = 'createAsset_promise_019';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_promise_0190aaaaa';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.SCREENSHOT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_2000
* @tc.name : createAsset_promise_020
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and subtype is SCREENSHOT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_020', 2, async function (done) {
const testNum = 'createAsset_promise_020';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_promise_0200a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.SCREENSHOT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_2100
* @tc.name : createAsset_promise_021
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and subtype is DEFAULT
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_021', 2, async function (done) {
const testNum = 'createAsset_promise_021';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_promise_0210a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
subtype: photoAccessHelper.PhotoSubtype.DEFAULT,
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_CREATE_ASSET_2200
* @tc.name : createAsset_promise_022
* @tc.desc : createAsset with cameraShotKey.length is less than 30 and no subtype
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('createAsset_promise_022', 2, async function (done) {
const testNum = 'createAsset_promise_022';
const displayName = testNum + '.mp4';
const cameraShotKey = 'createAsset_promise_0220a';
const createOption: photoAccessHelper.PhotoCreateOptions = {
cameraShotKey: cameraShotKey,
};
await createAssetAbnormalPromise2(done, testNum, displayName, createOption);
});
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册