未验证 提交 9e00c898 编写于 作者: O openharmony_ci 提交者: Gitee

!9811 getExif补充用例

Merge pull request !9811 from yangbo/yangbo_xts
......@@ -75,6 +75,7 @@ group("multimedia") {
"medialibrary/mediaLibrary_mediafetchoptions:mediaLibrary_mediafetchoptions_hap",
"medialibrary/mediaLibrary_trash:mediaLibrary_trash_js_hap",
"photoAccess/photoAccess:photoAccess_js_hap",
"photoAccess/photoAccessNoLocation:photoAccess_nolocation_js_hap",
"photoAccess/photoAccessSystem:photoAccess_system_js_hap",
]
} else {
......
......@@ -135,10 +135,26 @@
"hilog -Q domainoff",
"hilog -b D -D 0xD002B70",
"scanner",
"sleep 5"
"sleep 10"
],
"teardown-command": [
"power-shell setmode 600"
"power-shell setmode 600",
"rm -rf /storage/media/100/local/files/Audios/*",
"rm -rf /storage/media/100/local/files/Audios/.*",
"rm -rf /storage/media/100/local/files/Camera/*",
"rm -rf /storage/media/100/local/files/Camera/.*",
"rm -rf /storage/media/100/local/files/Documents/*",
"rm -rf /storage/media/100/local/files/Documents/.*",
"rm -rf /storage/media/100/local/files/Download/*",
"rm -rf /storage/media/100/local/files/Download/.*",
"rm -rf /storage/media/100/local/files/Pictures/*",
"rm -rf /storage/media/100/local/files/Pictures/.*",
"rm -rf /storage/media/100/local/files/Videos/*",
"rm -rf /storage/media/100/local/files/Videos/.*",
"sleep 5",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"kill -9 `pidof com.ohos.medialibrary.medialibrarydata`",
"scanner"
]
},
{
......
{
"app": {
"bundleName": "ohos.acts.multimedia.photoaccess",
"vendor": "huawei",
"versionCode": 1000000,
"versionName": "1.0.0",
"debug": false,
"icon": "$media:icon",
"label": "$string:app_name",
"description": "$string:description_application",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"car": {
"apiCompatibleVersion": 9,
"singleUser": false
}
}
}
\ No newline at end of file
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ No newline at end of file
# Copyright (c) 2023 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("photoAccess_nolocation_js_hap") {
hap_profile = "entry/src/main/module.json"
js_build_mode = "debug"
deps = [
":photoAccessNoLocation_js_assets",
":photoAccessNoLocation_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsPhotoAccessNoLocationTest"
part_name = "media_library"
subsystem_name = "multimedia"
}
ohos_app_scope("photoAccessNoLocation_app_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("photoAccessNoLocation_js_assets") {
source_dir = "entry/src/main/ets"
}
ohos_resources("photoAccessNoLocation_resources") {
sources = [ "entry/src/main/resources" ]
deps = [ ":photoAccessNoLocation_app_profile" ]
hap_profile = "entry/src/main/module.json"
}
{
"description": "Configuration for photoAccess Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "180000",
"bundle-name": "ohos.acts.multimedia.photoaccess",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 10000
},
"kits": [
{
"type": "ShellKit",
"pre-push": [],
"run-command": [
"rm -rf /storage/media/100/local/files/Audios/*",
"rm -rf /storage/media/100/local/files/Audios/.*",
"rm -rf /storage/media/100/local/files/Camera/*",
"rm -rf /storage/media/100/local/files/Camera/.*",
"rm -rf /storage/media/100/local/files/Documents/*",
"rm -rf /storage/media/100/local/files/Documents/.*",
"rm -rf /storage/media/100/local/files/Download/*",
"rm -rf /storage/media/100/local/files/Download/.*",
"rm -rf /storage/media/100/local/files/Pictures/*",
"rm -rf /storage/media/100/local/files/Pictures/.*",
"rm -rf /storage/media/100/local/files/Videos/*",
"rm -rf /storage/media/100/local/files/Videos/.*",
"sleep 5",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"kill -9 `pidof com.ohos.medialibrary.medialibrarydata`",
"scanner",
"sleep 5",
"mkdir /storage/media/100/local/temp",
"param set persist.ace.testmode.enabled 1"
]
},
{
"type": "PushKit",
"pre-push": [],
"push": [
"./resource/medialibrary/getExif.jpg ->/storage/media/100/local/temp/getExif.jpg"
]
},
{
"type": "ShellKit",
"run-command": [
"mediatool send /storage/media/100/local/temp/getExif.jpg",
"chmod -R 777 /storage/media/100/local/files/*",
"hilog -p off",
"hilog -Q pidoff",
"hilog -Q domainoff",
"hilog -b D -D 0xD002B70",
"scanner",
"sleep 10"
],
"teardown-command": [
"power-shell setmode 600",
"rm -rf /storage/media/100/local/files/Audios/*",
"rm -rf /storage/media/100/local/files/Audios/.*",
"rm -rf /storage/media/100/local/files/Camera/*",
"rm -rf /storage/media/100/local/files/Camera/.*",
"rm -rf /storage/media/100/local/files/Documents/*",
"rm -rf /storage/media/100/local/files/Documents/.*",
"rm -rf /storage/media/100/local/files/Download/*",
"rm -rf /storage/media/100/local/files/Download/.*",
"rm -rf /storage/media/100/local/files/Pictures/*",
"rm -rf /storage/media/100/local/files/Pictures/.*",
"rm -rf /storage/media/100/local/files/Videos/*",
"rm -rf /storage/media/100/local/files/Videos/.*",
"sleep 5",
"rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*",
"kill -9 `pidof com.ohos.medialibrary.medialibrarydata`",
"scanner"
]
},
{
"test-file-name": [
"ActsPhotoAccessNoLocationTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() : void {
console.log("[Demo] MyAbilityStage onCreate");
globalThis.stageOnCreateRun = 1;
globalThis.stageContext = this.context;
}
}
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want, launchParam) : void {
// Ability is creating, initialize resources for this ability
console.log('[Demo] MainAbility onCreate');
globalThis.abilityWant = want;
}
onDestroy() : void {
// Ability is destroying, release resources for this ability
console.log('[Demo] MainAbility onDestroy');
}
onWindowStageCreate(windowStage) : void {
console.log('[Demo] MainAbility onWindowStageCreate windowStage=' + windowStage);
globalThis.windowStage = windowStage;
globalThis.abilityContext = this.context;
windowStage.setUIContent(this.context, 'MainAbility/pages/index/index', null);
}
onWindowStageDestroy() : void {
//Main window is destroyed, release UI related resources
console.log('[Demo] MainAbility onWindowStageDestroy');
}
onForeground() : void {
// Ability has brought to foreground
console.log('[Demo] MainAbility onForeground');
}
onBackground() : void {
// Ability has back to background
console.log('[Demo] MainAbility onBackground');
}
};
\ No newline at end of file
/*
* Copyright (c) 2023 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 '@ohos.router';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
@Entry
@Component
struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
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) 2023 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 Ability from '@ohos.app.ability.UIAbility'
export default class TestAbility extends Ability {
onCreate(want, launchParam) : void {
console.log('TestAbility onCreate');
}
onDestroy() : void {
console.log('TestAbility onDestroy');
}
onWindowStageCreate(windowStage) : void {
console.log('TestAbility onWindowStageCreate');
windowStage.loadContent('TestAbility/pages/index', (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
};
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data));
});
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() : void {
console.log('TestAbility onWindowStageDestroy');
}
onForeground() : void {
console.log('TestAbility onForeground');
}
onBackground() : void {
console.log('TestAbility onBackground');
}
};
\ No newline at end of file
/*
* Copyright (c) 2023 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 '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) : string {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
]);
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`;
}
}
return targetParams.trim();
}
async function onAbilityCreateCallback() : Promise<void> {
console.log('onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err) : Promise<void> {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err));
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {};
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare ');
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run');
let abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility';
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback);
let cmd = 'aa start -d 0 -a com.example.myapplication.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName;
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters);
const debug = abilityDelegatorArguments.parameters['-D'];
if (debug === 'true')
{
cmd += ' -D';
}
console.info('cmd : ' + cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
});
console.info('OpenHarmonyTestRunner onRun end');
}
};
\ No newline at end of file
/*
* Copyright (c) 2023 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 getExifNoLocationTest from './getExifNoLocation'
export default function testsuite () {
getExifNoLocationTest()
}
/*
* Copyright (C) 2023 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 abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import bundleManager from '@ohos.bundle.bundleManager';
import { describe, beforeAll, it, expect } from 'deccjsunit/index'
import {
photoKeys,
photoFetchOption,
getFileAsset,
} from '../../../../../../common'
export default function getExifNoLocationTest () {
describe('getExifNoLocationTest', function () {
beforeAll(async function () {
console.info('beforeAll case')
const atManager = abilityAccessCtrl.createAtManager();
const appFlags = bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT;
const userId = 100;
const appInfo = await bundleManager.getApplicationInfo('ohos.acts.multimedia.photoaccess', appFlags, userId);
const tokenID = appInfo.accessTokenId;
try {
await atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.READ_IMAGEVIDEO', 1);
} catch (error) {
console.info(`getPermission failed`);
}
})
async function getExifCallback (done, testNum, fetchOps) {
try {
const asset = await getFileAsset(testNum, fetchOps);
asset.getExif(async (err, result) => {
try {
if (err !== undefined) {
console.info(`${testNum} err: ${err}`);
expect(false).assertTrue();
} else {
console.info(`${testNum} result: ${result}`)
expect(result.length > 0).assertTrue();
expect(!result.includes('GPSLongitude')).assertTrue();
expect(!result.includes('GPSLatitudeRef')).assertTrue();
expect(!result.includes('GPSLongitudeRef')).assertTrue();
}
} catch (error) {
console.info(`${testNum} error: ${error}`);
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
}
async function getExifPromise (done, testNum, fetchOps) {
try {
const asset = await getFileAsset(testNum, fetchOps);
const result = await asset.getExif();
console.info(`${testNum} result: ${result}`)
expect(result.length > 0).assertTrue();
expect(!result.includes('GPSLongitude')).assertTrue();
expect(!result.includes('GPSLatitudeRef')).assertTrue();
expect(!result.includes('GPSLongitudeRef')).assertTrue();
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
}
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_NOLOCATION_0400
* @tc.name : getExif_callback_004
* @tc.desc : getExif.jpg, fetchColumn with all_exif, no MEDIA_LOCATION permission, check GPSLongitude
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('getExif_callback_004', 0, async function (done) {
const testNum = 'getExif_callback_004';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'getExif.jpg');
await getExifCallback(done, testNum, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_EXIF_NOLOCATION_0400
* @tc.name : getExif_promise_004
* @tc.desc : getExif.jpg, fetchColumn with all_exif, no MEDIA_LOCATION permission, check GPSLongitude
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('getExif_promise_004', 0, async function (done) {
const testNum = 'getExif_promise_004';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'getExif.jpg');
await getExifPromise(done, testNum, fetchOps);
});
})
}
{
"module": {
"name": "phone",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"description": "$string:phone_entry_dsc",
"mainElement": "MainAbility",
"deviceTypes": [
"tablet",
"default",
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [
{
"name": "com.example.myapplication.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
"visible": true,
"orientation": "portrait",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
],
"requestPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.READ_IMAGEVIDEO"
},
{
"name": "ohos.permission.WRITE_IMAGEVIDEO"
}
]
}
}
\ No newline at end of file
{
"string": [
{
"name": "phone_entry_dsc",
"value": "i am an entry for phone"
},
{
"name": "phone_entry_main",
"value": "the phone entry ability"
},
{
"name": "entry_label",
"value": "ActsPhotoAccessNoLocationTest"
},
{
"name": "form_description",
"value": "photoAccessSystem"
},
{
"name": "serviceability_description",
"value": "photoAccessSystem"
},
{
"name": "description_application",
"value": "photoAccessSystem test"
},
{
"name": "app_name",
"value": "ActsPhotoAccessNoLocationTest"
}
]
}
\ No newline at end of file
{
"src": [
"MainAbility/pages/index/index"
]
}
\ No newline at end of file
......@@ -39,15 +39,20 @@
"pre-push": [],
"push": [
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/01.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/noExif.jpg",
"./resource/medialibrary/getExif.jpg ->/storage/media/100/local/temp/getExif.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentCb01.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentCb02.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentCb03.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentCb04.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentCb05.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentCb06.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentPro01.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentPro02.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentPro03.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentPro04.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentPro05.jpg",
"./resource/medialibrary/01.jpg ->/storage/media/100/local/temp/userCommentPro06.jpg",
"./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp/01.mp4"
]
},
......@@ -140,11 +145,16 @@
"mediatool send /storage/media/100/local/temp/userCommentCb02.jpg",
"mediatool send /storage/media/100/local/temp/userCommentCb03.jpg",
"mediatool send /storage/media/100/local/temp/userCommentCb04.jpg",
"mediatool send /storage/media/100/local/temp/userCommentCb05.jpg",
"mediatool send /storage/media/100/local/temp/userCommentCb06.jpg",
"mediatool send /storage/media/100/local/temp/userCommentPro01.jpg",
"mediatool send /storage/media/100/local/temp/userCommentPro02.jpg",
"mediatool send /storage/media/100/local/temp/userCommentPro03.jpg",
"mediatool send /storage/media/100/local/temp/userCommentPro04.jpg",
"mediatool send /storage/media/100/local/temp/userCommentPro05.jpg",
"mediatool send /storage/media/100/local/temp/userCommentPro06.jpg",
"mediatool send /storage/media/100/local/temp/getExif.jpg",
"mediatool send /storage/media/100/local/temp/noExif.jpg",
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/getPhotoIndex01.jpg",
"cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/getPhotoIndex02.jpg",
......@@ -173,7 +183,7 @@
"hilog -Q domainoff",
"hilog -b D -D 0xD002B70",
"scanner",
"sleep 5"
"sleep 10"
],
"teardown-command": [
"power-shell setmode 600",
......
......@@ -13,13 +13,15 @@
* limitations under the License.
*/
import photoAccessHelper from '@ohos.file.photoAccessHelper';
import dataSharePredicates from '@ohos.data.dataSharePredicates';
import { describe, beforeAll, it, expect } from 'deccjsunit/index'
import {
photoKeys,
photoFetchOption,
getFileAsset,
getPermission,
fetchOption
fetchOption,
} from '../../../../../../common'
export default function getExifTest () {
......@@ -29,10 +31,41 @@ export default function getExifTest () {
await getPermission()
})
const exifInfo = {
ImageWidth: '3456',
UserComment: 'gray',
}
const exifInfo = new Map([
['ApertureValue', '1.69 EV (f/1.8)'],
['BitsPerSample', '8, 8, 8'],
['DateTimeOriginal', '2019:11:15 20:48:30'],
['DateTime', '2019:11:15 20:48:30'],
['ExposureBiasValue', '0.00 EV'],
['ExposureTime', '1/33 sec.'],
['Flash', 'Flash fired, auto mode'],
['FNumber', 'f/1.8'],
['FocalLength', '4.0 mm'],
['FocalLengthIn35mmFilm', '26'],
['GPSLongitude', '0'],
['GPSLatitudeRef', ''],
['GPSLongitudeRef', ''],
['GPSTimeStamp', '13:31:27.00'],
['GPSDateStamp', '2023:04:13'],
['ImageDescription', 'A gray picture'],
['ImageLength', '4608'],
['ImageWidth', '3456'],
['ISOSpeedRatings', '200'],
['LightSource', 'Daylight'],
['Make', 'HW'],
['MakerNote', ''],
['MeteringMode', 'Pattern'],
['Model', 'STK-LX1'],
['Orientation', '0'],
['PhotoMode', ''],
['PixelXDimension', '3456'],
['PixelYDimension', '4608'],
['RecommendedExposureIndex', '200'],
['SceneType', 'Directly photographed'],
['SensitivityType', 'Standard output sensitivity (SOS)'],
['StandardOutputSensitivity', ''],
['WhiteBalance', 'Auto white balance'],
])
async function getExifCallback (done, testNum, fetchOps) {
try {
......@@ -46,9 +79,10 @@ export default function getExifTest () {
console.info(`${testNum} result: ${result}`)
expect(result.length > 0).assertTrue();
const msg = JSON.parse(result);
console.info(`${testNum} ImageWidth: ${msg.ImageWidth}, UserComment: ${msg.UserComment}`)
expect(msg.ImageWidth).assertEqual(exifInfo.ImageWidth);
expect(msg.UserComment).assertEqual(exifInfo.UserComment);
exifInfo.forEach((value, key, map) => {
console.info(`${testNum} key: ${key}, value: ${value}, msg[key]: ${msg[key]}`)
expect(value).assertEqual(msg[key].toString())
});
}
} catch (error) {
console.info(`${testNum} error: ${error}`);
......@@ -66,11 +100,11 @@ export default function getExifTest () {
try {
const asset = await getFileAsset(testNum, fetchOps);
asset.getExif(async (err, result) => {
console.info(`${testNum} err: ${err}, result: ${result}`);
try {
if (err !== undefined) {
console.info(`${testNum} err: ${err}`);
} else {
console.info(`${testNum} result: ${result}`);
expect(false).assertTrue();
}
} catch (error) {
......@@ -92,9 +126,10 @@ export default function getExifTest () {
console.info(`${testNum} result: ${result}`)
expect(result.length > 0).assertTrue();
const msg = JSON.parse(result);
console.info(`${testNum} ImageWidth: ${msg.ImageWidth}, UserComment: ${msg.UserComment}`)
expect(msg.ImageWidth).assertEqual(exifInfo.ImageWidth);
expect(msg.UserComment).assertEqual(exifInfo.UserComment);
exifInfo.forEach((value, key, map) => {
console.info(`${testNum} key: ${key}, value: ${value}, msg[key]: ${msg[key]}`)
expect(value).assertEqual(msg[key].toString())
});
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
......@@ -118,21 +153,25 @@ export default function getExifTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_0000
* @tc.name : getExif_callback_000
* @tc.desc : getExif.jpg, fetchColumn with all_exif, check ImageWidth、UserComment
* @tc.desc : getExif.jpg, fetchColumn with all_exif, check exif
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('getExif_callback_000', 0, async function (done) {
const testNum = 'getExif_callback_000';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'getExif.jpg');
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif'],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'getExif.jpg'),
};
await getExifCallback(done, testNum, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_0100
* @tc.name : getExif_callback_001
* @tc.desc : getExif.jpg, fetchColumn without all_exif, check ImageWidth、UserComment
* @tc.desc : getExif.jpg, fetchColumn without all_exif, check exif
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
......@@ -144,19 +183,187 @@ export default function getExifTest () {
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_0200
* @tc.name : getExif_callback_002
* @tc.desc : 01.jpg, fetchColumn with all_exif, check ImageWidth、UserComment
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_0300
* @tc.name : getExif_callback_003
* @tc.desc : noExif.jpg, fetchColumn with all_exif and user_comment, check UserComment
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_callback_003', 2, async function (done) {
const testNum = 'getExif_callback_003';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif', photoKeys.USER_COMMENT],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'getExif.jpg'),
};
try {
const asset = await getFileAsset(testNum, fetchOps);
asset.getExif(async (err, result) => {
try {
if (err !== undefined) {
console.info(`${testNum} err: ${err}`);
expect(false).assertTrue();
} else {
console.info(`${testNum} result: ${result}`)
expect(result.includes('UserComment')).assertTrue();
const msg = JSON.parse(result);
expect(msg.UserComment).assertEqual('gray');
}
} catch (error) {
console.info(`${testNum} error: ${error}`);
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_0500
* @tc.name : getExif_callback_005
* @tc.desc : getExif.jpg, fetchColumn with all_exif, has MEDIA_LOCATION permission, check GPSLongitude
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_callback_005', 2, async function (done) {
const testNum = 'getExif_callback_005';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif'],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'getExif.jpg'),
};
try {
const asset = await getFileAsset(testNum, fetchOps);
asset.getExif(async (err, result) => {
try {
if (err !== undefined) {
console.info(`${testNum} err: ${err}`);
expect(false).assertTrue();
} else {
console.info(`${testNum} result: ${result}`)
expect(result.includes('GPSLongitude')).assertTrue();
expect(result.includes('GPSLatitudeRef')).assertTrue();
expect(result.includes('GPSLongitudeRef')).assertTrue();
const msg = JSON.parse(result);
expect(msg.GPSLongitude).assertEqual(0);
expect(msg.GPSLatitudeRef).assertEqual('');
expect(msg.GPSLongitudeRef).assertEqual('');
}
} catch (error) {
console.info(`${testNum} error: ${error}`);
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_0600
* @tc.name : getExif_callback_006
* @tc.desc : noExif.jpg, fetchColumn with all_exif, check ImageWidth
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_callback_006', 2, async function (done) {
const testNum = 'getExif_callback_006';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif'],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'noExif.jpg'),
};
try {
const asset = await getFileAsset(testNum, fetchOps);
asset.getExif(async (err, result) => {
try {
if (err !== undefined) {
console.info(`${testNum} err: ${err}`);
expect(false).assertTrue();
} else {
console.info(`${testNum} result: ${result}`);
expect(result.includes('ImageWidth')).assertTrue();
const msg = JSON.parse(result);
expect(msg.ImageWidth).assertEqual('');
}
} catch (error) {
console.info(`${testNum} error: ${error}`);
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_0700
* @tc.name : getExif_callback_007
* @tc.desc : noExif.jpg, fetchColumn withoutout all_exif, check ImageWidth
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_callback_002', 2, async function (done) {
const testNum = 'getExif_callback_002';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, '01.jpg');
it('getExif_callback_007', 2, async function (done) {
const testNum = 'getExif_callback_007';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: [],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'noExif.jpg'),
};
await getExifAbnormalCallback(done, testNum, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_GET_EXIF_0900
* @tc.name : getExif_callback_009
* @tc.desc : noExif.jpg, fetchColumn with all_exif and USER_COMMENT, check UserComment
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_callback_009', 2, async function (done) {
const testNum = 'getExif_callback_009';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif', photoKeys.USER_COMMENT],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'noExif.jpg'),
};
try {
const asset = await getFileAsset(testNum, fetchOps);
asset.getExif(async (err, result) => {
try {
if (err !== undefined) {
console.info(`${testNum} err: ${err}`);
expect(false).assertTrue();
} else {
console.info(`${testNum} result: ${result}`)
expect(result.includes('UserComment')).assertTrue();
const msg = JSON.parse(result);
expect(msg.UserComment).assertEqual('');
}
} catch (error) {
console.info(`${testNum} error: ${error}`);
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_EXIF_0000
* @tc.name : getExif_promise_000
......@@ -186,17 +393,145 @@ export default function getExifTest () {
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_EXIF_0200
* @tc.name : getExif_promise_002
* @tc.desc : 01.jpg, fetchColumn with all_exif, check ImageWidth、UserComment
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_EXIF_0300
* @tc.name : getExif_promise_003
* @tc.desc : noExif.jpg, fetchColumn with all_exif and user_comment, check UserComment
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_promise_003', 2, async function (done) {
const testNum = 'getExif_promise_003';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif', photoKeys.USER_COMMENT],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'getExif.jpg'),
};
try {
const asset = await getFileAsset(testNum, fetchOps);
const result = await asset.getExif();
console.info(`${testNum} result: ${result}`);
expect(result.includes('UserComment')).assertTrue();
const msg = JSON.parse(result);
expect(msg.UserComment).assertEqual('gray');
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_EXIF_0500
* @tc.name : getExif_promise_005
* @tc.desc : getExif.jpg, fetchColumn with all_exif, has MEDIA_LOCATION permission, check GPSLongitude
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_promise_005', 2, async function (done) {
const testNum = 'getExif_promise_005';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif'],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'getExif.jpg'),
};
try {
const asset = await getFileAsset(testNum, fetchOps);
const result = await asset.getExif();
console.info(`${testNum} result: ${result}`);
expect(result.includes('GPSLongitude')).assertTrue();
expect(result.includes('GPSLatitudeRef')).assertTrue();
expect(result.includes('GPSLongitudeRef')).assertTrue();
const msg = JSON.parse(result);
expect(msg.GPSLongitude).assertEqual(0);
expect(msg.GPSLatitudeRef).assertEqual('');
expect(msg.GPSLongitudeRef).assertEqual('');
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_EXIF_0600
* @tc.name : getExif_promise_006
* @tc.desc : noExif.jpg, fetchColumn with all_exif, check ImageWidth
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_promise_006', 2, async function (done) {
const testNum = 'getExif_promise_006';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif'],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'noExif.jpg'),
};
try {
const asset = await getFileAsset(testNum, fetchOps);
const result = await asset.getExif();
console.info(`${testNum} result: ${result}`);
expect(result.includes('ImageWidth')).assertTrue();
const msg = JSON.parse(result);
expect(msg.ImageWidth).assertEqual('');
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_EXIF_0700
* @tc.name : getExif_promise_007
* @tc.desc : noExif.jpg, fetchColumn withoutout all_exif, check ImageWidth
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_promise_002', 2, async function (done) {
const testNum = 'getExif_promise_002';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, '01.jpg');
it('getExif_promise_007', 2, async function (done) {
const testNum = 'getExif_promise_007';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: [],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'noExif.jpg'),
};
await getExifAbnormalPromise(done, testNum, fetchOps);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_GET_EXIF_0900
* @tc.name : getExif_promise_009
* @tc.desc : noExif.jpg, fetchColumn with all_exif and USER_COMMENT, check UserComment
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('getExif_promise_009', 2, async function (done) {
const testNum = 'getExif_promise_009';
const predicates = new dataSharePredicates.DataSharePredicates();
const fetchOps : photoAccessHelper.FetchOptions = {
fetchColumns: ['all_exif', photoKeys.USER_COMMENT],
predicates: predicates.equalTo(photoKeys.DISPLAY_NAME, 'noExif.jpg'),
};
try {
const asset = await getFileAsset(testNum, fetchOps);
const result = await asset.getExif();
console.info(`${testNum} result: ${result}`)
expect(result.includes('UserComment')).assertTrue();
const msg = JSON.parse(result);
expect(msg.UserComment).assertEqual('');
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
})
}
......@@ -18,7 +18,7 @@ import {
photoKeys,
photoFetchOption,
getFileAsset,
getPermission
getPermission,
} from '../../../../../../common'
export default function setUserCommentTest () {
......@@ -109,7 +109,7 @@ export default function setUserCommentTest () {
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_SET_USER_COMMENT_0000
* @tc.name : setUserComment_callback_000
* @tc.desc : userComment is string('setUserComment_callback_000')
* @tc.desc : userComment is string('setUserComment_callback_000'), query by get
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
......@@ -166,10 +166,66 @@ export default function setUserCommentTest () {
await setUserCommentAbnormalCallback(done, testNum, fetchOps, userComment);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_SET_USER_COMMENT_0400
* @tc.name : setUserComment_callback_004
* @tc.desc : userComment is string('aaa...aaa'(141))
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('setUserComment_callback_004', 2, async function (done) {
const testNum = 'setUserComment_callback_004';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentCb05.jpg');
let userComment = '';
for (let i = 0; i < 141; i++) {
userComment += 'a';
}
await setUserCommentAbnormalCallback(done, testNum, fetchOps, userComment);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_CALLBACK_SET_USER_COMMENT_0500
* @tc.name : setUserComment_callback_005
* @tc.desc : userComment is string('setUserComment_callback_005'), query by getExif
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('setUserComment_callback_005', 2, async function (done) {
const testNum = 'setUserComment_callback_005';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentCb06.jpg');
const userComment = testNum;
try {
const asset = await getFileAsset(testNum, fetchOps);
asset.setUserComment(userComment, async (err) => {
try {
if (err !== undefined) {
console.info(`${testNum} err: ${err}`);
expect(false).assertTrue();
} else {
const newAsset = await getFileAsset(testNum, fetchOps);
const result = await newAsset.getExif();
const msg = JSON.parse(result);
console.info(`${testNum} curUserComment: ${msg.UserComment}`);
expect(msg.UserComment).assertEqual(userComment);
}
} catch (error) {
console.info(`${testNum} error: ${error}`);
}
done();
})
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_SET_USER_COMMENT_0000
* @tc.name : setUserComment_promise_000
* @tc.desc : userComment is string('setUserComment_promise_000')
* @tc.desc : userComment is string('setUserComment_promise_000'), query by get
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
......@@ -191,7 +247,7 @@ export default function setUserCommentTest () {
*/
it('setUserComment_promise_001', 2, async function (done) {
const testNum = 'setUserComment_promise_001';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentCb02.jpg');
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentPro02.jpg');
const userComment = '';
await setUserCommentPromise(done, testNum, fetchOps, userComment);
});
......@@ -206,7 +262,7 @@ export default function setUserCommentTest () {
*/
it('setUserComment_promise_002', 2, async function (done) {
const testNum = 'setUserComment_promise_002';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentCb03.jpg');
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentPro03.jpg');
const userComment = undefined;
await setUserCommentAbnormalPromise(done, testNum, fetchOps, userComment);
});
......@@ -221,9 +277,55 @@ export default function setUserCommentTest () {
*/
it('setUserComment_promise_003', 2, async function (done) {
const testNum = 'setUserComment_promise_003';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentCb04.jpg');
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentPro04.jpg');
const userComment = 123;
await setUserCommentAbnormalPromise(done, testNum, fetchOps, userComment);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_SET_USER_COMMENT_0400
* @tc.name : setUserComment_promise_004
* @tc.desc : userComment is string('bbb...bbb'(141))
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('setUserComment_promise_004', 2, async function (done) {
const testNum = 'setUserComment_promise_004';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentPro05.jpg');
let userComment = '';
for (let i = 0; i < 141; i++) {
userComment += 'b';
}
await setUserCommentAbnormalPromise(done, testNum, fetchOps, userComment);
});
/**
* @tc.number : SUB_PHOTOACCESS_HELPER_PROMISE_SET_USER_COMMENT_0500
* @tc.name : setUserComment_promise_005
* @tc.desc : userComment is string('setUserComment_promise_005'), query by getExif
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('setUserComment_promise_005', 2, async function (done) {
const testNum = 'setUserComment_promise_005';
const fetchOps = photoFetchOption(testNum, photoKeys.DISPLAY_NAME, 'userCommentPro06.jpg');
const userComment = testNum;
try {
const asset = await getFileAsset(testNum, fetchOps);
await asset.setUserComment(userComment);
const newAsset = await getFileAsset(testNum, fetchOps);
const result = await newAsset.getExif();
const msg = JSON.parse(result);
console.info(`${testNum} curUserComment: ${msg.UserComment}`);
expect(msg.UserComment).assertEqual(userComment);
done();
} catch (error) {
console.info(`${testNum} failed; error: ${error}`);
expect(false).assertTrue();
done();
}
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册