Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a66199d6
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看板
未验证
提交
a66199d6
编写于
3月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2608 Misc用例整改
Merge pull request !2608 from 高曦/OpenHarmony-3.1-Release
上级
b1d4ef55
f0ae84cc
变更
32
展开全部
隐藏空白更改
内联
并排
Showing
32 changed file
with
4376 addition
and
79 deletion
+4376
-79
miscservices/BUILD.gn
miscservices/BUILD.gn
+2
-0
miscservices/InputMethodTest_ets/BUILD.gn
miscservices/InputMethodTest_ets/BUILD.gn
+32
-0
miscservices/InputMethodTest_ets/Test.json
miscservices/InputMethodTest_ets/Test.json
+18
-0
miscservices/InputMethodTest_ets/entry/src/main/config.json
miscservices/InputMethodTest_ets/entry/src/main/config.json
+72
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
...nputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
+22
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
...odTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
+64
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets
...odTest_ets/entry/src/main/ets/MainAbility/pages/input.ets
+45
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/InputmethodEngineJsunit.test.ets
...ain/ets/MainAbility/test/InputmethodEngineJsunit.test.ets
+490
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/InputmethohJsunit.test.ets
.../src/main/ets/MainAbility/test/InputmethohJsunit.test.ets
+80
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/List.test.ets
...est_ets/entry/src/main/ets/MainAbility/test/List.test.ets
+21
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/Utils.ets
...hodTest_ets/entry/src/main/ets/MainAbility/test/Utils.ets
+118
-0
miscservices/InputMethodTest_ets/entry/src/main/resources/base/element/string.json
...est_ets/entry/src/main/resources/base/element/string.json
+24
-0
miscservices/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png
...thodTest_ets/entry/src/main/resources/base/media/icon.png
+0
-0
miscservices/InputMethodTest_ets/signature/openharmony_sx.p7b
...services/InputMethodTest_ets/signature/openharmony_sx.p7b
+0
-0
miscservices/PasteBoardTest_js/BUILD.gn
miscservices/PasteBoardTest_js/BUILD.gn
+31
-0
miscservices/PasteBoardTest_js/Test.json
miscservices/PasteBoardTest_js/Test.json
+18
-0
miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b
miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b
+0
-0
miscservices/PasteBoardTest_js/src/main/config.json
miscservices/PasteBoardTest_js/src/main/config.json
+60
-0
miscservices/PasteBoardTest_js/src/main/js/default/app.js
miscservices/PasteBoardTest_js/src/main/js/default/app.js
+23
-0
miscservices/PasteBoardTest_js/src/main/js/default/i18n/en-US.json
...ces/PasteBoardTest_js/src/main/js/default/i18n/en-US.json
+6
-0
miscservices/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json
...ces/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json
+6
-0
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css
...steBoardTest_js/src/main/js/default/pages/index/index.css
+9
-0
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.hml
...steBoardTest_js/src/main/js/default/pages/index/index.hml
+5
-0
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.js
...asteBoardTest_js/src/main/js/default/pages/index/index.js
+48
-0
miscservices/PasteBoardTest_js/src/main/js/default/test/List.test.js
...s/PasteBoardTest_js/src/main/js/default/test/List.test.js
+16
-0
miscservices/PasteBoardTest_js/src/main/js/default/test/PasteBoardJsunit.test.js
...Test_js/src/main/js/default/test/PasteBoardJsunit.test.js
+3146
-0
miscservices/PasteBoardTest_js/src/main/resources/base/element/string.json
...eBoardTest_js/src/main/resources/base/element/string.json
+12
-0
miscservices/PasteBoardTest_js/src/main/resources/base/media/icon.png
.../PasteBoardTest_js/src/main/resources/base/media/icon.png
+0
-0
miscservices/RequestTest_js/signature/openharmony_sx.p7b
miscservices/RequestTest_js/signature/openharmony_sx.p7b
+0
-0
miscservices/TimeTest_js/signature/openharmony_sx.p7b
miscservices/TimeTest_js/signature/openharmony_sx.p7b
+0
-0
miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js
...Test_js/src/main/js/default/test/SystemTimeJsunit.test.js
+8
-79
miscservices/TimerTest_js/signature/openharmony_sx.p7b
miscservices/TimerTest_js/signature/openharmony_sx.p7b
+0
-0
未找到文件。
miscservices/BUILD.gn
浏览文件 @
a66199d6
...
...
@@ -15,6 +15,8 @@ import("//build/ohos_var.gni")
group("miscservices") {
testonly = true
deps = [
"InputMethodTest_ets:inputMethod_ets_test",
"PasteBoardTest_js:pasteboard_js_test",
"RequestTest_js:miscservices_request_js_test",
"TimeTest_js:time_js_test",
"TimerTest_js:timer_js_test",
...
...
miscservices/InputMethodTest_ets/BUILD.gn
0 → 100644
浏览文件 @
a66199d6
# 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("inputMethod_ets_test") {
hap_profile = "./entry/src/main/config.json"
deps = [
":inputMethod_ets_assets",
":inputMethod_ets_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "InputMethodEtsTest"
}
ohos_js_assets("inputMethod_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("inputMethod_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
miscservices/InputMethodTest_ets/Test.json
0 → 100644
浏览文件 @
a66199d6
{
"description"
:
"Configuration for inputMethod Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"600000"
,
"package"
:
"com.open.harmony.inputMethodtest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"InputMethodEtsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
miscservices/InputMethodTest_ets/entry/src/main/config.json
0 → 100644
浏览文件 @
a66199d6
{
"app"
:
{
"bundleName"
:
"com.open.harmony.inputMethodtest"
,
"vendor"
:
"open"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
7
,
"releaseType"
:
"Release"
,
"target"
:
7
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.open.harmony.inputMethodtest"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
"com.open.harmony.inputMethodtest.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"
}
],
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
,
"pages/input"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
0 → 100644
浏览文件 @
a66199d6
/**
* 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 {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
a66199d6
// @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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets
0 → 100644
浏览文件 @
a66199d6
// @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 TextInputTest {
@State text: string = '';
build() {
Column() {
TextInput({ placeholder: 'input your word' })
.type(InputType.Normal)
.key('TextInput')
.placeholderColor(Color.Blue)
.placeholderFont({ size: 40, weight: FontWeight.Normal, family: "sans-serif", style: FontStyle.Normal })
.enterKeyType(EnterKeyType.Search)
.caretColor(Color.Green)
.height(60)
.fontSize(30)
.fontWeight(FontWeight.Bold)
.fontFamily("cursive")
.fontStyle(FontStyle.Italic)
.fontColor(Color.Red)
.maxLength(20)
.onChange((value: string) => {
this.text = value
})
Text(this.text)
}
}
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/InputmethodEngineJsunit.test.ets
0 → 100644
浏览文件 @
a66199d6
// @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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import inputMethodEngine from '@ohos.inputMethodEngine';
import Utils from './Utils';
import router from '@system.router';
import events_emitter from '@ohos.events.emitter';
export default function inputMethodEngineJsunit() {
describe('appInfoTest', function () {
var mKeyboardDelegate = null;
var inputMethodEngineObject = inputMethodEngine.getInputMethodEngine();
var textInputClient = null;
var kbController = null;
console.log("************* inputMethodEngine Test start*************");
beforeEach(async function (done) {
let options = {
uri: 'pages/input',
}
try {
router.clear();
let pages = router.getState();
if (!("input" == pages.name)) {
let result = await router.push(options);
await Utils.sleep(1000);
}
} catch (err) {
console.error("push input page error: " + err);
}
done();
});
afterEach(async function () {
console.log("inputMethodEngine afterEach start:" + inputMethodEngineObject);
await Utils.sleep(1000);
});
it('inputMethodEngine_test_000', 0, async function (done) {
inputMethodEngineObject.on('inputStart', (kbController, textInputClient) => {
console.log("inputMethodEngine beforeEach inputStart:" + JSON.stringify(kbController));
console.log("inputMethodEngine beforeEach inputStart:" + JSON.stringify(textInputClient));
textInputClient = textInputClient;
kbController = kbController;
});
inputMethodEngineObject.on('keyboardShow', (err) => {
console.log("inputMethodEngine beforeEach keyboardShow:" + err);
});
inputMethodEngineObject.on('keyboardHide', (err) => {
console.log("inputMethodEngine beforeEach keyboardHide:" + err);
});
mKeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
mKeyboardDelegate.on('keyDown', (keyEvent) => {
console.log("inputMethodEngine beforeEach keyDown:" + keyEvent);
expect(keyEvent.keyCode).assertEqual('1');
});
mKeyboardDelegate.on('keyUp', (keyEvent) => {
console.log("inputMethodEngine beforeEach keyUp:" + keyEvent.keyCode);
expect(keyEvent.keyCode).assertEqual('1');
});
mKeyboardDelegate.on('cursorContextChange', (x, y, height) => {
console.log("inputMethodEngine beforeEach cursorContextChange x:" + x);
console.log("inputMethodEngine beforeEach cursorContextChange y:" + y);
console.log("inputMethodEngine beforeEach cursorContextChange height:" + height);
});
mKeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
console.log("inputMethodEngine beforeEach selectionChange oldBegin:" + oldBegin);
console.log("inputMethodEngine beforeEach selectionChange oldEnd:" + oldEnd);
console.log("inputMethodEngine beforeEach selectionChange newBegin:" + newBegin);
console.log("inputMethodEngine beforeEach selectionChange newEnd:" + newEnd);
});
mKeyboardDelegate.on('textChange', (text) => {
console.log("inputMethodEngine beforeEach textChange:" + text);
});
done();
});
it('inputMethodEngine_test_001', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_UNSPECIFIED;
console.log("inputMethodEngine_test_001 result:" + keyType);
expect(keyType).assertEqual(0);
done();
});
it('inputMethodEngine_test_002', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_GO;
console.log("inputMethodEngine_test_002 result:" + keyType);
expect(keyType).assertEqual(2);
done();
});
it('inputMethodEngine_test_003', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEARCH;
console.log("inputMethodEngine_test_003 result:" + keyType);
expect(keyType).assertEqual(3);
done();
});
it('inputMethodEngine_test_004', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEND;
console.log("inputMethodEngine_test_004 result:" + keyType);
expect(keyType).assertEqual(4);
done();
});
it('inputMethodEngine_test_005', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_NEXT;
console.log("inputMethodEngine_test_005 result:" + keyType);
expect(keyType).assertEqual(5);
done();
});
it('inputMethodEngine_test_006', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_DONE;
console.log("inputMethodEngine_test_006 result:" + keyType);
expect(keyType).assertEqual(6);
done();
});
it('inputMethodEngine_test_007', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_PREVIOUS;
console.log("inputMethodEngine_test_007 result:" + keyType);
expect(keyType).assertEqual(7);
done();
});
it('inputMethodEngine_test_008', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_NULL;
console.log("inputMethodEngine_test_008 result:" + keyType);
expect(keyType).assertEqual(-1);
done();
});
it('inputMethodEngine_test_009', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_TEXT;
console.log("inputMethodEngine_test_009 result:" + keyType);
expect(keyType).assertEqual(0);
done();
});
it('inputMethodEngine_test_010', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_NUMBER;
console.log("inputMethodEngine_test_010 result:" + keyType);
expect(keyType).assertEqual(2);
done();
});
it('inputMethodEngine_test_011', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_PHONE;
console.log("inputMethodEngine_test_011 result:" + keyType);
expect(keyType).assertEqual(3);
done();
});
it('inputMethodEngine_test_012', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_DATETIME;
console.log("inputMethodEngine_test_012 result:" + keyType);
expect(keyType).assertEqual(4);
done();
});
it('inputMethodEngine_test_013', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_EMAIL;
console.log("inputMethodEngine_test_013 result:" + keyType);
expect(keyType).assertEqual(5);
done();
});
it('inputMethodEngine_test_014', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_URI;
console.log("inputMethodEngine_test_014 result:" + keyType);
expect(keyType).assertEqual(6);
done();
});
it('inputMethodEngine_test_015', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_PASSWORD;
console.log("inputMethodEngine_test_015 result:" + keyType);
expect(keyType).assertEqual(7);
done();
});
it('inputMethodEngine_test_016', 0, async function (done) {
let keyType = inputMethodEngine.FLAG_SELECTING;
console.log("inputMethodEngine_test_016 result:" + keyType);
expect(keyType).assertEqual(2);
done();
});
it('inputMethodEngine_test_017', 0, async function (done) {
let keyType = inputMethodEngine.FLAG_SINGLE_LINE;
console.log("inputMethodEngine_test_017 result:" + keyType);
expect(keyType).assertEqual(1);
done();
});
it('inputMethodEngine_test_018', 0, async function (done) {
let keyType = inputMethodEngine.DISPLAY_MODE_PART;
console.log("inputMethodEngine_test_018 result:" + keyType);
expect(keyType).assertEqual(0);
done();
});
it('inputMethodEngine_test_019', 0, async function (done) {
let keyType = inputMethodEngine.DISPLAY_MODE_FULL;
console.log("inputMethodEngine_test_019 result:" + keyType);
expect(keyType).assertEqual(1);
done();
});
it('inputMethodEngine_test_020', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_ASCII;
console.log("inputMethodEngine_test_020 result:" + keyType);
expect(keyType).assertEqual(20);
done();
});
it('inputMethodEngine_test_021', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_NONE;
console.log("inputMethodEngine_test_021 result:" + keyType);
expect(keyType).assertEqual(0);
done();
});
it('inputMethodEngine_test_022', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_CAP_CHARACTERS;
console.log("inputMethodEngine_test_022 result:" + keyType);
expect(keyType).assertEqual(2);
done();
});
it('inputMethodEngine_test_023', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_CAP_SENTENCES;
console.log("inputMethodEngine_test_023 result:" + keyType);
expect(keyType).assertEqual(8);
done();
});
it('inputMethodEngine_test_024', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_WORDS;
console.log("inputMethodEngine_test_024 result:" + keyType);
expect(keyType).assertEqual(4);
done();
});
it('inputMethodEngine_test_025', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_MULTI_LINE;
console.log("inputMethodEngine_test_025 result:" + keyType);
expect(keyType).assertEqual(1);
done();
});
it('inputMethodEngine_test_026', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_NO_FULLSCREEN;
console.log("inputMethodEngine_test_026 result:" + keyType);
expect(keyType).assertEqual(10);
done();
});
it('inputMethodEngine_test_027', 0, async function (done) {
let rect = await Utils.getComponentRect('TextInput')
console.info("[inputMethodEngine_test_027] rectInfo is " + JSON.stringify(rect));
let x_value = rect.left + (rect.right - rect.left) / 10
let y_value = rect.top + (rect.bottom - rect.top) / 10
console.info("[inputMethodEngine_test_027] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = {
id: 1,
x: x_value,
y: y_value,
type: TouchType.Move,
}
console.info('[inputMethodEngine_test_027] testSendTouchEvent ' + sendTouchEvent(point));
await Utils.sleep(1000)
console.info('[inputMethodEngine_test_027] END');
done();
});
it('inputMethodEngine_test_028', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.sendKeyFunction(0, (value) => {
console.log("inputMethodEngine_test_028 textInputClient sendKeyFunction:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_029', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.sendKeyFunction(0);
promise.then(res => {
console.info("inputMethodEngine_test_029 listInputMethod promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_029 listInputMethod promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_030', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.deleteForward(1, (value) => {
console.log("inputMethodEngine_test_030 deleteForward:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_031', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.deleteForward(1);
promise.then(res => {
console.info("inputMethodEngine_test_031 deleteForward promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_031 deleteForward promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_032', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.deleteBackward(1, (value) => {
console.log("inputMethodEngine_test_032 deleteBackward:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_033', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.deleteBackward(1);
promise.then(res => {
console.info("inputMethodEngine_test_033 deleteBackward promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_033 deleteBackward promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_034', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.InsertText('test', (value) => {
console.log("inputMethodEngine_test_034 InsertText:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_035', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.InsertText('test');
promise.then(res => {
console.info("inputMethodEngine_test_035 InsertText promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_035 InsertText promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_036', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.getForward(1, (value) => {
console.log("inputMethodEngine_test_036 getForward:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_037', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.getForward(1);
promise.then(res => {
console.info("inputMethodEngine_test_037 getForward promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_037 getForward promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_038', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.getEditorAttribute(1, (editorAttribute) => {
console.log("inputMethodEngine_test_036 getEditorAttribute:" + value);
expect(editorAttribute.inputPattern).assertEqual(1);
expect(editorAttribute.enterKeyType).assertEqual(1);
});
}
done();
});
it('inputMethodEngine_test_039', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.getEditorAttribute();
promise.then(res => {
console.info("inputMethodEngine_test_037 getEditorAttribute promise result-----" + JSON.stringify(res));
expect(res.inputPattern).assertEqual(1);
expect(res.enterKeyType).assertEqual(1);
}).catch(err => {
console.info("inputMethodEngine_test_037 getEditorAttribute promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_040', 0, async function (done) {
if (kbController == null) {
expect(kbController == null).assertEqual(true);
} else {
kbController.hideKeyboard(() => {
console.log("inputMethodEngine_test_040 hideKeyboard:" + value);
expect(1 == 1).assertTrue();
});
}
done();
});
it('inputMethodEngine_test_041', 0, async function (done) {
if (kbController == null) {
expect(kbController == null).assertEqual(true);
} else {
let promise = kbController.hideKeyboard();
promise.then(res => {
console.info("inputMethodEngine_test_037 hideKeyboard promise result-----" + JSON.stringify(res));
expect(1 == 1).assertTrue();
}).catch(err => {
console.info("inputMethodEngine_test_037 hideKeyboard promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
})
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/InputmethohJsunit.test.ets
0 → 100644
浏览文件 @
a66199d6
// @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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import inputmeth from '@ohos.inputmethod';
export default function settingUiJsunit() {
describe('appInfoTest', function () {
console.log("************* settings Test start*************");
it('inputmethoh_test_001', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting();
console.log("inputmethoh_test_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod((arr) => {
console.info("inputmethoh_test_001 listInputMethod result---" + JSON.stringify(arr));
expect(1==1).assertTrue();
});
done();
});
it('inputmethoh_test_002', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting();
console.log("inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting));
let promise = inputMethodSetting.listInputMethod();
console.info("inputmethoh_test_002 listInputMethod result---" + JSON.stringify(promise));
let obj = promise[0];
console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj));
expect(obj.packageName=='com.example.kikakeyboard').assertTrue();
expect(obj.methodId=='ServiceExtAbility').assertTrue();
done();
});
it('inputmethoh_test_003', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting();
console.log("inputmethoh_test_003 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.displayOptionalInputMethod(() => {
console.info("inputmethoh_test_003 displayOptionalInputMethod---");
});
done();
});
it('inputmethoh_test_004', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting();
console.log("inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting));
let promise = inputMethodSetting.displayOptionalInputMethod();
console.info("inputmethoh_test_004 displayOptionalInputMethod result---" + JSON.stringify(promise));
expect(promise).assertEqual(undefined)
done();
});
it('inputmethoh_test_005', 0, async function (done) {
let inputMethodCtrl = inputmeth.getInputMethodController();
console.log("inputmethoh_test_005 result:" + JSON.stringify(inputMethodCtrl));
inputMethodCtrl.stopInput((res) => {
console.info("inputmethoh_test_005 stopInput result----" + res);
});
done();
});
it('inputmethoh_test_006', 0, async function (done) {
let inputMethodCtrl = inputmeth.getInputMethodController();
console.log("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl));
let promise = inputMethodCtrl.stopInput();
console.info("inputmethoh_test_006 inputMethodCtrl stopInput result---" + JSON.stringify(promise));
expect(promise).assertEqual(true)
done();
});
})
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/List.test.ets
0 → 100644
浏览文件 @
a66199d6
/**
* 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 inputmethohJsunit from './InputmethohJsunit.test.ets';
import inputmethodEngineJsunit from './InputmethodEngineJsunit.test.ets';
export default function testsuite() {
inputmethohJsunit();
inputmethodEngineJsunit();
}
\ No newline at end of file
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/Utils.ets
0 → 100644
浏览文件 @
a66199d6
// @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)
}
}
miscservices/InputMethodTest_ets/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
a66199d6
{
"string"
:
[
{
"name"
:
"entry_MainAbility"
,
"value"
:
"entry_MainAbility"
},
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"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
miscservices/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
a66199d6
6.6 KB
miscservices/InputMethodTest_ets/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
a66199d6
文件已添加
miscservices/PasteBoardTest_js/BUILD.gn
0 → 100644
浏览文件 @
a66199d6
# 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("pasteboard_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsPasteBoardJSApiTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
miscservices/PasteBoardTest_js/Test.json
0 → 100644
浏览文件 @
a66199d6
{
"description"
:
"Configuration for PasteBoard js api Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"180000"
,
"package"
:
"ohos.acts.miscservices.pasteboard"
,
"shell-timeout"
:
"180000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsPasteBoardJSApiTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
a66199d6
文件已添加
miscservices/PasteBoardTest_js/src/main/config.json
0 → 100644
浏览文件 @
a66199d6
{
"app"
:
{
"bundleName"
:
"ohos.acts.miscservices.pasteboard"
,
"vendor"
:
"acts"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.miscservices.pasteboard"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"ohos.acts.miscservices.pasteboard.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
miscservices/PasteBoardTest_js/src/main/js/default/app.js
0 → 100644
浏览文件 @
a66199d6
/*
* 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
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
miscservices/PasteBoardTest_js/src/main/js/default/i18n/en-US.json
0 → 100644
浏览文件 @
a66199d6
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
miscservices/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json
0 → 100644
浏览文件 @
a66199d6
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css
0 → 100644
浏览文件 @
a66199d6
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.hml
0 → 100644
浏览文件 @
a66199d6
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.js
0 → 100644
浏览文件 @
a66199d6
/*
* 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
app
from
'
@system.app
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
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
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
// core.addService('report', instrumentLog)
core
.
init
()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
miscservices/PasteBoardTest_js/src/main/js/default/test/List.test.js
0 → 100644
浏览文件 @
a66199d6
/*
* 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.
*/
require
(
'
./PasteBoardJsunit.test.js
'
)
\ No newline at end of file
miscservices/PasteBoardTest_js/src/main/js/default/test/PasteBoardJsunit.test.js
0 → 100644
浏览文件 @
a66199d6
此差异已折叠。
点击以展开。
miscservices/PasteBoardTest_js/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
a66199d6
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"JstimeTest"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
miscservices/PasteBoardTest_js/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
a66199d6
6.6 KB
miscservices/RequestTest_js/signature/openharmony_sx.p7b
浏览文件 @
a66199d6
无法预览此类型文件
miscservices/TimeTest_js/signature/openharmony_sx.p7b
浏览文件 @
a66199d6
无法预览此类型文件
miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js
浏览文件 @
a66199d6
...
...
@@ -613,12 +613,12 @@ describe('TimeTest', function() {
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
()
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
();
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
...
...
@@ -641,12 +641,12 @@ describe('TimeTest', function() {
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
()
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
();
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
...
...
@@ -669,12 +669,12 @@ describe('TimeTest', function() {
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
()
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
();
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
...
...
@@ -684,7 +684,7 @@ describe('TimeTest', function() {
/**
* @tc.number SUB_systemTime_setTime_JS_API_0400
* @tc.name Test systemTime.setTime time =
Number.MAX_VALUE/2, getCurrentTimeNs
* @tc.name Test systemTime.setTime time =
-1
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
...
...
@@ -692,37 +692,12 @@ describe('TimeTest', function() {
*/
it
(
'
systemTime_setTime_test4
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0400 start
'
)
var
time
=
Number
.
MAX_VALUE
/
2
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
sleep
(
5000
).
then
(()
=>
{
var
resGetTime
=
systemTime
.
getCurrentTimeNs
();
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
((
time
+
6000
)
*
1000000
)
&&
resGetTime
>=
((
time
+
5000
)
*
1000000
));
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0400 end
'
);
})
})
/**
* @tc.number SUB_systemTime_setTime_JS_API_0500
* @tc.name Test systemTime.setTime time = -1
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTime_test5
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0500 start
'
)
var
time
=
-
1
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0
5
00 end
'
);
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0
4
00 end
'
);
})
/**
...
...
@@ -1047,29 +1022,6 @@ describe('TimeTest', function() {
})
})
/**
* @tc.number SUB_systemTime_getRealActiveTimeNs_JS_API_0100
* @tc.name Test systemTime.getRealActiveTimeNs
* @tc.desc Test systemTime_getRealActiveTimeNs API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_getRealActiveTimeNs_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_getRealActiveTimeNs_JS_API_0100 start
'
)
var
resGetTime0
=
systemTime
.
getRealActiveTimeNs
()
console
.
log
(
'
GetTime0 =
'
+
resGetTime0
)
sleep
(
5000
).
then
(()
=>
{
var
resGetTime1
=
systemTime
.
getRealActiveTimeNs
();
console
.
log
(
'
GetTime1 =
'
+
resGetTime1
);
assert
.
equal
(
resGetTime1
<=
(
resGetTime0
+
6000
*
1000000
)
&&
resGetTime1
>=
(
resGetTime0
+
5000
*
1000000
));
console
.
log
(
'
SUB_systemTime_getRealActiveTimeNs_JS_API_0100 end
'
);
})
})
/**
* @tc.number SUB_systemTime_getRealTime_JS_API_0100
* @tc.name Test systemTime.getRealTime
...
...
@@ -1093,29 +1045,6 @@ describe('TimeTest', function() {
})
})
/**
* @tc.number SUB_systemTime_getRealTimeNs_JS_API_0100
* @tc.name Test systemTime.getRealTimeNs
* @tc.desc Test systemTime_getRealTimeNs API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_getRealTimeNs_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_getRealTimeNs_JS_API_0100 start
'
)
var
resGetTime0
=
systemTime
.
getRealTimeNs
()
console
.
log
(
'
GetTime0 =
'
+
resGetTime0
)
sleep
(
5000
).
then
(()
=>
{
var
resGetTime1
=
systemTime
.
getRealTimeNs
();
console
.
log
(
'
GetTime1 =
'
+
resGetTime1
);
assert
.
equal
(
resGetTime1
<=
(
resGetTime0
+
6000
*
1000000
)
&&
resGetTime1
>=
(
resGetTime0
+
5000
*
1000000
));
console
.
log
(
'
SUB_systemTime_getRealTimeNs_JS_API_0100 end
'
);
})
})
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
...
...
miscservices/TimerTest_js/signature/openharmony_sx.p7b
浏览文件 @
a66199d6
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录