提交 156c479e 编写于 作者: G gaoxi

add testcase

Signed-off-by: Ngaoxi <gaoxi785@huawei.com>
上级 7461aa2f
{
"BuildOptions":{},
"CommonInfo":{
"project.ide.version":"3.0.0.900"
}
}
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/InputMethodTest_ets.iml" filepath="$PROJECT_DIR$/.idea/InputMethodTest_ets.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -29,11 +29,13 @@ export default function inputRequestJsunit() {
let caseName: string = "inputRequest_DownloadConfig_Test_001";
console.log(`==========> ${caseName} Test start ==========>`);
let downloadConfig = {
header: "HTTP",
url: "www.testdownload.com",
enableMetered: false,
enableRoaming: false,
description: "test download",
title: ""
title: "",
networkType: "",
};
try {
let promise = request.download(downloadConfig);
......
......@@ -64,12 +64,20 @@ export default function inputMethodEngineJsunit() {
});
mKeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
mKeyboardDelegate.on('keyDown', (keyEvent) => {
console.log("inputMethodEngine beforeEach keyDown:" + keyEvent);
console.info("inputMethodEngine beforeEach keyDown:" + keyEvent.keyCode);
expect(keyEvent.keyCode).assertEqual('1');
console.info("inputMethodEngine beforeEach keyDown:" + keyEvent.keyAction);
expect(keyEvent.keyAction).assertEqual('1');
});
mKeyboardDelegate.on('keyUp', (keyEvent) => {
console.log("inputMethodEngine beforeEach keyUp:" + keyEvent.keyCode);
console.info("inputMethodEngine beforeEach keyUp:" + keyEvent.keyCode);
expect(keyEvent.keyCode).assertEqual('1');
console.info("inputMethodEngine beforeEach keyDown:" + keyEvent.keyAction);
expect(keyEvent.keyAction).assertEqual('0');
});
mKeyboardDelegate.on('cursorContextChange', (x, y, height) => {
console.log("inputMethodEngine beforeEach cursorContextChange x:" + x);
......@@ -271,9 +279,12 @@ export default function inputMethodEngineJsunit() {
});
it('inputMethodEngine_test_027', 0, async function (done) {
let rect = await Utils.getComponentRect('TextInput')
console.info("[inputMethodEngine_test_027] rectInfo is " + rect);
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 = {
......@@ -433,7 +444,7 @@ export default function inputMethodEngineJsunit() {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.getEditorAttribute(1, (editorAttribute) => {
console.log("inputMethodEngine_test_036 getEditorAttribute:" + value);
console.log("inputMethodEngine_test_038 getEditorAttribute:" + value);
expect(editorAttribute.inputPattern).assertEqual(1);
expect(editorAttribute.enterKeyType).assertEqual(1);
});
......@@ -447,11 +458,11 @@ export default function inputMethodEngineJsunit() {
} else {
let promise = textInputClient.getEditorAttribute();
promise.then(res => {
console.info("inputMethodEngine_test_037 getEditorAttribute promise result-----" + JSON.stringify(res));
console.info("inputMethodEngine_test_039 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));
console.info("inputMethodEngine_test_039 getEditorAttribute promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
......@@ -476,10 +487,38 @@ export default function inputMethodEngineJsunit() {
} else {
let promise = kbController.hideKeyboard();
promise.then(res => {
console.info("inputMethodEngine_test_037 hideKeyboard promise result-----" + JSON.stringify(res));
console.info("inputMethodEngine_test_041 hideKeyboard promise result-----" + JSON.stringify(res));
expect(1 == 1).assertTrue();
}).catch(err => {
console.info("inputMethodEngine_test_037 hideKeyboard promise error----" + JSON.stringify(err));
console.info("inputMethodEngine_test_041 hideKeyboard promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_042', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.getBackward(1, (value) => {
console.info("inputMethodEngine_test_042 getBackward:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_043', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.getBackward(1);
promise.then(res => {
console.info("inputMethodEngine_test_043 getBackward promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_043 getBackward promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
......
# This file is automatically generated by DevEco Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# For customization when using a Version Control System, please read the header note.
sdk.dir=C:/Users/lwx1095534/AppData/Local/OpenHarmony/Sdk
nodejs.dir=D:/DevEco Studio/tools/nodejs
npm.dir=D:/DevEco Studio/tools/nodejs
\ No newline at end of file
{
"BuildOptions":{},
"CommonInfo":{
"project.ide.version":"3.0.0.900"
}
}
\ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="EMPTY_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/actspasteboardjsapitest.iml" filepath="$PROJECT_DIR$/.idea/actspasteboardjsapitest.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>
\ No newline at end of file
# This file is automatically generated by DevEco Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# For customization when using a Version Control System, please read the header note.
sdk.dir=C:/Users/lwx1095534/AppData/Local/OpenHarmony/Sdk
nodejs.dir=D:/DevEco Studio/tools/nodejs
npm.dir=D:/DevEco Studio/tools/nodejs
\ No newline at end of file
......@@ -74,6 +74,12 @@ describe('WallpaperJsunitTest', function () {
await wallpaper.getColors(WALLPAPER_SYSTEM, function (err, data) {
console.info('wallpaperXTS ===> testGetColorsCallbackSystem err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + JSON.stringify(data));
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][0]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][1]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]);
console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]);
if (err) {
expect(null).assertFail();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册