Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9e00c898
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9e00c898
编写于
8月 24, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9811 getExif补充用例
Merge pull request !9811 from yangbo/yangbo_xts
上级
2ab037b5
b5ed8df1
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
1158 addition
and
36 deletion
+1158
-36
multimedia/BUILD.gn
multimedia/BUILD.gn
+1
-0
multimedia/photoAccess/photoAccess/Test.json
multimedia/photoAccess/photoAccess/Test.json
+18
-2
multimedia/photoAccess/photoAccessNoLocation/AppScope/app.json
...media/photoAccess/photoAccessNoLocation/AppScope/app.json
+21
-0
multimedia/photoAccess/photoAccessNoLocation/AppScope/resources/base/element/string.json
...essNoLocation/AppScope/resources/base/element/string.json
+8
-0
multimedia/photoAccess/photoAccessNoLocation/AppScope/resources/base/media/app_icon.png
...cessNoLocation/AppScope/resources/base/media/app_icon.png
+0
-0
multimedia/photoAccess/photoAccessNoLocation/BUILD.gn
multimedia/photoAccess/photoAccessNoLocation/BUILD.gn
+43
-0
multimedia/photoAccess/photoAccessNoLocation/Test.json
multimedia/photoAccess/photoAccessNoLocation/Test.json
+84
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/Application/AbilityStage.ts
...NoLocation/entry/src/main/ets/Application/AbilityStage.ts
+9
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/MainAbility/MainAbility.ts
...sNoLocation/entry/src/main/ets/MainAbility/MainAbility.ts
+36
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/MainAbility/pages/index/index.ets
...tion/entry/src/main/ets/MainAbility/pages/index/index.ets
+56
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/TestAbility/TestAbility.ts
...sNoLocation/entry/src/main/ets/TestAbility/TestAbility.ts
+50
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/TestAbility/pages/index.ets
...NoLocation/entry/src/main/ets/TestAbility/pages/index.ets
+48
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...on/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+74
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/test/List.test.ets
...otoAccessNoLocation/entry/src/main/ets/test/List.test.ets
+20
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/test/getExifNoLocation.ets
...sNoLocation/entry/src/main/ets/test/getExifNoLocation.ets
+113
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/module.json
...toAccess/photoAccessNoLocation/entry/src/main/module.json
+59
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/resources/base/element/string.json
...ocation/entry/src/main/resources/base/element/string.json
+32
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/resources/base/media/icon.png
...ssNoLocation/entry/src/main/resources/base/media/icon.png
+0
-0
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/resources/base/profile/main_pages.json
...ion/entry/src/main/resources/base/profile/main_pages.json
+5
-0
multimedia/photoAccess/photoAccessNoLocation/signature/openharmony_sx.p7b
...Access/photoAccessNoLocation/signature/openharmony_sx.p7b
+0
-0
multimedia/photoAccess/photoAccessSystem/Test.json
multimedia/photoAccess/photoAccessSystem/Test.json
+11
-1
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/getExif.ets
...ess/photoAccessSystem/entry/src/main/ets/test/getExif.ets
+362
-27
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/setUserComment.ets
...toAccessSystem/entry/src/main/ets/test/setUserComment.ets
+108
-6
未找到文件。
multimedia/BUILD.gn
浏览文件 @
9e00c898
...
...
@@ -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 {
...
...
multimedia/photoAccess/photoAccess/Test.json
浏览文件 @
9e00c898
...
...
@@ -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"
]
},
{
...
...
multimedia/photoAccess/photoAccessNoLocation/AppScope/app.json
0 → 100644
浏览文件 @
9e00c898
{
"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
multimedia/photoAccess/photoAccessNoLocation/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
9e00c898
{
"string"
:[
{
"name"
:
"app_name"
,
"value"
:
"ohosProject"
}
]
}
\ No newline at end of file
multimedia/photoAccess/photoAccessNoLocation/AppScope/resources/base/media/app_icon.png
0 → 100755
浏览文件 @
9e00c898
6.6 KB
multimedia/photoAccess/photoAccessNoLocation/BUILD.gn
0 → 100644
浏览文件 @
9e00c898
# 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"
}
multimedia/photoAccess/photoAccessNoLocation/Test.json
0 → 100644
浏览文件 @
9e00c898
{
"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
}
]
}
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/Application/AbilityStage.ts
0 → 100644
浏览文件 @
9e00c898
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
;
}
}
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/MainAbility/MainAbility.ts
0 → 100644
浏览文件 @
9e00c898
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
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/MainAbility/pages/index/index.ets
0 → 100644
浏览文件 @
9e00c898
/*
* 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
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/TestAbility/TestAbility.ts
0 → 100644
浏览文件 @
9e00c898
/*
* 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
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100644
浏览文件 @
9e00c898
/*
* 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
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
9e00c898
/*
* 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
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
9e00c898
/*
* 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()
}
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/ets/test/getExifNoLocation.ets
0 → 100644
浏览文件 @
9e00c898
/*
* 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
);
});
})
}
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/module.json
0 → 100644
浏览文件 @
9e00c898
{
"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
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
9e00c898
{
"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
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/resources/base/media/icon.png
0 → 100755
浏览文件 @
9e00c898
6.6 KB
multimedia/photoAccess/photoAccessNoLocation/entry/src/main/resources/base/profile/main_pages.json
0 → 100644
浏览文件 @
9e00c898
{
"src"
:
[
"MainAbility/pages/index/index"
]
}
\ No newline at end of file
multimedia/photoAccess/photoAccessNoLocation/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
9e00c898
文件已添加
multimedia/photoAccess/photoAccessSystem/Test.json
浏览文件 @
9e00c898
...
...
@@ -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"
,
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/getExif.ets
浏览文件 @
9e00c898
...
...
@@ -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
();
}
});
})
}
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/setUserComment.ets
浏览文件 @
9e00c898
...
...
@@ -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
,
'userComment
Cb
02.jpg'
);
const
fetchOps
=
photoFetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'userComment
Pro
02.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
,
'userComment
Cb
03.jpg'
);
const
fetchOps
=
photoFetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'userComment
Pro
03.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
,
'userComment
Cb
04.jpg'
);
const
fetchOps
=
photoFetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'userComment
Pro
04.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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录