提交 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
......@@ -49,6 +49,11 @@ describe('PasteBoardTest', function() {
console.log('f_test1: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue();
var types = pasteData.getMimeTypes();
console.info('f_test1: getMimeTypes = ' + types);
console.info('f_test1: getMimeTypes = ' + typeof (types));
expect("text/plain").assertEqual(types[0]);
console.log('f_test1: Checks the number of records');
systemPasteboard.getPasteData().then((data) => {
console.log('f_test1: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
......@@ -59,6 +64,15 @@ describe('PasteBoardTest', function() {
var primaryText = pasteData1.getPrimaryText()
console.log('f_test1: primaryText = ' + primaryText);
console.info('Checks pasteboard MAX_RECORD_NUM' + pasteboard.MAX_RECORD_NUM);
expect(pasteboard.MAX_RECORD_NUM == 128).assertTrue();
console.info('Checks PasteDataProperty.localOnly')
var pasteDataProperty = pasteData1.getProperty()
console.info('Checks: localOnly = ' + pasteDataProperty.localOnly)
console.log('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN);
console.log('f_test1: getPrimaryMimeType = ' + pasteData1.getPrimaryMimeType());
......@@ -310,6 +324,11 @@ describe('PasteBoardTest', function() {
var pasteData1 = data;
expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test6: Checks the pasteboard content');
var primaryHtml = pasteData1.getPrimaryHtml()
console.info('f_test6: getPrimaryHtml = ' + primaryHtml);
expect(primaryHtml == htmlText).assertTrue();
console.log('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true ||
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === false).assertTrue();
......@@ -448,6 +467,11 @@ describe('PasteBoardTest', function() {
var pasteData1 = data;
expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test9: Checks the pasteboard content');
var primaryUri = pasteData1.getPrimaryUri()
console.info('f_test9: getPrimaryUri = ' + primaryUri);
expect(primaryUri == uriText).assertTrue();
console.log('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true ||
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === false).assertTrue();
......@@ -569,9 +593,15 @@ describe('PasteBoardTest', function() {
bundleName: "com.example.myapplication8",
abilityName: "com.example.myapplication8.MainAbility"
}
console.log('f_test12: createWantData want = ' + want);
console.info('f_test12: createWantData want.bundleName = ' + want.bundleName);
console.info('f_test12: createWantData want.bundleName = ' + want.abilityName);
var pasteData = pasteboard.createWantData(want);
console.log('f_test12: createWantData pasteData = ' + JSON.stringify(pasteData));
console.info('f_test12: createWantData pasteData = ' + pasteData);
console.info('f_test12: createWantData pasteData = ' + JSON.stringify(pasteData));
console.log('f_test12: Writes PasteData to the pasteboard');
systemPasteboard.setPasteData(pasteData).then(() => {
......@@ -588,6 +618,13 @@ describe('PasteBoardTest', function() {
var pasteData1 = data;
expect(pasteData1.getRecordCount() == 1).assertTrue();
console.info('f_test12: Checks the pasteboard content');
var primaryWant = pasteData1.getPrimaryWant()
console.info('f_test12: createWantData want.bundleName = ' + primaryWant.bundleName);
console.info('f_test12: createWantData want.bundleName = ' + primaryWant.abilityName);
expect(want.bundleName).assertEqual(primaryWant.bundleName);
expect(want.abilityName).assertEqual(primaryWant.abilityName);
console.log('Checks there is a MIMETYPE_TEXT_WANT MIME type of data' + pasteboard.MIMETYPE_TEXT_WANT);
expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT) === true ||
pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT) === false).assertTrue();
......@@ -880,6 +917,14 @@ describe('PasteBoardTest', function() {
console.log('f_test18: addUriRecord = ' + uriText)
pasteData.addUriRecord(uriText)
var want = {
bundleName: "com.example.myapplication8",
abilityName: "com.example.myapplication8.MainAbility"
}
console.info('f_test18: addWantRecord = ' + want)
pasteData.addWantRecord(want)
console.log('f_test18: Writes PasteData to the pasteboard');
systemPasteboard.setPasteData(pasteData).then(() => {
console.log('f_test18: systemPasteboard.setPasteData promise');
......@@ -893,7 +938,7 @@ describe('PasteBoardTest', function() {
systemPasteboard.getPasteData().then((data) => {
console.log('f_test18: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
var pasteData1 = data;
expect(pasteData1.getRecordCount() == 3).assertTrue();
expect(pasteData1.getRecordCount() == 4).assertTrue();
console.log('SUB_pasteBoard_function_JS_API_1800 end');
done();
......@@ -1725,42 +1770,42 @@ describe('PasteBoardTest', function() {
* @tc.level : Level 0
*/
it('pasteboard_function_test33',0, async function (done) {
console.log('SUB_pasteBoard_function_JS_API_3300 start')
console.info('SUB_pasteBoard_function_JS_API_3300 start')
var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => {
console.log('f_test33: systemPasteboard.clear promise');
console.info('f_test33: systemPasteboard.clear promise');
var textData0 = 'Hello World!';
console.log('f_test33: createPlainTextData textData = ' + textData0);
console.info('f_test33: createPlainTextData textData = ' + textData0);
var pasteData = pasteboard.createPlainTextData(textData0);
console.log('f_test33: createPlainTextData pasteData = ' + JSON.stringify(pasteData));
console.info('f_test33: createPlainTextData pasteData = ' + JSON.stringify(pasteData));
var textData = ''
for(var i = 1; i < 2; i++)
{
textData = 'Hello World'
textData = textData + i
console.log('f_test33: addTextRecord = ' + textData)
console.info('f_test33: addTextRecord = ' + textData)
pasteData.addTextRecord(textData)
}
console.log('f_test33: Writes PasteData to the pasteboard');
console.info('f_test33: Writes PasteData to the pasteboard');
systemPasteboard.setPasteData(pasteData).then(() => {
console.log('f_test33: systemPasteboard.setPasteData promise');
console.info('f_test33: systemPasteboard.setPasteData promise');
console.log('f_test33: Checks there is content in the pasteboard')
console.info('f_test33: Checks there is content in the pasteboard')
systemPasteboard.hasPasteData().then((data) => {
console.log('f_test33: systemPasteboard.hasPasteData promise data = ' + data);
console.info('f_test33: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue();
console.log('f_test33: Checks the number of records');
console.info('f_test33: Checks the number of records');
systemPasteboard.getPasteData().then((data) => {
console.log('f_test33: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
console.info('f_test33: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
var pasteData1 = data;
expect(pasteData1.getRecordCount() == 2).assertTrue();
console.log('SUB_pasteBoard_function_JS_API_3300 end');
console.info('SUB_pasteBoard_function_.' + 'JS_API_3300 end');
done();
})
});
......@@ -3438,6 +3483,8 @@ describe('PasteBoardTest', function() {
console.log('f_test66 Converts the PlainTextData to text')
var pasteDataRecord = pasteData1.getRecordAt(0)
console.info('checks pasteDataRecord.mimeType = ' + pasteDataRecord.mimeType)
console.log('f_test66 pasteDataRecord.convertToText = ' + pasteDataRecord.convertToText);
console.log('f_test66 SUB_pasteBoard_function_JS_API_6600 end');
......@@ -3592,10 +3639,60 @@ describe('PasteBoardTest', function() {
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_7000
* @tc.name 复制文本、uri格式
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('pasteboard_function_test70',0, async function (done) {
console.info('SUB_pasteBoard_function_JS_API_7000 start')
var systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.clear().then(() => {
var textData0 = 'Hello World0'
console.info('f_test70: createPlainTextData = ' + textData0)
var pasteData = pasteboard.createPlainTextData(textData0)
console.info('f_test70: createPlainTextData = ' + JSON.stringify(pasteData))
var uriText = pasteboard.createUriRecord("https://www.baidu.com/");
pasteData.addRecord(uriText);
console.info('f_test70: addRecord(uriText) = ' + pasteData)
console.info('f_test70: addRecord(uriText) = ' + JSON.stringify(pasteData))
systemPasteboard.setPasteData(pasteData).then(() => {
console.info('---------------------------->1')
systemPasteboard.hasPasteData().then((data) => {
console.info('f_test70: systemPasteboard.hasPasteData promise data = ' + data);
expect(data === true || data === false).assertTrue();
systemPasteboard.getPasteData().then((data) => {
console.info('f_test70: systemPasteboard.getPasteData data = ' + JSON.stringify(data));
var pasteData1 = data;
var recordCount = pasteData1.getRecordCount();
console.info('f_test70: recordCount=' + recordCount);
expect(pasteData1.getRecordCount() == 2).assertTrue();
console.info('SUB_pasteBoard_function_JS_API_7000 end');
done();
})
});
});
});
})
/**
* The callback function is used for pasteboard content changes
*/
function contentChanges() {
console.log('#EVENT: The content is changed in the pasteboard')
}
})
});
# 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.
先完成此消息的编辑!
想要评论请 注册