提交 74e790eb 编写于 作者: Y yaocui

Merge branch 'OpenHarmony-3.2-Release' of...

Merge branch 'OpenHarmony-3.2-Release' of https://gitee.com/yaocui_moring/xts_acts into OpenHarmony-3.2-Release
......@@ -15,7 +15,11 @@
},
{
"type": "ShellKit",
"cleanup-apps": true
"run-command": [
"power-shell wakeup",
"uinput -T -m 594 2117 594 864 400",
"power-shell setmode 602"
]
}
]
}
\ No newline at end of file
......@@ -56,7 +56,7 @@ async function grantPerm() {
}
export default function objectStoreTestV9() {
describe('objectStoreTest', function () {
describe('objectStoreTestV9', function () {
beforeAll(async function (done) {
await grantPerm();
done();
......
......@@ -39,6 +39,9 @@ export class KeyboardDelegate {
this.initWindow();
let that = this;
inputMethodAbility.on("inputStop", () => {
inputMethodAbility.off("inputStop", () => {
console.log('====>inputMethodEngine delete inputStop notification.');
});
try{
that.mContext.destroy((err) => {
console.info(TAG + '====>inputMethodAbility destroy err:' + JSON.stringify(err));
......@@ -149,6 +152,26 @@ export class KeyboardDelegate {
console.debug(TAG + '====>inputMethodAbility_test_050 event:' + data.event);
that.inputMethodAbility_test_050();
break;
case 70:
console.debug(TAG + '====>inputMethodAbility_test_070 event:' + data.event);
that.inputMethodAbility_test_070();
break;
case 71:
console.debug(TAG + '====>inputMethodAbility_test_071 event:' + data.event);
that.inputMethodAbility_test_071();
break;
case 72:
console.debug(TAG + '====>inputMethodAbility_test_072 event:' + data.event);
that.inputMethodAbility_test_072();
break;
case 73:
console.debug(TAG + '====>inputMethodAbility_test_073 event:' + data.event);
that.inputMethodAbility_test_073();
break;
case 74:
console.debug(TAG + '====>inputMethodAbility_test_074 event:' + data.event);
that.inputMethodAbility_test_074();
break;
}
}
......@@ -738,7 +761,7 @@ export class KeyboardDelegate {
console.debug(TAG + '====>receive inputMethodAbility_test_045 data');
inputMethodAbility.on('inputStart', async (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
setTimeout(()=>{
let t = setTimeout(()=>{
let commonEventPublishData;
if (InputClient == null) {
commonEventPublishData = {
......@@ -761,6 +784,7 @@ export class KeyboardDelegate {
commoneventmanager.publish("inputMethodAbility_test_045", commonEventPublishData, this.publishCallback);
});
}
clearTimeout(t);
},1000);
});
......@@ -901,4 +925,144 @@ export class KeyboardDelegate {
});
}
private inputMethodAbility_test_070(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodAbility_test_070 success');
let count = 0;
inputMethodAbility.on('inputStart', (KeyboardDelegate, InputClient) => {
inputMethodAbility.off('inputStart');
console.info(TAG + '====>inputMethodAbility.on("inputStart") count: ' + count);
count += 1;
});
inputMethodAbility.on('keyboardShow', () => {
inputMethodAbility.off('keyboardShow');
console.info(TAG + '====>inputMethodAbility.on("keyboardShow") count: ' + count);
count += 1;
});
inputMethodAbility.on('setSubtype', () => {
inputMethodAbility.off('setSubtype');
console.info(TAG + '====>inputMethodAbility.on("setSubtype") count: ' + count);
count += 1;
});
let t = setTimeout(() => {
if(count === 3){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodAbility_test_070", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},500);
}
private inputMethodAbility_test_071(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodAbility_test_071 success');
let count = 0;
inputMethodAbility.on('keyboardHide', () => {
count += 1;
inputMethodAbility.off("keyboardHide");
console.info(TAG + '====>inputMethodAbility.off("keyboardHide") count: ' + count);
});
inputMethodAbility.on('inputStart', (KeyboardDelegate, InputClient) => {
console.info(TAG + '====>inputMethodAbility_test_071 inputMethodAbility.on("inputStart")');
let t = setInterval(async () => {
await KeyboardDelegate.hideKeyboard();
console.info(TAG + '====>KeyboardDelegate.hideKeyboard count: ' + count);
if(count === 1){
clearInterval(t);
}
},100);
});
let t = setTimeout(() => {
if(count === 1){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodAbility_test_071", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},500);
}
private inputMethodAbility_test_072(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodAbility_test_072 success');
let count = 0;
inputMethodAbility.on('keyboardShow', () => {
count += 1;
inputMethodAbility.off("keyboardShow");
console.info(TAG + '====>inputMethodAbility.off("keyboardShow") count: ' + count);
});
let t = setTimeout(() => {
if(count === 1){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodAbility_test_072", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},300);
}
private inputMethodAbility_test_073(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodAbility_test_073 success');
let count = 0;
inputKeyboardDelegate.on('keyDown', (keyEvent) => {
inputKeyboardDelegate.off('keyDown');
console.info(TAG + "====>inputKeyboardDelegate.on('keyDown') count: " + count);
if (keyEvent.keyCode === 2000){
count += 1;
}
return true;
});
inputKeyboardDelegate.on('keyUp', (keyEvent) => {
inputKeyboardDelegate.off('keyUp');
console.info(TAG + "====>inputKeyboardDelegate.on('keyUp') count: " + count);
if (keyEvent.keyCode === 2000){
count += 1;
}
console.info(TAG + "====>inputKeyboardDelegate.on('keyUp') count: " + count);
return true;
});
let t = setTimeout(() => {
if(count === 2){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodAbility_test_073", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},500);
}
private inputMethodAbility_test_074(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodAbility_test_074 success');
inputMethodAbility.on('setCallingWindow', (wid) => {
console.info(TAG + "====>inputKeyboardDelegate.on('setCallingWindow')" + wid);
inputMethodAbility.off('setCallingWindow', () => {
console.log('inputMethodAbility off setCallingWindow' );
});
if (typeof(wid) === "number"){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodAbility_test_074", commonEventPublishData, this.publishCallback);
});
}
}
\ No newline at end of file
......@@ -40,6 +40,9 @@ export class KeyboardController {
this.initWindow();
let that = this;
inputMethodAbility.on("inputStop", () => {
inputMethodAbility.off("inputStop", () => {
console.log('====>inputMethodEngine delete inputStop notification.');
});
try{
that.mContext.destroy((err) => {
console.info(TAG + '====>inputMethodEngine destroy err:' + JSON.stringify(err));
......@@ -133,6 +136,30 @@ export class KeyboardController {
console.debug(TAG + '====>inputMethodEngine_test_050 event:' + data.event);
that.inputMethodEngine_test_050();
break;
case 71:
console.debug(TAG + '====>inputMethodEngine_test_071 event:' + data.event);
that.inputMethodEngine_test_071();
break;
case 72:
console.debug(TAG + '====>inputMethodEngine_test_072 event:' + data.event);
that.inputMethodEngine_test_072();
break;
case 73:
console.debug(TAG + '====>inputMethodEngine_test_073 event:' + data.event);
that.inputMethodEngine_test_073();
break;
case 74:
console.debug(TAG + '====>inputMethodEngine_test_074 event:' + data.event);
that.inputMethodEngine_test_074();
break;
case 76:
console.debug(TAG + '====>inputMethodEngine_test_076 event:' + data.event);
that.inputMethodEngine_test_076();
break;
case 77:
console.debug(TAG + '====>inputMethodEngine_test_077 event:' + data.event);
that.inputMethodEngine_test_077();
break;
}
}
......@@ -774,7 +801,186 @@ export class KeyboardController {
});
}
private inputMethodEngine_test_071(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodEngine_test_071 success');
let count = 0;
inputMethodEngine.on('keyboardHide', () => {
count += 1;
inputMethodEngine.off("keyboardHide");
console.info(TAG + '====>inputMethodEngine.off("keyboardHide") count: ' + count);
});
inputMethodEngine.on('inputStart', (KeyboardDelegate, InputClient) => {
inputMethodEngine.off('inputStart');
console.info(TAG + '====>inputMethodEngine_test_071 inputMethodEngine.on("inputStart")');
let t = setInterval(async () => {
await KeyboardDelegate.hideKeyboard();
console.info(TAG + '====>KeyboardDelegate.hideKeyboard count: ' + count);
if(count === 1){
clearInterval(t);
}
},100);
});
let t = setTimeout(() => {
if(count === 1){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodEngine_test_071", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},500);
}
private inputMethodEngine_test_072(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodEngine_test_072 success');
let count = 0;
inputMethodEngine.on('keyboardShow', () => {
count += 1;
inputMethodEngine.off("keyboardShow");
console.info(TAG + '====>inputMethodEngine.off("keyboardShow") count: ' + count);
});
let t = setTimeout(() => {
if(count === 1){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodEngine_test_072", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},500);
}
private inputMethodEngine_test_073(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodEngine_test_073 success');
let count = 0;
inputKeyboardDelegate.on('keyDown', (keyEvent) => {
inputKeyboardDelegate.off('keyDown');
console.info(TAG + "====>inputKeyboardDelegate.on('keyDown') count: " + count);
if (keyEvent.keyCode === 2000){
count += 1;
}
return true;
});
inputKeyboardDelegate.on('keyUp', (keyEvent) => {
inputKeyboardDelegate.off('keyUp');
console.info(TAG + "====>inputKeyboardDelegate.on('keyUp') count: " + count);
if (keyEvent.keyCode === 2000){
count += 1;
}
return true;
});
let t = setTimeout(() => {
commonEventPublishData = {
data: "SUCCESS"
};
commoneventmanager.publish("inputMethodEngine_test_073", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},300);
}
private inputMethodEngine_test_074(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodEngine_test_074 success');
let count = 0;
inputKeyboardDelegate.on('cursorContextChange', (x, y, h) => {
console.info(TAG + "====>inputKeyboardDelegate.on('cursorContextChange') count: " + count);
if (count === 1){
inputKeyboardDelegate.off('cursorContextChange');
}
count += 1;
console.info(TAG + '====>inputMethodEngine_test_074 x,y,z: ' + x + "---" + y + "---" + h);
});
inputMethodEngine.on('inputStart', (KeyboardDelegate, InputClient) => {
inputMethodEngine.off('inputStart');
console.info(TAG + '====>inputMethodEngine_test_074 inputMethodEngine.on("inputStart")');
let t = setInterval(async () => {
await InputClient.insertText("ttt");
console.info(TAG + '====>KeyboardDelegate.insertText count: ' + count);
if(count === 2){
clearInterval(t);
}
},100);
});
let t = setTimeout(() => {
console.info(TAG + '====>inputMethodEngine_test_074 setTimeout: ' + count);
if(count === 2){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodEngine_test_074", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},1000);
}
private inputMethodEngine_test_076(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodEngine_test_076 success');
inputKeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
console.info(TAG + "====>inputKeyboardDelegate.on('selectionChange')");
inputKeyboardDelegate.off('selectionChange');
commonEventPublishData = {
data: "SUCCESS"
};
console.info(TAG + '====>inputMethodEngine_test_076 oldBegin,oldEnd,newBegin,newEnd: ' + oldBegin + "---" + oldEnd + "---" + newBegin + "---" + newEnd);
});
let t = setTimeout(() => {
commoneventmanager.publish("inputMethodEngine_test_076", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},2000);
}
private inputMethodEngine_test_077(): void{
let commonEventPublishData = {
data: "FAILED"
};
console.info(TAG + '====>receive inputMethodEngine_test_077 success');
let count = 0;
inputKeyboardDelegate.on('textChange', (text) => {
console.info(TAG + "====>inputKeyboardDelegate.on('textChange') count:" + count);
if (count === 1){
inputKeyboardDelegate.off('textChange');
}
count += 1;
console.info(TAG + '====>inputMethodEngine_test_077 text: ' + text);
});
inputMethodEngine.on('inputStart', (KeyboardDelegate, InputClient) => {
inputMethodEngine.off('inputStart');
console.info(TAG + '====>inputMethodEngine_test_077 inputMethodEngine.on("inputStart")');
let t = setInterval(async () => {
await InputClient.insertText("tttt");
console.info(TAG + '====>KeyboardDelegate.insertText count: ' + count);
if(count === 2){
clearInterval(t);
}
},100);
});
let t = setTimeout(() => {
console.info(TAG + '====>inputMethodEngine_test_077 setTimeout: ' + count);
if(count === 2){
commonEventPublishData = {
data: "SUCCESS"
};
}
commoneventmanager.publish("inputMethodEngine_test_077", commonEventPublishData, this.publishCallback);
clearTimeout(t);
},500);
}
}
\ No newline at end of file
......@@ -15,7 +15,6 @@
import inputMethodEngine from './inputMethodEngine.test'
import inputMethodAbility from './inputMethodAbility.test'
export default function testsuite() {
inputMethodEngine();
inputMethodAbility();
......
......@@ -1592,5 +1592,291 @@ export default function inputMethodAbility() {
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
it('inputMethodAbility_test_070', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>inputMethodAbility_test_070 unSubscriberCallback start");
if (err){
console.info("====>inputMethodAbility_test_070 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodAbility_test_070 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>inputMethodAbility_test_070 subscriberCallback data:"
+ JSON.stringify(data));
commonEventManager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodAbility_test_070 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>inputMethodAbility_test_070 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err){
console.info("====>inputMethodAbility_test_070 publishCallback start");
if (err){
console.info("====>inputMethodAbility_test_070 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodAbility_test_070"]
}
var subscriber;
commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>inputMethodAbility_test_070 subscriber data:" + JSON.stringify(data));
commonEventManager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodAbility_test_070 subscriber finish")
})
var commonEventPublishData = {
code: 70
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
it('inputMethodAbility_test_071', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>inputMethodAbility_test_071 unSubscriberCallback start");
if (err){
console.info("====>inputMethodAbility_test_071 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodAbility_test_071 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>inputMethodAbility_test_071 subscriberCallback data:"
+ JSON.stringify(data));
commonEventManager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodAbility_test_071 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>inputMethodAbility_test_071 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err){
console.info("====>inputMethodAbility_test_071 publishCallback start");
if (err){
console.info("====>inputMethodAbility_test_071 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodAbility_test_071"]
}
var subscriber;
commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>inputMethodAbility_test_071 subscriber data:" + JSON.stringify(data));
commonEventManager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodAbility_test_071 subscriber finish")
})
var commonEventPublishData = {
code: 71
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
it('inputMethodAbility_test_072', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>inputMethodAbility_test_072 unSubscriberCallback start");
if (err){
console.info("====>inputMethodAbility_test_072 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodAbility_test_072 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>inputMethodAbility_test_072 subscriberCallback data:"
+ JSON.stringify(data));
commonEventManager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodAbility_test_072 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>inputMethodAbility_test_072 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err){
console.info("====>inputMethodAbility_test_072 publishCallback start");
if (err){
console.info("====>inputMethodAbility_test_072 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodAbility_test_072"]
}
var subscriber;
commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>inputMethodAbility_test_072 subscriber data:" + JSON.stringify(data));
commonEventManager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodAbility_test_072 subscriber finish")
})
var commonEventPublishData = {
code: 72
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
it('inputMethodAbility_test_073', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>inputMethodAbility_test_073 unSubscriberCallback start");
if (err){
console.info("====>inputMethodAbility_test_073 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodAbility_test_073 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>inputMethodAbility_test_073 subscriberCallback data:"
+ JSON.stringify(data));
commonEventManager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodAbility_test_073 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>inputMethodAbility_test_073 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err){
console.info("====>inputMethodAbility_test_073 publishCallback start");
if (err){
console.info("====>inputMethodAbility_test_073 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
let t = setTimeout(() => {
runCmd("uinput -K -d 2000 -u 2000");
clearTimeout(t);
},200);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodAbility_test_073"]
}
var subscriber;
commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>inputMethodAbility_test_073 subscriber data:" + JSON.stringify(data));
commonEventManager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodAbility_test_073 subscriber finish")
})
var commonEventPublishData = {
code: 73
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
it('inputMethodAbility_test_074', 0, async function (done) {
function unSubscriberCallback (err){
console.info("====>inputMethodAbility_test_074 unSubscriberCallback start");
if (err){
console.info("====>inputMethodAbility_test_074 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodAbility_test_074 unSubscriberCallback finish");
}
}
function subscriberCallback (err, data){
console.info("====>inputMethodAbility_test_074 subscriberCallback data:"
+ JSON.stringify(data));
commonEventManager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try{
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodAbility_test_074 end");
clearTimeout(t);
done();
}catch(err){
console.info("====>inputMethodAbility_test_074 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500);
}
function publishCallback(err){
console.info("====>inputMethodAbility_test_074 publishCallback start");
if (err){
console.info("====>inputMethodAbility_test_074 publishCallback failed:" + JSON.stringify(err));
} else {
let count = 0;
let t = setInterval(() => {
count += 1;
runCmd(getFocusCmd);
if (count === 2){
clearInterval(t);
}
}, 500);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodAbility_test_074"]
}
var subscriber;
commonEventManager.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.info("====>inputMethodAbility_test_074 subscriber data:" + JSON.stringify(data));
commonEventManager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodAbility_test_074 subscriber finish");
})
var commonEventPublishData = {
code: 74
}
commonEventManager.publish('test', commonEventPublishData, publishCallback);
});
});
};
......@@ -1198,6 +1198,339 @@ export default function inputMethodEngineJSUnit() {
commoneventmanager.publish('test1', commonEventPublishData, publishCallback);
});
it('inputMethodEngine_test_071', 0, async function (done) {
function unSubscriberCallback(err) {
console.info("====>inputMethodEngine_test_071 unSubscriberCallback start");
if (err) {
console.info("====>inputMethodEngine_test_071 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodEngine_test_071 unSubscriberCallback finish")
}
}
function subscriberCallback(err, data) {
console.info("====>inputMethodEngine_test_071 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try {
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodEngine_test_071 end");
clearTimeout(t);
done();
} catch (err) {
console.info("====>inputMethodEngine_test_071 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err) {
console.info("====>inputMethodEngine_test_071 publishCallback start");
if (err) {
console.info("====>inputMethodEngine_test_071 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodEngine_test_071"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => {
subscriber = data;
console.info("====>inputMethodEngine_test_071 subscriber data:" + JSON.stringify(data))
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodEngine_test_071 subscriber finish")
})
var commonEventPublishData = {
code: 71
}
commoneventmanager.publish('test1', commonEventPublishData, publishCallback)
});
it('inputMethodEngine_test_072', 0, async function (done) {
function unSubscriberCallback(err) {
console.info("====>inputMethodEngine_test_072 unSubscriberCallback start");
if (err) {
console.info("====>inputMethodEngine_test_072 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodEngine_test_072 unSubscriberCallback finish")
}
}
function subscriberCallback(err, data) {
console.info("====>inputMethodEngine_test_072 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try {
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodEngine_test_072 end");
clearTimeout(t);
done();
} catch (err) {
console.info("====>inputMethodEngine_test_072 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err) {
console.info("====>inputMethodEngine_test_072 publishCallback start");
if (err) {
console.info("====>inputMethodEngine_test_072 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodEngine_test_072"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => {
subscriber = data;
console.info("====>inputMethodEngine_test_072 subscriber data:" + JSON.stringify(data))
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodEngine_test_072 subscriber finish")
})
var commonEventPublishData = {
code: 72
}
commoneventmanager.publish('test1', commonEventPublishData, publishCallback)
});
it('inputMethodEngine_test_073', 0, async function (done) {
function unSubscriberCallback(err) {
console.info("====>inputMethodEngine_test_073 unSubscriberCallback start");
if (err) {
console.info("====>inputMethodEngine_test_073 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodEngine_test_073 unSubscriberCallback finish")
}
}
function subscriberCallback(err, data) {
console.info("====>inputMethodEngine_test_073 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try {
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodEngine_test_073 end");
clearTimeout(t);
done();
} catch (err) {
console.info("====>inputMethodEngine_test_073 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err) {
console.info("====>inputMethodEngine_test_073 publishCallback start");
if (err) {
console.info("====>inputMethodEngine_test_073 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
let t = setTimeout(() => {
runCmd("uinput -K -d 2000 -u 2000");
clearTimeout(t);
},200)
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodEngine_test_073"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => {
subscriber = data;
console.info("====>inputMethodEngine_test_073 subscriber data:" + JSON.stringify(data))
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodEngine_test_073 subscriber finish")
})
var commonEventPublishData = {
code: 73
}
commoneventmanager.publish('test1', commonEventPublishData, publishCallback)
});
it('inputMethodEngine_test_074', 0, async function (done) {
function unSubscriberCallback(err) {
console.info("====>inputMethodEngine_test_074 unSubscriberCallback start");
if (err) {
console.info("====>inputMethodEngine_test_074 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodEngine_test_074 unSubscriberCallback finish")
}
}
function subscriberCallback(err, data) {
console.info("====>inputMethodEngine_test_074 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try {
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodEngine_test_074 end");
clearTimeout(t);
done();
} catch (err) {
console.info("====>inputMethodEngine_test_074 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err) {
console.info("====>inputMethodEngine_test_074 publishCallback start");
if (err) {
console.info("====>inputMethodEngine_test_074 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodEngine_test_074"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => {
subscriber = data;
console.info("====>inputMethodEngine_test_074 subscriber data:" + JSON.stringify(data))
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodEngine_test_074 subscriber finish")
})
var commonEventPublishData = {
code: 74
}
commoneventmanager.publish('test1', commonEventPublishData, publishCallback)
});
it('inputMethodEngine_test_076', 0, async function (done) {
function unSubscriberCallback(err) {
console.info("====>inputMethodEngine_test_076 unSubscriberCallback start");
if (err) {
console.info("====>inputMethodEngine_test_076 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodEngine_test_076 unSubscriberCallback finish")
}
}
function subscriberCallback(err, data) {
console.info("====>inputMethodEngine_test_076 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try {
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodEngine_test_076 end");
clearTimeout(t);
done();
} catch (err) {
console.info("====>inputMethodEngine_test_076 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err) {
console.info("====>inputMethodEngine_test_076 publishCallback start");
if (err) {
console.info("====>inputMethodEngine_test_076 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodEngine_test_076"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => {
subscriber = data;
console.info("====>inputMethodEngine_test_076 subscriber data:" + JSON.stringify(data))
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodEngine_test_076 subscriber finish")
})
var commonEventPublishData = {
code: 76
}
commoneventmanager.publish('test1', commonEventPublishData, publishCallback)
});
it('inputMethodEngine_test_077', 0, async function (done) {
function unSubscriberCallback(err) {
console.info("====>inputMethodEngine_test_077 unSubscriberCallback start");
if (err) {
console.info("====>inputMethodEngine_test_077 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.info("====>inputMethodEngine_test_077 unSubscriberCallback finish")
}
}
function subscriberCallback(err, data) {
console.info("====>inputMethodEngine_test_077 subscriberCallback data:"
+ JSON.stringify(data));
commoneventmanager.unsubscribe(subscriber, unSubscriberCallback);
let t = setTimeout(() => {
try {
expect(data.data).assertEqual("SUCCESS");
console.info("====>inputMethodEngine_test_077 end");
clearTimeout(t);
done();
} catch (err) {
console.info("====>inputMethodEngine_test_077 err:" + JSON.stringify(err));
clearTimeout(t);
done();
}
}, 500)
}
function publishCallback(err) {
console.info("====>inputMethodEngine_test_077 publishCallback start");
if (err) {
console.info("====>inputMethodEngine_test_077 publishCallback failed:" + JSON.stringify(err));
} else {
runCmd(getFocusCmd);
}
}
var commonEventSubscribeInfo = {
events: ["inputMethodEngine_test_077"]
}
var subscriber;
commoneventmanager.createSubscriber(commonEventSubscribeInfo).then((data) => {
subscriber = data;
console.info("====>inputMethodEngine_test_077 subscriber data:" + JSON.stringify(data))
commoneventmanager.subscribe(subscriber, subscriberCallback);
console.info("====>inputMethodEngine_test_077 subscriber finish")
})
var commonEventPublishData = {
code: 77
}
commoneventmanager.publish('test1', commonEventPublishData, publishCallback)
});
})
}
\ No newline at end of file
......@@ -18,9 +18,8 @@
"name": ".MyApplication",
"mainAbility": "com.acts.inputmethodtest.MainAbility",
"deviceType": [
"tablet",
"default",
"phone"
"tablet",
"default"
],
"distro": {
"deliveryWithInstall": true,
......@@ -78,8 +77,7 @@
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/input"
"pages/index"
],
"name": ".MainAbility",
"window": {
......
// @ts-nocheck
/**
* 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.
*/
@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)
}
}
}
......@@ -13,9 +13,7 @@
* limitations under the License.
*/
import inputMethodJSUnit from './inputMethodJSUnit';
import inputMethodEngineJSUnit from './inputMethodEngineJSUnit';
export default function testsuite() {
inputMethodJSUnit();
inputMethodEngineJSUnit();
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default 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) {
let xStep;
let yStep;
let swipeSteps;
let 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)
let 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 (let i = 1;i <= swipeSteps; i++) {
let 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)
}
let 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)
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册