Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0e8f8f2b
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看板
提交
0e8f8f2b
编写于
7月 26, 2022
作者:
L
logic42
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add input ets testcase
Signed-off-by:
N
logic42
<
wanglong108@huawei.com
>
上级
4d279817
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
883 addition
and
1 deletion
+883
-1
multimodalinput/BUILD.gn
multimodalinput/BUILD.gn
+4
-1
multimodalinput/multimodalinput_ets_standard/BUILD.gn
multimodalinput/multimodalinput_ets_standard/BUILD.gn
+36
-0
multimodalinput/multimodalinput_ets_standard/Test.json
multimodalinput/multimodalinput_ets_standard/Test.json
+19
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json
...t/multimodalinput_ets_standard/entry/src/main/config.json
+98
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets
...input_ets_standard/entry/src/main/ets/MainAbility/app.ets
+33
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/pages/index.ets
...s_standard/entry/src/main/ets/MainAbility/pages/index.ets
+36
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/app.ets
...input_ets_standard/entry/src/main/ets/TestAbility/app.ets
+33
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/pages/index.ets
...s_standard/entry/src/main/ets/TestAbility/pages/index.ets
+50
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...rd/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+78
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/List.test.ets
...linput_ets_standard/entry/src/main/ets/test/List.test.ets
+19
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets
...entry/src/main/ets/test/MultimodalInputEventType.test.ets
+303
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/Utils.ets
...modalinput_ets_standard/entry/src/main/ets/test/Utils.ets
+118
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/color.json
...standard/entry/src/main/resources/base/element/color.json
+12
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/float.json
...standard/entry/src/main/resources/base/element/float.json
+12
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/string.json
...tandard/entry/src/main/resources/base/element/string.json
+32
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/media/icon.png
...ets_standard/entry/src/main/resources/base/media/icon.png
+0
-0
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/rawfile/test.png
...ut_ets_standard/entry/src/main/resources/rawfile/test.png
+0
-0
multimodalinput/multimodalinput_ets_standard/signature/openharmony_sx.p7b
...multimodalinput_ets_standard/signature/openharmony_sx.p7b
+0
-0
未找到文件。
multimodalinput/BUILD.gn
浏览文件 @
0e8f8f2b
...
...
@@ -16,6 +16,9 @@ import("//build/ohos_var.gni")
group("multimodalinput") {
testonly = true
if (is_standard_system) {
deps = [ "input_js_standard:multimodalinput_js_test" ]
deps = [
"input_js_standard:multimodalinput_js_test",
"multimodalinput_ets_standard:ActsMultimodalInputEtsTest",
]
}
}
multimodalinput/multimodalinput_ets_standard/BUILD.gn
0 → 100755
浏览文件 @
0e8f8f2b
# 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("ActsMultimodalInputEtsTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":multimodalinput_ets_assets",
":multimodalinput_ets_resources",
":multimodalinput_ets_test_assets",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsMultimodalInputEtsTest"
}
ohos_js_assets("multimodalinput_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("multimodalinput_ets_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("multimodalinput_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
multimodalinput/multimodalinput_ets_standard/Test.json
0 → 100755
浏览文件 @
0e8f8f2b
{
"description"
:
"Configuration for MultimodalInput EventType Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"600000"
,
"bundle-name"
:
"ohos.acts.multimodalinput.input"
,
"package-name"
:
"ohos.acts.multimodalinput.input"
,
"shell-timeout"
:
"600000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsMultimodalInputEtsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json
0 → 100755
浏览文件 @
0e8f8f2b
{
"app"
:
{
"bundleName"
:
"ohos.acts.multimodalinput.input"
,
"vendor"
:
"open"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
7
,
"releaseType"
:
"Release"
,
"target"
:
8
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.multimodalinput.input"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
"ohos.acts.multimodalinput.input.MainAbility"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
,
"installationFree"
:
false
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility"
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:description_mainability"
,
"formsEnabled"
:
false
,
"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"
}
],
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
},
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets
0 → 100755
浏览文件 @
0e8f8f2b
// @ts-nocheck
/**
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100755
浏览文件 @
0e8f8f2b
// @ts-nocheck
/*
* 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.
*/
@Entry
@Component
struct MyComponent {
aboutToAppear() {
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE CURVES ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/app.ets
0 → 100755
浏览文件 @
0e8f8f2b
// @ts-nocheck
/**
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/pages/index.ets
0 → 100755
浏览文件 @
0e8f8f2b
// @ts-nocheck
/**
* 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 router from '@system.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100755
浏览文件 @
0e8f8f2b
// @ts-nocheck
/**
* 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
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
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/List.test.ets
0 → 100755
浏览文件 @
0e8f8f2b
/*
* 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 MultimodalInputEventTypeTest from './MultimodalInputEventType.test';
export default function testsuite() {
MultimodalInputEventTypeTest()
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets
0 → 100755
浏览文件 @
0e8f8f2b
/*
* 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 inputkeyCode from '@ohos.multimodalInput.keyCode'
import keyEvent from '@ohos.multimodalInput.keyEvent'
import mouseEvent from '@ohos.multimodalInput.mouseEvent'
import touchEvent from '@ohos.multimodalInput.touchEvent'
import { Key, KeyEvent } from '@ohos.multimodalInput.keyEvent'
import { AxisValue, MouseEvent } from '@ohos.multimodalInput.mouseEvent'
import { Touch, TouchEvent } from '@ohos.multimodalInput.touchEvent'
import {
describe,
beforeAll,
beforeEach,
afterEach,
afterAll,
it,
expect
} from 'hypium/index'
export default function MultimodalInputEventTypeTest() {
describe('MultimodalInput_test', function () {
it('MultimodalInput_test::KeyEventTypeTest_0010', 0, function () {
console.info(`MultimodalInput_test::KeyEventTypeTest_0010 enter`);
expect(keyEvent.Action.CANCEL == 0).assertTrue();
expect(keyEvent.Action.DOWN == 1).assertTrue();
expect(keyEvent.Action.UP == 2).assertTrue();
console.info(`MultimodalInput_test::KeyEventTypeTest_0010 exit`);
})
it('MultimodalInput_test::KeyEventTypeTest_0020', 0, function () {
console.info(`MultimodalInput_test::KeyEventTypeTest_0020 enter`);
let testKey: Key = { code: inputkeyCode.KeyCode.KEYCODE_FN, pressedTime: 10, deviceId: 1 };
expect(testKey.code == inputkeyCode.KeyCode.KEYCODE_FN).assertTrue();
expect(testKey.pressedTime == 10).assertTrue();
expect(testKey.deviceId == 1).assertTrue();
console.info(`MultimodalInput_test::KeyEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::KeyEventTypeTest_0030', 0, function () {
console.info(`MultimodalInput_test::KeyEventTypeTest_0030 enter`);
let testKey: Key = { code: inputkeyCode.KeyCode.KEYCODE_FN, pressedTime: 10, deviceId: 1 };
let testKeyEvent: KeyEvent = {
id: 1, deviceId: 1, actionTime: 1, screenId: 1, windowId: 1,
action: keyEvent.Action.DOWN, key: testKey, unicodeChar: 1, keys: [testKey],
ctrlKey: true, altKey: true, shiftKey: true, infooKey: true, fnKey: true, capsLock: true, numLock: true,
scrollLock: true
};
expect(testKeyEvent.action == keyEvent.Action.DOWN).assertTrue();
expect(testKeyEvent.key.code == testKey.code).assertTrue();
expect(testKeyEvent.unicodeChar == 1).assertTrue();
expect(testKeyEvent.keys[0].code == testKey.code).assertTrue();
expect(testKeyEvent.ctrlKey).assertTrue();
expect(testKeyEvent.altKey).assertTrue();
expect(testKeyEvent.shiftKey).assertTrue();
expect(testKeyEvent.infooKey).assertTrue();
expect(testKeyEvent.fnKey).assertTrue();
expect(testKeyEvent.capsLock).assertTrue();
expect(testKeyEvent.numLock).assertTrue();
expect(testKeyEvent.scrollLock).assertTrue();
console.info(`MultimodalInput_test::KeyEventTypeTest_0030 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_0010', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0010 enter`);
expect(mouseEvent.Action.CANCEL == 0).assertTrue();
expect(mouseEvent.Action.MOVE == 1).assertTrue();
expect(mouseEvent.Action.BUTTON_DOWN == 2).assertTrue();
expect(mouseEvent.Action.BUTTON_UP == 3).assertTrue();
expect(mouseEvent.Action.AXIS_BEGIN == 4).assertTrue();
expect(mouseEvent.Action.AXIS_UPDATE == 5).assertTrue();
expect(mouseEvent.Action.AXIS_END == 6).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0010 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_0020', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK );
expect(mouseEvent.Button.LEFT == 0).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_00201', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK );
expect(mouseEvent.Button.MIDDLE == 1).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_00202', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK );
expect(mouseEvent.Button.RIGHT == 2).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_00203', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK );
expect(mouseEvent.Button.SIDE == 3).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_00204', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK );
expect(mouseEvent.Button.EXTRA == 4).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_00205', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK );
expect(mouseEvent.Button.FORWARD == 5).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_00206', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK );
expect(mouseEvent.Button.BACK == 6).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_00207', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter` + mouseEvent.Button.LEFT + mouseEvent.Button.MIDDLE + mouseEvent.Button.RIGHT + mouseEvent.Button.SIDE +mouseEvent.Button.EXTRA +mouseEvent.Button.BACK + mouseEvent.Button.TASK );
expect(mouseEvent.Button.TASK == 7).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_0030', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0030 enter`);
expect(mouseEvent.Axis.SCROLL_VERTICAL == 0).assertTrue();
expect(mouseEvent.Axis.SCROLL_HORIZONTAL == 1).assertTrue();
expect(mouseEvent.Axis.PINCH == 2).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0030 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_0040', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0040 enter`);
let testAxisValue: AxisValue = { axis: mouseEvent.Axis.SCROLL_VERTICAL, value: 1 };
expect(testAxisValue.axis == mouseEvent.Axis.SCROLL_VERTICAL).assertTrue();
expect(testAxisValue.value == 1).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0040 exit`);
})
it('MultimodalInput_test::MouseEventTypeTest_0050', 0, function () {
console.info(`MultimodalInput_test::MouseEventTypeTest_0050 enter`);
let testAxisValue: AxisValue = { axis: mouseEvent.Axis.SCROLL_VERTICAL, value: 1 };
let testMouseEvent: MouseEvent = {
id: 1, deviceId: 1, actionTime: 1, screenId: 1, windowId: 1,
action: mouseEvent.Action.CANCEL, screenX: 1, screenY: 1, windowX: 1,
windowY: 1, rawDeltaX: 1, rawDeltaY: 1, button: mouseEvent.Button.LEFT,
pressedButtons: [mouseEvent.Button.LEFT], axes: [testAxisValue],
pressedKeys: [inputkeyCode.KeyCode.KEYCODE_FN], ctrlKey: true, altKey: true, shiftKey: true,
infooKey: true, fnKey: true, capsLock: true, numLock: true, scrollLock: true
};
expect(testMouseEvent.action == mouseEvent.Action.CANCEL).assertTrue();
expect(testMouseEvent.screenX == 1).assertTrue();
expect(testMouseEvent.screenY == 1).assertTrue();
expect(testMouseEvent.windowX == 1).assertTrue();
expect(testMouseEvent.windowY == 1).assertTrue();
expect(testMouseEvent.rawDeltaX == 1).assertTrue();
expect(testMouseEvent.rawDeltaY == 1).assertTrue();
expect(testMouseEvent.button == mouseEvent.Button.LEFT).assertTrue();
expect(testMouseEvent.pressedButtons[0] == mouseEvent.Button.LEFT).assertTrue();
expect(testMouseEvent.axes[0].axis == mouseEvent.Axis.SCROLL_VERTICAL).assertTrue();
expect(testMouseEvent.pressedKeys[0] == inputkeyCode.KeyCode.KEYCODE_FN).assertTrue();
expect(testMouseEvent.ctrlKey).assertTrue();
expect(testMouseEvent.altKey).assertTrue();
expect(testMouseEvent.shiftKey).assertTrue();
expect(testMouseEvent.infooKey).assertTrue();
expect(testMouseEvent.fnKey).assertTrue();
expect(testMouseEvent.capsLock).assertTrue();
expect(testMouseEvent.numLock).assertTrue();
expect(testMouseEvent.scrollLock).assertTrue();
console.info(`MultimodalInput_test::MouseEventTypeTest_0050 exit`);
})
it('MultimodalInput_test::TouchEventTypeTest_0010', 0, function () {
console.info(`MultimodalInput_test::TouchEventTypeTest_0010 enter`);
expect(touchEvent.Action.CANCEL == 0).assertTrue();
expect(touchEvent.Action.DOWN == 1).assertTrue();
expect(touchEvent.Action.MOVE == 2).assertTrue();
expect(touchEvent.Action.UP == 3).assertTrue();
console.info(`MultimodalInput_test::TouchEventTypeTest_0010 exit`);
})
it('MultimodalInput_test::TouchEventTypeTest_0020', 0, function () {
console.info(`MultimodalInput_test::TouchEventTypeTest_0020 enter`);
expect(touchEvent.ToolType.FINGER == 0).assertTrue();
expect(touchEvent.ToolType.PEN == 1).assertTrue();
expect(touchEvent.ToolType.RUBBER == 2).assertTrue();
expect(touchEvent.ToolType.BRUSH == 3).assertTrue();
expect(touchEvent.ToolType.PENCIL == 4).assertTrue();
expect(touchEvent.ToolType.AIRBRUSH == 5).assertTrue();
expect(touchEvent.ToolType.MOUSE == 6).assertTrue();
expect(touchEvent.ToolType.LENS == 7).assertTrue();
console.info(`MultimodalInput_test::TouchEventTypeTest_0020 exit`);
})
it('MultimodalInput_test::TouchEventTypeTest_0030', 0, function () {
console.info(`MultimodalInput_test::TouchEventTypeTest_0030 enter`);
expect(touchEvent.SourceType.TOUCH_SCREEN == 0).assertTrue();
expect(touchEvent.SourceType.PEN == 1).assertTrue();
expect(touchEvent.SourceType.TOUCH_PAD == 2).assertTrue();
console.info(`MultimodalInput_test::TouchEventTypeTest_0030 exit`);
})
it('MultimodalInput_test::TouchEventTypeTest_0040', 0, function () {
console.info(`MultimodalInput_test::TouchEventTypeTest_0040 enter`);
let testTouch: Touch = {
id: 1, pressedTime: 1, screenX: 1, screenY: 1, windowX: 1, windowY: 1, pressure: 1,
width: 1, height: 1, tiltX: 1, tiltY: 1, toolX: 1, toolY: 1, toolWidth: 1, toolHeight: 1, rawX: 1,
rawY: 1, toolType: touchEvent.ToolType.FINGER
};
expect(testTouch.id == 1).assertTrue();
expect(testTouch.pressedTime == 1).assertTrue();
expect(testTouch.screenX == 1).assertTrue();
expect(testTouch.screenY == 1).assertTrue();
expect(testTouch.windowX == 1).assertTrue();
expect(testTouch.windowY == 1).assertTrue();
expect(testTouch.pressure == 1).assertTrue();
expect(testTouch.width == 1).assertTrue();
expect(testTouch.height == 1).assertTrue();
expect(testTouch.tiltX == 1).assertTrue();
expect(testTouch.tiltY == 1).assertTrue();
expect(testTouch.toolX == 1).assertTrue();
expect(testTouch.toolY == 1).assertTrue();
expect(testTouch.toolWidth == 1).assertTrue();
expect(testTouch.toolHeight == 1).assertTrue();
expect(testTouch.rawX == 1).assertTrue();
expect(testTouch.rawY == 1).assertTrue();
expect(testTouch.toolType == touchEvent.ToolType.FINGER).assertTrue();
console.info(`MultimodalInput_test::TouchEventTypeTest_0040 exit`);
})
it('MultimodalInput_test::TouchEventTypeTest_0050', 0, function () {
console.info(`MultimodalInput_test::TouchEventTypeTest_0050 enter`);
let testTouch: Touch = {
id: 1, pressedTime: 1, screenX: 1, screenY: 1, windowX: 1, windowY: 1, pressure: 1,
width: 1, height: 1, tiltX: 1, tiltY: 1, toolX: 1, toolY: 1, toolWidth: 1, toolHeight: 1, rawX: 1,
rawY: 1, toolType: touchEvent.ToolType.FINGER
};
let testTouchEvent: TouchEvent = {
id: 1, deviceId: 1, actionTime: 1, screenId: 1, windowId: 1,
action: touchEvent.Action.CANCEL, touch: testTouch, touches: [testTouch],
sourceType: touchEvent.SourceType.TOUCH_SCREEN
};
expect(testTouchEvent.action == touchEvent.Action.CANCEL).assertTrue();
expect(testTouchEvent.touch.id == 1).assertTrue();
expect(testTouchEvent.touches[0].id == 1).assertTrue();
expect(testTouchEvent.sourceType == touchEvent.SourceType.TOUCH_SCREEN).assertTrue();
console.info(`MultimodalInput_test::TouchEventTypeTest_0050 exit`);
})
})
}
multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/Utils.ets
0 → 100755
浏览文件 @
0e8f8f2b
// @ts-nocheck
/**
* 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.
*/
export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
}
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/color.json
0 → 100755
浏览文件 @
0e8f8f2b
{
"color"
:
[
{
"name"
:
"color_hello"
,
"value"
:
"#ffff0000"
},
{
"name"
:
"color_world"
,
"value"
:
"#ff0000ff"
}
]
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/float.json
0 → 100755
浏览文件 @
0e8f8f2b
{
"float"
:[
{
"name"
:
"font_hello"
,
"value"
:
"28.0fp"
},
{
"name"
:
"font_world"
,
"value"
:
"20.0fp"
}
]
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/string.json
0 → 100755
浏览文件 @
0e8f8f2b
{
"string"
:
[
{
"name"
:
"entry_MainAbility"
,
"value"
:
"entry_MainAbility"
},
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"string_hello"
,
"value"
:
"Hello"
},
{
"name"
:
"string_world"
,
"value"
:
"World"
},
{
"name"
:
"message_arrive"
,
"value"
:
"We will arrive at %s."
}
]
}
\ No newline at end of file
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/media/icon.png
0 → 100755
浏览文件 @
0e8f8f2b
6.6 KB
multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/rawfile/test.png
0 → 100755
浏览文件 @
0e8f8f2b
6.6 KB
multimodalinput/multimodalinput_ets_standard/signature/openharmony_sx.p7b
0 → 100755
浏览文件 @
0e8f8f2b
文件已添加
鸿蒙社区
@harmonycommunity
mentioned in commit
e94e24e6
·
9月 07, 2022
mentioned in commit
e94e24e6
mentioned in commit e94e24e68bb5243aab4a1ca88d3c4bb806237d41
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录