Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ff9d2549
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看板
未验证
提交
ff9d2549
编写于
8月 30, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 30, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9919 修复获取权限异常
Merge pull request !9919 from yangbo/xts_acts
上级
97c64d3e
2491ff06
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
70 addition
and
19 deletion
+70
-19
multimedia/medialibrary/mediaLibrary_getExifNoLocation/entry/src/main/ets/test/getExifNoLocation.test.ets
...cation/entry/src/main/ets/test/getExifNoLocation.test.ets
+5
-0
multimedia/medialibrary/mediaLibrary_getExiflocation/entry/src/main/ets/test/getExifLocation.test.ets
...location/entry/src/main/ets/test/getExifLocation.test.ets
+5
-0
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/open.ets
...Access/photoAccessSystem/entry/src/main/ets/test/open.ets
+60
-19
未找到文件。
multimedia/medialibrary/mediaLibrary_getExifNoLocation/entry/src/main/ets/test/getExifNoLocation.test.ets
浏览文件 @
ff9d2549
...
...
@@ -26,11 +26,13 @@ export default function getExifNoLocation(abilityContext) {
try {
let permissions = ["ohos.permission.READ_MEDIA"];
let atManager = abilityAccessCtrl.createAtManager();
let permissionCheck = false;
atManager.requestPermissionsFromUser(abilityContext, permissions, (err, result) => {
if (err) {
console.info('getPermission failed: ' + JSON.stringify(err));
} else {
console.info('getPermission suc: ' + JSON.stringify(result));
permissionCheck = true;
}
});
...
...
@@ -38,6 +40,9 @@ export default function getExifNoLocation(abilityContext) {
await sleep(500);
for (let i = 0; i < 10; i++) {
if (permissionCheck) {
break;
}
await sleep(500);
let button = await driver.findComponent(uitest.ON.text('允许'));
if (button != undefined) {
...
...
multimedia/medialibrary/mediaLibrary_getExiflocation/entry/src/main/ets/test/getExifLocation.test.ets
浏览文件 @
ff9d2549
...
...
@@ -26,11 +26,13 @@ export default function getExifLocation(abilityContext) {
try {
let permissions = ["ohos.permission.MEDIA_LOCATION", "ohos.permission.READ_MEDIA"];
let atManager = abilityAccessCtrl.createAtManager();
let permissionCheck = false;
atManager.requestPermissionsFromUser(abilityContext, permissions, (err, result) => {
if (err) {
console.info('getPermission failed: ' + JSON.stringify(err));
} else {
console.info('getPermission suc: ' + JSON.stringify(result));
permissionCheck = true;
}
});
...
...
@@ -38,6 +40,9 @@ export default function getExifLocation(abilityContext) {
await sleep(500);
for (let i = 0; i < 10; i++) {
if (permissionCheck) {
break;
}
await sleep(500);
let button = await driver.findComponent(uitest.ON.text('允许'));
if (button != undefined) {
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/open.ets
浏览文件 @
ff9d2549
...
...
@@ -20,6 +20,7 @@ import {
photoFetchOption
,
getFileAsset
,
getPermission
,
sleep
,
}
from
'../../../../../../common'
export
default
function
openTest
()
{
...
...
@@ -30,14 +31,17 @@ export default function openTest() {
})
async
function
rwOpenCallback
(
done
,
testNum
,
fetchOp
,
assetBytes
)
{
let
asset
;
let
fd
;
try
{
const
asset
=
await
getFileAsset
(
testNum
,
fetchOp
);
asset
.
open
(
'rw'
,
async
(
err
,
fd
)
=>
{
asset
=
await
getFileAsset
(
testNum
,
fetchOp
);
asset
.
open
(
'rw'
,
async
(
err
,
data
)
=>
{
try
{
if
(
err
)
{
console
.
info
(
`${testNum} err: ${err}`
);
expect
(
false
)
.
assertTrue
();
}
else
{
fd
=
data
;
console
.
info
(
`${testNum} fd: ${fd}`
);
let
buf
=
new
ArrayBuffer
(
4096
);
let
res
=
await
fileio
.
read
(
fd
,
buf
);
...
...
@@ -49,72 +53,109 @@ export default function openTest() {
}
catch
(
error
)
{
console
.
info
(
`${testNum} error: ${error}`
);
}
await
asset
.
close
(
fd
);
done
();
});
await
sleep
(
50
);
}
catch
(
error
)
{
console
.
info
(
`${testNum} failed, error: ${error}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
finally
{
if
(
asset
)
{
await
asset
.
close
(
fd
);
}
}
};
async
function
rOpenCallback
(
done
,
testNum
,
fetchOp
,
assetBytes
)
{
let
asset
;
let
fd
;
try
{
const
asset
=
await
getFileAsset
(
testNum
,
fetchOp
);
asset
.
open
(
'r'
,
async
(
err
,
fd
)
=>
{
asset
=
await
getFileAsset
(
testNum
,
fetchOp
);
asset
.
open
(
'r'
,
async
(
err
,
data
)
=>
{
try
{
if
(
err
)
{
console
.
info
(
`${testNum} err: ${err}`
);
expect
(
false
)
.
assertTrue
();
}
else
{
fd
=
data
;
console
.
info
(
`${testNum} fd: ${fd}`
);
let
buf
=
new
ArrayBuffer
(
4096
);
let
res
=
await
fileio
.
read
(
fd
,
buf
);
expect
(
res
.
bytesRead
)
.
assertEqual
(
assetBytes
);
console
.
info
(
`${testNum} read suc`
);
await
fileio
.
write
(
fd
,
testNum
);
expect
(
false
)
.
assertTrue
();
fileio
.
read
(
fd
,
buf
)
.
then
((
result
)
=>
{
expect
(
result
.
bytesRead
)
.
assertEqual
(
assetBytes
);
})
.
catch
((
rErr
)
=>
{
console
.
info
(
`${testNum} rErr: ${rErr}`
);
expect
(
false
)
.
assertTrue
();
})
await
sleep
(
50
);
fileio
.
write
(
fd
,
testNum
)
.
then
((
result
)
=>
{
expect
(
false
)
.
assertTrue
();
})
.
catch
((
wErr
)
=>
{
console
.
info
(
`${testNum} wErr: ${wErr}`
);
})
await
sleep
(
50
);
}
}
catch
(
error
)
{
console
.
info
(
`${testNum} error: ${error}`
);
expect
(
false
)
.
assertTrue
();
}
await
asset
.
close
(
fd
);
done
();
});
await
sleep
(
50
);
}
catch
(
error
)
{
console
.
info
(
`${testNum} failed, error: ${error}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
finally
{
if
(
asset
)
{
await
asset
.
close
(
fd
);
}
}
};
async
function
wOpenCallback
(
done
,
testNum
,
fetchOp
)
{
let
asset
;
let
fd
;
try
{
const
asset
=
await
getFileAsset
(
testNum
,
fetchOp
);
asset
.
open
(
'w'
,
async
(
err
,
fd
)
=>
{
asset
=
await
getFileAsset
(
testNum
,
fetchOp
);
asset
.
open
(
'w'
,
async
(
err
,
data
)
=>
{
try
{
if
(
err
)
{
console
.
info
(
`${testNum} err: ${err}`
);
expect
(
false
)
.
assertTrue
();
}
else
{
let
write
=
await
fileio
.
write
(
fd
,
testNum
);
expect
(
write
)
.
assertEqual
(
testNum
.
length
);
fd
=
data
;
console
.
info
(
`${testNum} fd: ${fd}`
);
fileio
.
write
(
fd
,
testNum
)
.
then
((
result
)
=>
{
expect
(
result
)
.
assertEqual
(
testNum
.
length
);
})
.
catch
((
wErr
)
=>
{
console
.
info
(
`${testNum} wErr: ${wErr}`
);
expect
(
false
)
.
assertTrue
();
})
await
sleep
(
50
);
let
buf
=
new
ArrayBuffer
(
4096
);
await
fileio
.
read
(
fd
,
buf
);
expect
(
false
)
.
assertTrue
();
fileio
.
read
(
fd
,
buf
)
.
then
((
result
)
=>
{
expect
(
false
)
.
assertTrue
();
})
.
catch
((
rErr
)
=>
{
console
.
info
(
`${testNum} rErr: ${rErr}`
);
})
await
sleep
(
50
);
}
}
catch
(
error
)
{
console
.
info
(
`${testNum} error: ${error}`
);
expect
(
false
)
.
assertTrue
();
}
await
asset
.
close
(
fd
);
done
();
});
await
sleep
(
50
);
}
catch
(
error
)
{
console
.
info
(
`${testNum} failed, error: ${error}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
finally
{
if
(
asset
)
{
await
asset
.
close
(
fd
);
}
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录