Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c5a8cb79
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看板
提交
c5a8cb79
编写于
7月 28, 2023
作者:
Q
qinliwen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
录屏录音用例上库
Signed-off-by:
N
qinliwen
<
qinliwen3@huawei.com
>
上级
ab683ac7
变更
22
展开全部
隐藏空白更改
内联
并排
Showing
22 changed file
with
9977 addition
and
9552 deletion
+9977
-9552
multimedia/audio/audio_js_standard/AudioCapturer/BUILD.gn
multimedia/audio/audio_js_standard/AudioCapturer/BUILD.gn
+35
-35
multimedia/audio/audio_js_standard/AudioCapturer/Test.json
multimedia/audio/audio_js_standard/AudioCapturer/Test.json
+40
-37
multimedia/audio/audio_js_standard/AudioCapturer/src/main/config.json
...udio/audio_js_standard/AudioCapturer/src/main/config.json
+110
-110
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/app.js
..._js_standard/AudioCapturer/src/main/js/MainAbility/app.js
+22
-22
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/i18n/en-US.json
...ard/AudioCapturer/src/main/js/MainAbility/i18n/en-US.json
+5
-5
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/i18n/zh-CN.json
...ard/AudioCapturer/src/main/js/MainAbility/i18n/zh-CN.json
+5
-5
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/pages/index/index.css
...dioCapturer/src/main/js/MainAbility/pages/index/index.css
+24
-24
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/pages/index/index.hml
...dioCapturer/src/main/js/MainAbility/pages/index/index.hml
+21
-21
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/pages/index/index.js
...udioCapturer/src/main/js/MainAbility/pages/index/index.js
+33
-33
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/app.js
..._js_standard/AudioCapturer/src/main/js/TestAbility/app.js
+31
-31
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/i18n/en-US.json
...ard/AudioCapturer/src/main/js/TestAbility/i18n/en-US.json
+7
-7
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/i18n/zh-CN.json
...ard/AudioCapturer/src/main/js/TestAbility/i18n/zh-CN.json
+7
-7
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/pages/index/index.css
...dioCapturer/src/main/js/TestAbility/pages/index/index.css
+29
-29
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/pages/index/index.hml
...dioCapturer/src/main/js/TestAbility/pages/index/index.hml
+5
-5
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/pages/index/index.js
...udioCapturer/src/main/js/TestAbility/pages/index/index.js
+26
-26
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestRunner/OpenHarmonyTestRunner.js
...oCapturer/src/main/js/TestRunner/OpenHarmonyTestRunner.js
+59
-59
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
...dard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
+3119
-3119
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturerInterrupt.test.js
...oCapturer/src/main/js/test/AudioCapturerInterrupt.test.js
+1503
-1503
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioPlaybackCapturer.test.js
...ioCapturer/src/main/js/test/AudioPlaybackCapturer.test.js
+420
-0
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/List.test.js
...o_js_standard/AudioCapturer/src/main/js/test/List.test.js
+26
-24
multimedia/audio/audio_js_standard/AudioCapturer/src/main/resources/base/element/string.json
...AudioCapturer/src/main/resources/base/element/string.json
+27
-27
multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioEffect.test.js
...andard/audioRenderer/src/main/js/test/AudioEffect.test.js
+4423
-4423
未找到文件。
multimedia/audio/audio_js_standard/AudioCapturer/BUILD.gn
浏览文件 @
c5a8cb79
# Copyright (C) 2021 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("audio_capturer_js_hap") {
hap_profile = "./src/main/config.json"
deps = [
":audio_capturer_js_assets",
":audio_capturer_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAudioCapturerJsTest"
subsystem_name = "multimedia"
part_name = "audio_framework"
}
ohos_js_assets("audio_capturer_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("audio_capturer_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
# Copyright (C) 2021 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("audio_capturer_js_hap") {
hap_profile = "./src/main/config.json"
deps = [
":audio_capturer_js_assets",
":audio_capturer_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAudioCapturerJsTest"
subsystem_name = "multimedia"
part_name = "audio_framework"
}
ohos_js_assets("audio_capturer_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("audio_capturer_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
multimedia/audio/audio_js_standard/AudioCapturer/Test.json
浏览文件 @
c5a8cb79
{
"description"
:
"Configuration for audio manager Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"1500000"
,
"testcase-timeout"
:
"50000"
,
"bundle-name"
:
"ohos.acts.multimedia.audio.audiocapturer"
,
"package-name"
:
"ohos.acts.multimedia.audio.audiocapturer"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsAudioCapturerJsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"power-shell wakeup"
,
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
,
"power-shell setmode 602"
],
"teardown-command"
:[
"power-shell setmode 600"
],
"cleanup-apps"
:
true
},
{
"type"
:
"PushKit"
,
"pre-push"
:
[],
"push"
:
[
]
}
]
{
"description"
:
"Configuration for audio manager Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"1500000"
,
"testcase-timeout"
:
"50000"
,
"bundle-name"
:
"ohos.acts.multimedia.audio.audiocapturer"
,
"package-name"
:
"ohos.acts.multimedia.audio.audiocapturer"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsAudioCapturerJsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"power-shell wakeup"
,
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100"
,
"power-shell setmode 602"
,
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files"
,
"chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry"
],
"teardown-command"
:[
"power-shell setmode 600"
],
"cleanup-apps"
:
true
},
{
"type"
:
"PushKit"
,
"pre-push"
:
[],
"push"
:
[
"./resource/media/audioplayer/wav/pcm_48ksr_32kbr_2ch.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/"
]
}
]
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioCapturer/src/main/config.json
浏览文件 @
c5a8cb79
{
"app"
:
{
"bundleName"
:
"ohos.acts.multimedia.audio.audiocapturer"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
5
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.multimedia.audio.audiocapturer"
,
"name"
:
".entry"
,
"deviceType"
:
[
"tablet"
,
"default"
,
"phone"
,
"2in1"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name"
:
"ohos.permission.MICROPHONE"
,
"reason"
:
"use ohos.permission.MICROPHONE"
},
{
"name"
:
"ohos.permission.MANAGE_AUDIO_CONFIG"
,
"reason"
:
"use ohos.permission.MANAGE_AUDIO_CONFIG"
}
],
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"pages"
:
[
"pages/index/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
],
"testRunner"
:
{
"name"
:
"OpenHarmonyTestRunner"
,
"srcPath"
:
"TestRunner"
},
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
}
{
"app"
:
{
"bundleName"
:
"ohos.acts.multimedia.audio.audiocapturer"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
5
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.multimedia.audio.audiocapturer"
,
"name"
:
".entry"
,
"deviceType"
:
[
"tablet"
,
"default"
,
"phone"
,
"2in1"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"reason"
:
"use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name"
:
"ohos.permission.MICROPHONE"
,
"reason"
:
"use ohos.permission.MICROPHONE"
},
{
"name"
:
"ohos.permission.MANAGE_AUDIO_CONFIG"
,
"reason"
:
"use ohos.permission.MANAGE_AUDIO_CONFIG"
}
],
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:TestAbility_desc"
,
"label"
:
"$string:TestAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"pages"
:
[
"pages/index/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
],
"testRunner"
:
{
"name"
:
"OpenHarmonyTestRunner"
,
"srcPath"
:
"TestRunner"
},
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
}
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/app.js
浏览文件 @
c5a8cb79
/*
* 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
(
"
============== AceApplication onCreate ==============
"
);
},
onDestroy
()
{
console
.
info
(
'
=============AceApplication onDestroy=============
'
);
}
};
/*
* 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
(
"
============== AceApplication onCreate ==============
"
);
},
onDestroy
()
{
console
.
info
(
'
=============AceApplication onDestroy=============
'
);
}
};
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/i18n/en-US.json
浏览文件 @
c5a8cb79
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/i18n/zh-CN.json
浏览文件 @
c5a8cb79
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/pages/index/index.css
浏览文件 @
c5a8cb79
/*
* 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.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
/*
* 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.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/pages/index/index.hml
浏览文件 @
c5a8cb79
/*
* 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.
*/
<div class="container">
<text class="title">
Hello, World!
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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.
*/
<div class="container">
<text class="title">
Hello, World!
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/MainAbility/pages/index/index.js
浏览文件 @
c5a8cb79
/*
* 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
file
from
'
@system.file
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
},
onReady
()
{
},
}
/*
* 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
file
from
'
@system.file
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
},
onReady
()
{
},
}
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/app.js
浏览文件 @
c5a8cb79
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
)
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
},
onDestroy
()
{
console
.
info
(
"
TestApplication onDestroy
"
);
}
};
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
)
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
},
onDestroy
()
{
console
.
info
(
"
TestApplication onDestroy
"
);
}
};
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/i18n/en-US.json
浏览文件 @
c5a8cb79
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/i18n/zh-CN.json
浏览文件 @
c5a8cb79
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/pages/index/index.css
浏览文件 @
c5a8cb79
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/pages/index/index.hml
浏览文件 @
c5a8cb79
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestAbility/pages/index/index.js
浏览文件 @
c5a8cb79
/*
* 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
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
}
}
/*
* 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
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
}
}
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/TestRunner/OpenHarmonyTestRunner.js
浏览文件 @
c5a8cb79
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
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
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
export
default
{
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
},
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
console
.
info
(
'
debug value :
'
+
debug
)
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
,
data
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
exitCode
);
})
}
};
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
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
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
export
default
{
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
},
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
console
.
info
(
'
debug value :
'
+
debug
)
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
,
data
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
exitCode
);
})
}
};
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
浏览文件 @
c5a8cb79
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturerInterrupt.test.js
浏览文件 @
c5a8cb79
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioPlaybackCapturer.test.js
0 → 100644
浏览文件 @
c5a8cb79
/*
* Copyright (C) 2021 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
audio
from
'
@ohos.multimedia.audio
'
;
import
fileio
from
'
@ohos.fileio
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
resourceManager
from
'
@ohos.resourceManager
'
;
import
{
afterAll
,
afterEach
,
beforeAll
,
beforeEach
,
describe
,
expect
,
it
}
from
'
@ohos/hypium
'
;
import
{
UiDriver
,
BY
}
from
'
@ohos.UiTest
'
export
default
function
audioCapturer
()
{
describe
(
'
AudioPlaybackCapturer
'
,
function
()
{
let
Tag
=
'
AudioPlaybackCapturerTest
'
;
let
fdRead
;
let
readPath
;
let
fdPath
;
let
filePath
;
let
dirPath
;
const
LE24
=
-
1
;
const
LE32
=
-
1
;
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
async
function
getPermission
()
{
let
permissions
=
[
'
ohos.permission.MICROPHONE
'
];
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
(
100
);
console
.
info
(
`UiDriver start`
);
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'
允许
'
));
console
.
info
(
`button is
${
JSON
.
stringify
(
button
)}
`
);
await
sleep
(
100
);
await
button
.
click
();
}
beforeAll
(
async
function
()
{
await
getPermission
();
await
driveFn
();
console
.
info
(
'
TestLog: Start Testing AudioPlaybackCapturer Interfaces
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
`
${
Tag
}
AudioFrameworkTest: beforeEach: Prerequisites at the test case level`
);
await
sleep
(
1000
);
})
afterEach
(
function
()
{
console
.
info
(
`
${
Tag
}
AudioFrameworkTest: afterEach: Test case-level clearance conditions`
);
})
afterAll
(
function
()
{
console
.
info
(
`
${
Tag
}
AudioFrameworkTest: afterAll: Test suite-level cleanup condition`
);
})
async
function
closeFileDescriptor
(
fileName
)
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(
value
=>
{
console
.
log
(
`
${
Tag
}
:case closeRawFileDescriptor success for file:
${
fileName
}
`
);
}).
catch
(
error
=>
{
console
.
log
(
`
${
Tag
}
:case closeRawFileDescriptor err:
${
error
}
`
);
});
});
}
async
function
getFd
(
fileName
)
{
let
context
=
await
featureAbility
.
getContext
();
await
context
.
getFilesDir
().
then
((
data
)
=>
{
dirPath
=
data
+
'
/
'
+
fileName
;
console
.
info
(
`
${
Tag
}
case2 dirPath is
${
JSON
.
stringify
(
dirPath
)}
`
);
})
}
async
function
getFdRead
(
pathName
,
done
)
{
let
context
=
await
featureAbility
.
getContext
();
console
.
info
(
`case0 context is :
${
context
}
`
);
await
context
.
getFilesDir
().
then
((
data
)
=>
{
console
.
info
(
`case1 getFilesDir is path :
${
data
}
`
);
filePath
=
data
+
'
/
'
+
pathName
;
console
.
info
(
`case4 filePath is :
${
filePath
}
`
);
})
fdPath
=
'
fd://
'
;
await
fileio
.
open
(
filePath
).
then
((
fdNumber
)
=>
{
fdPath
=
fdPath
+
''
+
fdNumber
;
fdRead
=
fdNumber
;
console
.
info
(
`[fileIO]case open fd success,fdPath is :
${
fdPath
}
`
);
console
.
info
(
`[fileIO]case open fd success,fdRead is :
${
fdRead
}
`
);
},
(
err
)
=>
{
console
.
info
(
`[fileIO]case open fd failed :
${
err
}
`
);
}).
catch
((
error
)
=>
{
console
.
info
(
`[fileIO]case catch open fd error :
${
error
}
`
);
});
}
async
function
playbackPromise
(
AudioRendererOptions
,
pathName
)
{
let
resultFlag
=
false
;
let
audioRen
;
let
isPass
=
false
;
await
audio
.
createAudioRenderer
(
AudioRendererOptions
).
then
((
data
)
=>
{
audioRen
=
data
;
console
.
info
(
`
${
Tag
}
: AudioRender Created : Success : Stream Type: SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
Tag
}
: AudioRender Created : ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
console
.
log
(
`isPass:
${
isPass
}
`
);
if
(
isPass
)
{
resultFlag
=
true
;
return
resultFlag
;
}
console
.
info
(
`
${
Tag
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
await
audioRen
.
start
().
then
(()
=>
{
console
.
info
(
`
${
Tag
}
: renderInstant started :SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
Tag
}
: renderInstant start :ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
console
.
info
(
`
${
Tag
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
let
bufferSize
;
await
audioRen
.
getBufferSize
().
then
((
data
)
=>
{
console
.
info
(
`
${
Tag
}
: getBufferSize :SUCCESS
${
data
}
`
);
bufferSize
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
Tag
}
: getBufferSize :ERROR :
${
err
.
message
}
`
);
resultFlag
=
false
;
});
let
ss
=
fileio
.
fdopenStreamSync
(
fdRead
,
'
r
'
);
console
.
info
(
`
${
Tag
}
:case 2:AudioFrameworkRenderLog: File Path:
${
ss
}
`
);
let
discardHeader
=
new
ArrayBuffer
(
44
);
console
.
info
(
`
${
Tag
}
:case 2-1:AudioFrameworkRenderLog: File Path: `
);
ss
.
readSync
(
discardHeader
);
console
.
info
(
`
${
Tag
}
:case 2-2:AudioFrameworkRenderLog: File Path: `
);
let
totalSize
=
fileio
.
fstatSync
(
fdRead
).
size
;
console
.
info
(
`
${
Tag
}
:case 3 : AudioFrameworkRenderLog: File totalSize size:
${
totalSize
}
`
);
totalSize
=
totalSize
-
44
;
console
.
info
(
`
${
Tag
}
: File size : Removing header:
${
totalSize
}
`
);
let
rlen
=
0
;
while
(
rlen
<
totalSize
/
4
)
{
let
buf
=
new
ArrayBuffer
(
bufferSize
);
rlen
+=
ss
.
readSync
(
buf
);
console
.
info
(
`
${
Tag
}
:BufferAudioFramework: bytes read from file:
${
rlen
}
`
);
await
audioRen
.
write
(
buf
);
}
console
.
info
(
`
${
Tag
}
: Renderer after read`
);
await
audioRen
.
drain
().
then
(()
=>
{
console
.
info
(
`
${
Tag
}
: Renderer drained : SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`
${
Tag
}
: Renderer drain: ERROR :
${
err
.
message
}
`
);
});
console
.
info
(
`
${
Tag
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
await
audioRen
.
stop
().
then
(()
=>
{
console
.
info
(
`
${
Tag
}
: Renderer stopped : SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
Tag
}
: Renderer stop:ERROR :
${
err
.
message
}
`
);
});
console
.
info
(
`
${
Tag
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
await
audioRen
.
release
().
then
(()
=>
{
console
.
info
(
`
${
Tag
}
: Renderer release : SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
Tag
}
: Renderer release :ERROR :
${
err
.
message
}
`
);
});
console
.
info
(
`
${
Tag
}
: AudioRenderer : STATE :
${
audioRen
.
state
}
`
);
return
resultFlag
;
}
async
function
recPromise
(
AudioCapturerOptions
,
AudioRendererOptions
,
pathName
,
done
)
{
let
audioCap
;
try
{
audioCap
=
await
audio
.
createAudioCapturer
(
AudioCapturerOptions
);
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: success`
);
}
catch
(
err
)
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: AudioCapturer Created : ERROR :
${
JSON
.
stringify
(
err
.
message
)}
`
);
LE24
=
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S24LE
;
LE32
=
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
;
let
sampleFormat
=
AudioCapturerOptions
.
streamInfo
.
sampleFormat
;
if
((
sampleFormat
==
LE24
||
sampleFormat
==
LE32
)
&&
err
.
code
==
202
)
{
done
();
return
;
}
expect
(
false
).
assertTrue
();
done
();
return
;
}
try
{
let
audioParamsGet
=
await
audioCap
.
getStreamInfo
();
if
(
audioParamsGet
!=
undefined
&&
audioParamsGet
!=
null
)
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: Capturer getStreamInfo:
${
JSON
.
stringify
(
audioParamsGet
)}
`
);
}
else
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: audioParamsGet are incorrect,is :
${
JSON
.
stringify
(
audioParamsGet
)}
`
);
expect
(
false
).
assertTrue
();
}
}
catch
(
err
)
{
console
.
log
(
`
${
Tag
}
AudioFrameworkRecLog: getStreamInfo :ERROR:
${
JSON
.
stringify
(
err
.
message
)}
`
);
expect
(
false
).
assertTrue
();
}
try
{
let
audioParamsGet
=
await
audioCap
.
getCapturerInfo
();
if
(
audioParamsGet
!=
undefined
)
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: Capturer CapturerInfo:
${
JSON
.
stringify
(
audioParamsGet
)}
`
);
}
else
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: audioParamsGet are incorrect , is :
${
JSON
.
stringify
(
audioParamsGet
)}
`
);
expect
(
false
).
assertTrue
();
}
}
catch
(
err
)
{
console
.
log
(
`
${
Tag
}
AudioFrameworkRecLog: CapturerInfo :ERROR:
${
JSON
.
stringify
(
err
.
message
)}
`
);
expect
(
false
).
assertTrue
();
}
try
{
await
audioCap
.
start
();
console
.
log
(
`
${
Tag
}
start ok`
);
await
playbackPromise
(
AudioRendererOptions
,
pathName
);
let
bufferSize
=
await
audioCap
.
getBufferSize
();
console
.
log
(
`
${
Tag
}
bufferSize:
${
JSON
.
stringify
(
bufferSize
)}
, dirPath:
${
JSON
.
stringify
(
dirPath
)}
`
);
let
fd
=
fileio
.
openSync
(
dirPath
,
0o102
,
0o777
);
console
.
log
(
`
${
Tag
}
fd:
${
JSON
.
stringify
(
fd
)}
`
);
if
(
fd
!==
null
)
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: file fd created`
);
}
else
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: Capturer start : ERROR `
);
expect
(
false
).
assertTrue
();
}
fd
=
fileio
.
openSync
(
dirPath
,
0o2002
,
0o666
);
console
.
log
(
`
${
Tag
}
fd-re:
${
JSON
.
stringify
(
fd
)}
`
);
if
(
fd
!==
null
)
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: file fd opened : Append Mode :PASS`
);
}
else
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: file fd Open: Append Mode : FAILED`
);
expect
(
false
).
assertTrue
();
}
let
numBuffersToCapture
=
45
;
while
(
numBuffersToCapture
)
{
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: ---------READ BUFFER---------`
);
let
buffer
=
await
audioCap
.
read
(
bufferSize
,
true
);
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog: ---------WRITE BUFFER---------`
);
let
number
=
fileio
.
writeSync
(
fd
,
buffer
);
console
.
info
(
`
${
Tag
}
AudioFrameworkRecLog:BufferRecLog: data written:
${
JSON
.
stringify
(
number
)}
`
);
numBuffersToCapture
--
;
}
console
.
log
(
`
${
Tag
}
read ok`
);
await
audioCap
.
stop
();
console
.
log
(
`
${
Tag
}
stop ok`
);
}
catch
(
err
)
{
console
.
log
(
`
${
Tag
}
start-read-stop err:
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
}
try
{
await
audioCap
.
release
();
console
.
log
(
`
${
Tag
}
release ok`
);
}
catch
(
err
)
{
console
.
log
(
`
${
Tag
}
release err:
${
JSON
.
stringify
(
err
)}
`
);
expect
(
false
).
assertTrue
();
}
done
();
}
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_INNER_CAPTURER_PROMISE_0100
*@tc.name : SOURCE_TYPE_PLAYBACK_CAPTURER_PRIVACY_TYPE_PUBLIC
*@tc.desc : SOURCE_TYPE_PLAYBACK_CAPTURER_PRIVACY_TYPE_PUBLIC
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_INNER_CAPTURER_PROMISE_0100
'
,
2
,
async
function
(
done
)
{
let
audioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_48000
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
,
}
let
audioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_PLAYBACK_CAPTURE
,
capturerFlags
:
0
}
let
playbackCaptureConfig
=
{
CaptureFilterOptions
:
[
{
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_MEDIA
}
]
}
let
audioCapturerOptions
=
{
streamInfo
:
audioStreamInfo
,
capturerInfo
:
audioCapturerInfo
,
playbackCaptureConfig
:
playbackCaptureConfig
,
}
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_48000
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_MEDIA
,
rendererFlags
:
0
}
let
AudioPrivacyType
=
{
privacyType
:
audio
.
AudioPrivacyType
.
PRIVACY_TYPE_PUBLIC
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
,
privacyType
:
AudioPrivacyType
}
readPath
=
'
pcm_48ksr_32kbr_2ch.wav
'
await
getFdRead
(
readPath
,
done
);
await
getFd
(
"
capture_js-48000-2C-1S32LE.pcm
"
);
await
recPromise
(
audioCapturerOptions
,
AudioRendererOptions
,
filePath
,
done
);
await
sleep
(
100
);
await
closeFileDescriptor
(
readPath
);
done
();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_INNER_CAPTURER_PROMISE_0200
*@tc.name : SOURCE_TYPE_PLAYBACK_CAPTURER_PRIVACY_TYPE_PUBLIC
*@tc.desc : SOURCE_TYPE_PLAYBACK_CAPTURER_PRIVACY_TYPE_PUBLIC
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it
(
'
SUB_MULTIMEDIA_AUDIO_INNER_CAPTURER_PROMISE_0200
'
,
2
,
async
function
(
done
)
{
let
audioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_44100
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
,
}
let
audioCapturerInfo
=
{
source
:
audio
.
SourceType
.
SOURCE_TYPE_PLAYBACK_CAPTURE
,
capturerFlags
:
0
}
let
playbackCaptureConfig
=
{
CaptureFilterOptions
:
[
{
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_MOVIE
}
]
}
let
audioCapturerOptions
=
{
streamInfo
:
audioStreamInfo
,
capturerInfo
:
audioCapturerInfo
,
playbackCaptureConfig
:
playbackCaptureConfig
,
}
let
AudioStreamInfo
=
{
samplingRate
:
audio
.
AudioSamplingRate
.
SAMPLE_RATE_48000
,
channels
:
audio
.
AudioChannel
.
CHANNEL_2
,
sampleFormat
:
audio
.
AudioSampleFormat
.
SAMPLE_FORMAT_S32LE
,
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_MOVIE
,
rendererFlags
:
0
}
let
AudioPrivacyType
=
{
privacyType
:
audio
.
AudioPrivacyType
.
PRIVACY_TYPE_PRIVATE
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
,
privacyType
:
AudioPrivacyType
}
readPath
=
'
pcm_48ksr_32kbr_2ch.wav
'
await
getFdRead
(
readPath
,
done
);
await
getFd
(
"
capture_js-44100-2C-1S32LE.pcm
"
);
await
recPromise
(
audioCapturerOptions
,
AudioRendererOptions
,
filePath
,
done
);
await
sleep
(
100
);
await
closeFileDescriptor
(
readPath
);
done
();
})
})
}
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/List.test.js
浏览文件 @
c5a8cb79
/**
* Copyright (C) 2021 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
audioCapturer
from
'
./AudioCapturer.test.js
'
import
AudioCapturerInterruptUnitTest
from
'
./AudioCapturerInterrupt.test.js
'
export
default
function
testsuite
()
{
audioCapturer
()
AudioCapturerInterruptUnitTest
()
}
/**
* Copyright (C) 2021 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
audioCapturer
from
'
./AudioCapturer.test.js
'
import
AudioCapturerInterruptUnitTest
from
'
./AudioCapturerInterrupt.test.js
'
import
AudioPlaybackCapturer
from
'
./AudioPlaybackCapturer.test.js
'
export
default
function
testsuite
()
{
audioCapturer
()
AudioCapturerInterruptUnitTest
()
AudioPlaybackCapturer
()
}
multimedia/audio/audio_js_standard/AudioCapturer/src/main/resources/base/element/string.json
浏览文件 @
c5a8cb79
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"JsHelloWorld"
},
{
"name"
:
"mainability_description"
,
"value"
:
"hap sample empty page"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"JsHelloWorld"
},
{
"name"
:
"mainability_description"
,
"value"
:
"hap sample empty page"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
]
}
\ No newline at end of file
multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioEffect.test.js
浏览文件 @
c5a8cb79
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录