Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
051dc2ff
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看板
提交
051dc2ff
编写于
12月 08, 2022
作者:
L
lwx1121892
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify
Signed-off-by:
N
lwx1121892
<
liuxueqi3@huawei.com
>
上级
7a05eaec
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
240 addition
and
656 deletion
+240
-656
multimedia/camera/camera_js_standard/BUILD.gn
multimedia/camera/camera_js_standard/BUILD.gn
+4
-4
multimedia/camera/camera_js_standard/Test.json
multimedia/camera/camera_js_standard/Test.json
+3
-2
multimedia/camera/camera_js_standard/entry/src/config.json
multimedia/camera/camera_js_standard/entry/src/config.json
+28
-0
multimedia/camera/camera_js_standard/entry/src/main/ets/MainAbility/app.ets
...camera_js_standard/entry/src/main/ets/MainAbility/app.ets
+0
-0
multimedia/camera/camera_js_standard/entry/src/main/ets/MainAbility/pages/index.ets
...s_standard/entry/src/main/ets/MainAbility/pages/index.ets
+10
-26
multimedia/camera/camera_js_standard/entry/src/main/ets/TestAbility/app.ets
...camera_js_standard/entry/src/main/ets/TestAbility/app.ets
+23
-0
multimedia/camera/camera_js_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...rd/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
multimedia/camera/camera_js_standard/entry/src/main/ets/test/Camera.test.ets
...amera_js_standard/entry/src/main/ets/test/Camera.test.ets
+11
-13
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets
..._standard/entry/src/main/ets/test/CameraEnumTest.test.ets
+2
-2
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraInputTest.test.ets
...standard/entry/src/main/ets/test/CameraInputTest.test.ets
+32
-64
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets
...ndard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets
+5
-67
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets
...andard/entry/src/main/ets/test/CameraManagerTest.test.ets
+6
-69
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets
...rd/entry/src/main/ets/test/CameraSessionBaseTest.test.ets
+5
-68
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets
...ntry/src/main/ets/test/CameraSessionExposureTest.test.ets
+5
-68
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets
...d/entry/src/main/ets/test/CameraSessionFlashTest.test.ets
+5
-68
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets
...d/entry/src/main/ets/test/CameraSessionFocusTest.test.ets
+5
-68
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets
...ain/ets/test/CameraSessionVideoStabilizationTest.test.ets
+5
-68
multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets
...try/src/main/ets/test/CameraSessionZoomRatioTest.test.ets
+5
-69
multimedia/camera/camera_js_standard/entry/src/resources/base/element/string.json
..._js_standard/entry/src/resources/base/element/string.json
+8
-0
multimedia/camera/camera_js_standard/entry/src/resources/base/media/icon.png
...amera_js_standard/entry/src/resources/base/media/icon.png
+0
-0
multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b
...ia/camera/camera_js_standard/signature/openharmony_sx.p7b
+0
-0
未找到文件。
multimedia/camera/camera_js_standard/BUILD.gn
浏览文件 @
051dc2ff
...
...
@@ -13,7 +13,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("camera_framework_ets_hap") {
hap_profile = "./
src/main
/config.json"
hap_profile = "./
entry/src
/config.json"
deps = [
":camera_ets_assets",
":camera_ets_resources",
...
...
@@ -26,9 +26,9 @@ ohos_js_hap_suite("camera_framework_ets_hap") {
part_name = "multimedia_camera_framework"
}
ohos_js_assets("camera_ets_assets") {
source_dir = "./src/main/ets/MainAbility"
source_dir = "./
entry/
src/main/ets/MainAbility"
}
ohos_resources("camera_ets_resources") {
sources = [ "./
src/main
/resources" ]
hap_profile = "./
src/main
/config.json"
sources = [ "./
entry/src
/resources" ]
hap_profile = "./
entry/src
/config.json"
}
multimedia/camera/camera_js_standard/Test.json
浏览文件 @
051dc2ff
{
"description"
:
"Configuration for camerastandard Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"
OH
JSUnitTest"
,
"test-timeout"
:
"3000000"
,
"package"
:
"com.open.harmony.multimedia.cameratest"
,
"bundle-name"
:
"com.open.harmony.multimedia.cameratest"
,
"package-name"
:
"com.open.harmony.multimedia.cameratest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
...
...
multimedia/camera/camera_js_standard/
src/main
/config.json
→
multimedia/camera/camera_js_standard/
entry/src
/config.json
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -17,6 +17,7 @@
"package"
:
"com.open.harmony.multimedia.cameratest"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
"com.open.harmony.multimedia.cameratest.MainAbility"
,
"srcPath"
:
""
,
"deviceType"
:
[
"tablet"
,
"default"
,
...
...
@@ -51,6 +52,19 @@
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"TestAbility"
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"formsEnabled"
:
false
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"launchType"
:
"standard"
}
],
"reqPermissions"
:
[
...
...
@@ -109,6 +123,20 @@
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/app.ets
→
multimedia/camera/camera_js_standard/
entry/
src/main/ets/MainAbility/app.ets
浏览文件 @
051dc2ff
文件已移动
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/pages/index.ets
→
multimedia/camera/camera_js_standard/
entry/
src/main/ets/MainAbility/pages/index.ets
浏览文件 @
051dc2ff
...
...
@@ -13,9 +13,9 @@
* limitations under the License.
*/
import
{Core, ExpectExtend} from "deccjsunit/index"
import
cameraKit from "../test/Camera.test"
import
featureAbility from "@ohos.ability.featureAbility"
import
AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import
{ Hypium } from '@ohos/hypium'
import
cameraKit from '../../test/Camera.test.ets'
let TAG = 'CameraModuleTest: '
var mXComponentController: XComponentController = new XComponentController()
...
...
@@ -43,30 +43,14 @@ struct CameraIndex {
console.info('CameraModuleTest: OnLoad() is called!')
mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 1920, surfaceHeight: 1080 });
surfaceId = mXComponentController.getXComponentSurfaceId()
globalThis.surfaceId = surfaceId
console.info('CameraModuleTest: XComponent onLoad surfaceId: ' + surfaceId)
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
console.info(TAG + 'Entering expectExtend')
core.addService('expect', expectExtend)
console.info(TAG + 'Entering addService')
core.init()
console.info(TAG + 'Entering core.init()')
console.info(TAG + 'Entering subscribeEvent')
const configService = core.getDefaultService('config')
Want.parameters['timeout'] = 600000
configService.setConfig(Want.parameters)
console.info(TAG + 'Entering configService')
cameraKit(surfaceId)
core.execute()
console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error));
})
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
//console.info(0x00, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, cameraKit)
})
.width('1920px')
.height('1080px')
...
...
multimedia/camera/camera_js_standard/entry/src/main/ets/TestAbility/app.ets
0 → 100644
浏览文件 @
051dc2ff
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
multimedia/camera/camera_js_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
051dc2ff
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
TestRunner
from
'
@ohos.application.testRunner
'
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
=
undefined
var
abilityDelegatorArguments
=
undefined
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
async
function
onAbilityCreateCallback
()
{
console
.
log
(
'
onAbilityCreateCallback
'
);
}
async
function
addAbilityMonitorCallback
(
err
:
any
)
{
console
.
info
(
'
addAbilityMonitorCallback :
'
+
JSON
.
stringify
(
err
))
}
export
default
class
OpenHarmonyTestRunner
implements
TestRunner
{
constructor
()
{
}
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
}
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.MainAbility
'
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
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 call abilityDelegator.getAppContext
'
)
var
context
=
abilityDelegator
.
getAppContext
()
console
.
info
(
'
getAppContext :
'
+
JSON
.
stringify
(
context
))
console
.
info
(
'
OpenHarmonyTestRunner onRun end
'
)
}
};
\ No newline at end of file
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/Camera.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/Camera.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -27,18 +27,16 @@ import cameraEnumTest from './CameraEnumTest.test.ets'
let TAG = 'CameraModuleTest: '
export default function cameraKit(
surfaceId: any
) {
export default function cameraKit() {
console.info(TAG + 'Entering cameraKit')
console.info(TAG + 'surfaceId: ' + surfaceId)
cameraInputTest(surfaceId)
cameraJSUnitOutput(surfaceId)
cameraSessionFlashTest(surfaceId)
cameraSessionExposureTest(surfaceId)
cameraSessionFocusTest(surfaceId)
cameraSessionZoomRatioTest(surfaceId)
cameraSessionVideoStabilizationTest(surfaceId)
cameraSessionBaseTest(surfaceId)
cameraManagerTest(surfaceId)
cameraEnumTest(surfaceId)
cameraInputTest()
cameraJSUnitOutput()
cameraSessionFlashTest()
cameraSessionExposureTest()
cameraSessionFocusTest()
cameraSessionZoomRatioTest()
cameraSessionVideoStabilizationTest()
cameraSessionBaseTest()
cameraManagerTest()
cameraEnumTest()
}
\ No newline at end of file
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraEnumTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraEnumTest.test.ets
浏览文件 @
051dc2ff
...
...
@@ -14,11 +14,11 @@
*/
import camera from '@ohos.multimedia.camera';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '
deccjsunit/index
';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '
@ohos/hypium
';
const TAG = "CameraEnumTest: ";
export default function cameraEnumTest(
surfaceId: any
) {
export default function cameraEnumTest() {
function isEmpty(data) {
if (data == null || data == undefined) {
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraInputTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraInputTest.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -14,10 +14,9 @@
*/
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'deccjsunit/index'
;
import
featureAbility
from
'@ohos.ability.featureAbility'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
;
import
{
UiDriver
,
BY
}
from
'@ohos.uitest'
const
TAG
=
"CameraInputTest: "
;
...
...
@@ -31,7 +30,7 @@ let mCameraNum;
let
mCameraInput
;
let
mPreviewOutput
;
export
default
function
CameraInputTest
(
surfaceId
)
{
export
default
function
CameraInputTest
()
{
function
sleep
(
ms
)
{
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
...
@@ -44,65 +43,32 @@ export default function CameraInputTest(surfaceId) {
return
false
;
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
async
function
getPermission
()
{
let
permissions
=
[
'ohos.permission.CAMERA'
,
'ohos.permission.MICROPHONE'
,
'ohos.permission.MEDIA_LOCATION'
,
'ohos.permission.READ_MEDIA'
,
'ohos.permission.WRITE_MEDIA'
,
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
];
featureAbility
.
getContext
()
.
requestPermissionsFromUser
(
permissions
,
0
,
(
data
)
=>
{
console
.
info
(
"request success"
+
JSON
.
stringify
(
data
));
})
}
async
function
driveFn
()
{
console
.
info
(
`come in driveFn`
);
let
driver
=
await
UiDriver
.
create
();
console
.
info
(
`driver is ${JSON.stringify(driver)}`
);
await
sleep
(
2000
);
console
.
info
(
`UiDriver start`
);
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'允许'
));
while
(
button
){
console
.
info
(
`button is ${JSON.stringify(button)}`
);
await
button
.
click
();
await
sleep
(
1000
);
button
=
await
driver
.
findComponent
(
BY
.
text
(
'允许'
));
}
}
async
function
getCameraManagerInstance
()
{
console
.
info
(
'Enter getCameraManagerInstance'
);
...
...
@@ -282,7 +248,7 @@ export default function CameraInputTest(surfaceId) {
if
(
!
isEmpty
(
cameraOutputCap
.
previewProfiles
))
{
console
.
info
(
TAG
+
"cameraOutputCap.previewProfiles.length: "
+
cameraOutputCap
.
previewProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
previewProfiles
.
length
;
i
++
)
{
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
surfaceId
);
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
globalThis
.
surfaceId
);
if
(
!
isEmpty
(
mPreviewOutput
))
{
break
;
}
...
...
@@ -365,7 +331,9 @@ export default function CameraInputTest(surfaceId) {
describe
(
'CameraInputTest'
,
function
()
{
console
.
info
(
TAG
+
'----------CameraInputTest--------------'
);
beforeAll
(
async
function
()
{
await
applyPermission
();
await
getPermission
();
sleep
(
1000
);
await
driveFn
();
await
getCameraManagerInstance
();
await
getCameraSupportDevicesArray
();
await
createCameraSessionInstance
();
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraJSUnitOutput.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraJSUnitOutput.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -14,11 +14,9 @@
*/
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
media
from
'@ohos.multimedia.media'
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'deccjsunit/index'
;
import
media
from
'@ohos.multimedia.media'
;
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
;
const
TAG
=
"CameraUnitTest: "
;
...
...
@@ -80,7 +78,7 @@ let fdNumber;
let
mMetadataObjectTypeArray
;
let
mMetadataObjectArray
;
export
default
function
cameraJSUnitOutput
(
surfaceId
:
any
)
{
export
default
function
cameraJSUnitOutput
()
{
async
function
getImageReceiverSurfaceId
()
{
console
.
log
(
TAG
+
'Entering create Image receiver'
)
...
...
@@ -179,65 +177,6 @@ export default function cameraJSUnitOutput(surfaceId: any) {
return
false
;
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
}
}
function
getSupportedOutputCapabilityInPromise
(
cameraDevice
)
{
if
(
isEmpty
(
cameraManager
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 cameraManager == null || undefined"
)
...
...
@@ -255,7 +194,6 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console
.
info
(
TAG
+
'----------cameraJSUnitOutput begin--------------'
)
beforeAll
(
async
function
()
{
await
applyPermission
();
await
getImageReceiverSurfaceId
();
await
getvideosurface
();
console
.
info
(
'beforeAll case'
);
...
...
@@ -420,7 +358,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 previewProfilesArray == null || undefined"
)
expect
(
isEmpty
(
previewProfilesArray
))
.
assertFalse
();
}
cameraManager
.
createPreviewOutput
(
previewProfilesArray
[
0
],
surfaceId
,
async
(
err
,
data
)
=>
{
cameraManager
.
createPreviewOutput
(
previewProfilesArray
[
0
],
globalThis
.
surfaceId
,
async
(
err
,
data
)
=>
{
if
(
!
err
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 is not error"
);
expect
(
isEmpty
(
data
))
.
assertFalse
();
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraManagerTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraManagerTest.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -15,12 +15,9 @@
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
fileio
from
'@ohos.fileio'
;
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
import
media
from
'@ohos.multimedia.media'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'deccjsunit/index'
;
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
;
import
media
from
'@ohos.multimedia.media'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'@ohos/hypium'
;
const
TAG
=
"CameraUnitTest: "
;
...
...
@@ -63,7 +60,7 @@ let mVideoConfig = {
maxDuration
:
500
}
export
default
function
cameraManagerTest
(
surfaceId
:
any
)
{
export
default
function
cameraManagerTest
()
{
async
function
getImageReceiverSurfaceId
()
{
console
.
log
(
TAG
+
'Entering create Image receiver'
)
...
...
@@ -262,70 +259,10 @@ export default function cameraManagerTest(surfaceId: any) {
return
outputCapabilityPromise
;
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
}
}
describe
(
'CameraManagerTest'
,
function
()
{
console
.
info
(
TAG
+
'----------CameraManagerTest--------------'
)
beforeAll
(
async
function
()
{
await
applyPermission
();
await
getCameraManagerInstance
();
await
getImageReceiverSurfaceId
();
await
getVideoReceiveSurface
();
...
...
@@ -855,7 +792,7 @@ describe('CameraManagerTest', function () {
expect
()
.
assertFail
();
}
else
{
for
(
let
j
=
0
;
j
<
previewProfilesArray
.
length
;
j
++
)
{
mCameraManager
.
createPreviewOutput
(
previewProfilesArray
[
j
],
surfaceId
,
async
(
err
,
data
)
=>
{
mCameraManager
.
createPreviewOutput
(
previewProfilesArray
[
j
],
globalThis
.
surfaceId
,
async
(
err
,
data
)
=>
{
if
(
isEmpty
(
data
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 data == null || undefined"
)
expect
()
.
assertFail
();
...
...
@@ -893,7 +830,7 @@ describe('CameraManagerTest', function () {
expect
()
.
assertFail
();
}
else
{
for
(
let
j
=
0
;
j
<
previewProfilesArray
.
length
;
j
++
)
{
let
previewOutputPromise
=
await
mCameraManager
.
createPreviewOutput
(
previewProfilesArray
[
j
],
surfaceId
);
let
previewOutputPromise
=
await
mCameraManager
.
createPreviewOutput
(
previewProfilesArray
[
j
],
globalThis
.
surfaceId
);
if
(
isEmpty
(
previewOutputPromise
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 previewOutputPromise == null || undefined"
)
expect
()
.
assertFail
();
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraSessionBaseTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraSessionBaseTest.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -17,13 +17,10 @@
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
media
from
'@ohos.multimedia.media'
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
import
fileio
from
'@ohos.fileio'
;
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
media
from
'@ohos.multimedia.media'
;
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
;
import
deviceInfo
from
'@ohos.deviceInfo'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
const
TAG
=
"CameraModuleTest: "
;
...
...
@@ -72,7 +69,7 @@ let mVideoConfig = {
maxDuration
:
500
}
export
default
function
cameraSessionTest
(
surfaceId
:
any
)
{
export
default
function
cameraSessionTest
()
{
function
sleep
(
ms
)
{
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
...
...
@@ -118,65 +115,6 @@ export default function cameraSessionTest(surfaceId: any) {
}
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
}
}
async
function
getPhotoReceiverSurface
()
{
console
.
log
(
TAG
+
'Entering getPhotoReceiverSurface'
)
let
receiver
=
image
.
createImageReceiver
(
640
,
480
,
4
,
8
)
...
...
@@ -413,7 +351,7 @@ export default function cameraSessionTest(surfaceId: any) {
if
(
!
isEmpty
(
cameraOutputCap
.
previewProfiles
))
{
console
.
info
(
TAG
+
"cameraOutputCap.previewProfiles.length: "
+
cameraOutputCap
.
previewProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
previewProfiles
.
length
;
i
++
)
{
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
surfaceId
);
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
globalThis
.
surfaceId
);
if
(
!
isEmpty
(
mPreviewOutput
))
{
break
;
}
...
...
@@ -592,7 +530,6 @@ export default function cameraSessionTest(surfaceId: any) {
beforeAll
(
async
function
()
{
sleep
(
100
);
await
applyPermission
();
await
getPhotoReceiverSurface
();
await
getVideoReceiveSurface
();
await
getCameraManagerInstance
();
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraSessionExposureTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraSessionExposureTest.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -17,13 +17,10 @@
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
media
from
'@ohos.multimedia.media'
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
import
fileio
from
'@ohos.fileio'
;
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
media
from
'@ohos.multimedia.media'
;
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
;
import
deviceInfo
from
'@ohos.deviceInfo'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
const
TAG
=
"CameraModuleTest: "
;
...
...
@@ -127,7 +124,7 @@ let mMETERINGPointInvalidRB = {
let
mEnableCheckInvalidMETERINGPoint
=
false
;
export
default
function
cameraSessionExposureTest
(
surfaceId
:
any
)
{
export
default
function
cameraSessionExposureTest
()
{
function
sleep
(
ms
)
{
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
...
...
@@ -173,65 +170,6 @@ export default function cameraSessionExposureTest(surfaceId: any) {
}
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
}
}
async
function
getPhotoReceiverSurface
()
{
console
.
log
(
TAG
+
'Entering getPhotoReceiverSurface'
)
let
receiver
=
image
.
createImageReceiver
(
640
,
480
,
4
,
8
)
...
...
@@ -473,7 +411,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
if
(
!
isEmpty
(
cameraOutputCap
.
previewProfiles
))
{
console
.
info
(
TAG
+
"cameraOutputCap.previewProfiles.length: "
+
cameraOutputCap
.
previewProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
previewProfiles
.
length
;
i
++
)
{
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
surfaceId
);
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
globalThis
.
surfaceId
);
if
(
!
isEmpty
(
mPreviewOutput
))
{
break
;
}
...
...
@@ -651,7 +589,6 @@ export default function cameraSessionExposureTest(surfaceId: any) {
beforeAll
(
async
function
()
{
sleep
(
100
);
await
applyPermission
();
await
getPhotoReceiverSurface
();
await
getVideoReceiveSurface
();
await
getCameraManagerInstance
();
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraSessionFlashTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraSessionFlashTest.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -17,13 +17,10 @@
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
media
from
'@ohos.multimedia.media'
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
import
fileio
from
'@ohos.fileio'
;
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
media
from
'@ohos.multimedia.media'
;
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
;
import
deviceInfo
from
'@ohos.deviceInfo'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
const
TAG
=
"CameraModuleTest: "
;
...
...
@@ -78,7 +75,7 @@ let mVideoConfig = {
let
mPicWidthMax
=
8192
;
let
mPicHeightMax
=
8192
;
export
default
function
cameraSessionFlashTest
(
surfaceId
:
any
)
{
export
default
function
cameraSessionFlashTest
()
{
function
sleep
(
ms
)
{
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
...
...
@@ -124,65 +121,6 @@ export default function cameraSessionFlashTest(surfaceId: any) {
}
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
}
}
async
function
getPhotoReceiverSurface
()
{
console
.
log
(
TAG
+
'Entering getPhotoReceiverSurface'
)
let
receiver
=
image
.
createImageReceiver
(
640
,
480
,
4
,
8
)
...
...
@@ -424,7 +362,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
if
(
!
isEmpty
(
cameraOutputCap
.
previewProfiles
))
{
console
.
info
(
TAG
+
"cameraOutputCap.previewProfiles.length: "
+
cameraOutputCap
.
previewProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
previewProfiles
.
length
;
i
++
)
{
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
surfaceId
);
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
globalThis
.
surfaceId
);
if
(
!
isEmpty
(
mPreviewOutput
))
{
break
;
}
...
...
@@ -602,7 +540,6 @@ export default function cameraSessionFlashTest(surfaceId: any) {
beforeAll
(
async
function
()
{
sleep
(
100
);
await
applyPermission
();
await
getPhotoReceiverSurface
();
await
getVideoReceiveSurface
();
await
mgetCameraManagerInstance
();
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraSessionFocusTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraSessionFocusTest.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -17,13 +17,10 @@
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
media
from
'@ohos.multimedia.media'
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
import
fileio
from
'@ohos.fileio'
;
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
media
from
'@ohos.multimedia.media'
;
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
;
import
deviceInfo
from
'@ohos.deviceInfo'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
const
TAG
=
"CameraModuleTest: "
;
...
...
@@ -124,7 +121,7 @@ let mFocusPointInvalidRB = {
let
mEnableCheckInvalidFocusPoint
=
false
;
export
default
function
cameraSessionFocusTest
(
surfaceId
:
any
)
{
export
default
function
cameraSessionFocusTest
()
{
function
sleep
(
ms
)
{
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
...
...
@@ -170,65 +167,6 @@ export default function cameraSessionFocusTest(surfaceId: any) {
}
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
}
}
async
function
getPhotoReceiverSurface
()
{
console
.
log
(
TAG
+
'Entering getPhotoReceiverSurface'
)
let
receiver
=
image
.
createImageReceiver
(
640
,
480
,
4
,
8
)
...
...
@@ -469,7 +407,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
if
(
!
isEmpty
(
cameraOutputCap
.
previewProfiles
))
{
console
.
info
(
TAG
+
"cameraOutputCap.previewProfiles.length: "
+
cameraOutputCap
.
previewProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
previewProfiles
.
length
;
i
++
)
{
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
surfaceId
);
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
globalThis
.
surfaceId
);
if
(
!
isEmpty
(
mPreviewOutput
))
{
break
;
}
...
...
@@ -647,7 +585,6 @@ export default function cameraSessionFocusTest(surfaceId: any) {
beforeAll
(
async
function
()
{
sleep
(
100
);
await
applyPermission
();
await
getPhotoReceiverSurface
();
await
getVideoReceiveSurface
();
await
getCameraManagerInstance
();
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraSessionVideoStabilizationTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraSessionVideoStabilizationTest.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -17,13 +17,10 @@
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
media
from
'@ohos.multimedia.media'
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
import
fileio
from
'@ohos.fileio'
;
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
media
from
'@ohos.multimedia.media'
;
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
;
import
deviceInfo
from
'@ohos.deviceInfo'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
const
TAG
=
"CameraModuleTest: "
;
...
...
@@ -77,7 +74,7 @@ let mVideoConfig = {
let
mPicWidthMax
=
8192
;
let
mPicHeightMax
=
8192
;
export
default
function
cameraSessionVideoStabilizationTest
(
surfaceId
:
any
)
{
export
default
function
cameraSessionVideoStabilizationTest
()
{
function
sleep
(
ms
)
{
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
...
...
@@ -123,65 +120,6 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
}
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
}
}
async
function
getPhotoReceiverSurface
()
{
console
.
log
(
TAG
+
'Entering getPhotoReceiverSurface'
)
let
receiver
=
image
.
createImageReceiver
(
640
,
480
,
4
,
8
)
...
...
@@ -422,7 +360,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
if
(
!
isEmpty
(
cameraOutputCap
.
previewProfiles
))
{
console
.
info
(
TAG
+
"cameraOutputCap.previewProfiles.length: "
+
cameraOutputCap
.
previewProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
previewProfiles
.
length
;
i
++
)
{
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
surfaceId
);
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
globalThis
.
surfaceId
);
if
(
!
isEmpty
(
mPreviewOutput
))
{
break
;
}
...
...
@@ -600,7 +538,6 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
beforeAll
(
async
function
()
{
sleep
(
100
);
await
applyPermission
();
await
getPhotoReceiverSurface
();
await
getVideoReceiveSurface
();
await
getCameraManagerInstance
();
...
...
multimedia/camera/camera_js_standard/
src/main/ets/MainAbility
/test/CameraSessionZoomRatioTest.test.ets
→
multimedia/camera/camera_js_standard/
entry/src/main/ets
/test/CameraSessionZoomRatioTest.test.ets
100755 → 100644
浏览文件 @
051dc2ff
...
...
@@ -17,13 +17,10 @@
import
cameraObj
from
'@ohos.multimedia.camera'
;
import
image
from
'@ohos.multimedia.image'
;
import
media
from
'@ohos.multimedia.media'
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
import
fileio
from
'@ohos.fileio'
;
import
abilityAccessCtrl
from
'@ohos.abilityAccessCtrl'
import
bundle
from
'@ohos.bundle'
import
media
from
'@ohos.multimedia.media'
;
import
mediaLibrary
from
'@ohos.multimedia.mediaLibrary'
;
import
deviceInfo
from
'@ohos.deviceInfo'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
const
TAG
=
"CameraModuleTest: "
;
...
...
@@ -79,7 +76,7 @@ let mVideoConfig = {
let
mPicWidthMax
=
8192
;
let
mPicHeightMax
=
8192
;
export
default
function
cameraSessionZoomRatioTest
(
surfaceId
:
any
)
{
export
default
function
cameraSessionZoomRatioTest
()
{
function
sleep
(
ms
)
{
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
...
...
@@ -125,65 +122,6 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
}
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'com.open.harmony.multimedia.cameratest'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'[permission] case accessTokenID is '
+
tokenID
);
let
permissionName1
=
'ohos.permission.CAMERA'
;
let
permissionName2
=
'ohos.permission.MICROPHONE'
;
let
permissionName3
=
'ohos.permission.MEDIA_LOCATION'
;
let
permissionName4
=
'ohos.permission.READ_MEDIA'
;
let
permissionName5
=
'ohos.permission.WRITE_MEDIA'
;
let
permissionName6
=
'ohos.permission.START_ABILIIES_FROM_BACKGROUND'
;
let
permissionName7
=
'ohos.permission.START_INVISIBLE_ABILITY'
;
let
permissionName8
=
'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName4
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName5
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName6
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName7
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName8
,
1
)
.
then
((
result
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission success :'
+
result
);
})
.
catch
((
err
)
=>
{
console
.
info
(
'[permission] case grantUserGrantedPermission failed :'
+
err
);
});
}
else
{
console
.
info
(
'[permission] case apply permission failed, createAtManager failed'
);
}
}
async
function
getPhotoReceiverSurface
()
{
console
.
log
(
TAG
+
'Entering getPhotoReceiverSurface'
)
let
receiver
=
image
.
createImageReceiver
(
640
,
480
,
4
,
8
)
...
...
@@ -426,7 +364,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
if
(
!
isEmpty
(
cameraOutputCap
.
previewProfiles
))
{
console
.
info
(
TAG
+
"cameraOutputCap.previewProfiles.length: "
+
cameraOutputCap
.
previewProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
previewProfiles
.
length
;
i
++
)
{
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
surfaceId
);
mPreviewOutput
=
await
mCameraManager
.
createPreviewOutput
(
cameraOutputCap
.
previewProfiles
[
i
],
globalThis
.
surfaceId
);
if
(
!
isEmpty
(
mPreviewOutput
))
{
break
;
}
...
...
@@ -604,8 +542,6 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
beforeAll
(
async
function
()
{
sleep
(
100
);
await
applyPermission
();
await
getPhotoReceiverSurface
();
await
getVideoReceiveSurface
();
await
getCameraManagerInstance
();
...
...
multimedia/camera/camera_js_standard/
src/main
/resources/base/element/string.json
→
multimedia/camera/camera_js_standard/
entry/src
/resources/base/element/string.json
浏览文件 @
051dc2ff
...
...
@@ -7,6 +7,14 @@
{
"name"
:
"description_mainability"
,
"value"
:
"eTS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
multimedia/camera/camera_js_standard/
src/main
/resources/base/media/icon.png
→
multimedia/camera/camera_js_standard/
entry/src
/resources/base/media/icon.png
浏览文件 @
051dc2ff
文件已移动
multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b
浏览文件 @
051dc2ff
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录