Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
aa795f5c
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看板
提交
aa795f5c
编写于
5月 26, 2023
作者:
W
wang-xupeng2
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update Beta1 demo
Signed-off-by:
N
wang-xupeng2
<
wangxupeng2@huawei.com
>
上级
12360681
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
116 addition
and
91 deletion
+116
-91
arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets
...onent_three/entry/src/main/ets/test/ButtonJsunit.test.ets
+15
-4
arkui/ace_ets_component_three/entry/src/main/ets/test/TabsJsunit.test.ets
...mponent_three/entry/src/main/ets/test/TabsJsunit.test.ets
+1
-0
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/slider.ets
...ponent_ui/entry/src/main/ets/MainAbility/pages/slider.ets
+3
-3
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/stepper.ets
...onent_ui/entry/src/main/ets/MainAbility/pages/stepper.ets
+1
-1
arkui/ace_ets_component_ui/entry/src/main/ets/test/BlankJsunit.test.ets
...component_ui/entry/src/main/ets/test/BlankJsunit.test.ets
+2
-2
arkui/ace_ets_component_ui/entry/src/main/ets/test/GridJsunit.test.ets
..._component_ui/entry/src/main/ets/test/GridJsunit.test.ets
+11
-13
arkui/ace_ets_component_ui/entry/src/main/ets/test/SearchJsunit.test.ets
...omponent_ui/entry/src/main/ets/test/SearchJsunit.test.ets
+26
-18
arkui/ace_ets_component_ui/entry/src/main/ets/test/SelectJsunit.test.ets
...omponent_ui/entry/src/main/ets/test/SelectJsunit.test.ets
+14
-15
arkui/ace_ets_component_ui/entry/src/main/ets/test/TextPickerJsunit.test.ets
...nent_ui/entry/src/main/ets/test/TextPickerJsunit.test.ets
+5
-5
arkui/ace_ets_component_ui/entry/src/main/ets/test/ToggleJsunit.test.ets
...omponent_ui/entry/src/main/ets/test/ToggleJsunit.test.ets
+1
-1
arkui/ace_ets_component_ui/entry/src/main/ets/test/marqueeJsunit.test.ets
...mponent_ui/entry/src/main/ets/test/marqueeJsunit.test.ets
+4
-4
arkui/ace_ets_component_ui/entry/src/main/ets/test/stepperJsunit.test.ets
...mponent_ui/entry/src/main/ets/test/stepperJsunit.test.ets
+28
-21
arkui/ace_ets_component_ui/entry/src/main/ets/test/textAreaJsunit.test.ets
...ponent_ui/entry/src/main/ets/test/textAreaJsunit.test.ets
+5
-4
未找到文件。
arkui/ace_ets_component_three/entry/src/main/ets/test/ButtonJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -17,6 +17,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
...
@@ -17,6 +17,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "
import router from '@system.router';
import router from '@system.router';
import events_emitter from '@ohos.events.emitter'
import events_emitter from '@ohos.events.emitter'
import Utils from './Utils';
import Utils from './Utils';
import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.UiTest';
export default function buttonJsunit() {
export default function buttonJsunit() {
describe('buttonTest', function () {
describe('buttonTest', function () {
...
@@ -299,6 +300,9 @@ export default function buttonJsunit() {
...
@@ -299,6 +300,9 @@ export default function buttonJsunit() {
});
});
it('testButton12', 0, async function (done) {
it('testButton12', 0, async function (done) {
let driver = Driver.create();
let density = await driver.getDisplayDensity();
console.info("[testButton12] getDisplayDensity is: " + JSON.stringify(density));
await Utils.sleep(1000);
await Utils.sleep(1000);
var callback = (eventData) => {
var callback = (eventData) => {
console.info("[testButton12] get event state result is: " + JSON.stringify(eventData));
console.info("[testButton12] get event state result is: " + JSON.stringify(eventData));
...
@@ -307,10 +311,17 @@ export default function buttonJsunit() {
...
@@ -307,10 +311,17 @@ export default function buttonJsunit() {
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenY));
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenY));
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX));
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX));
try {
try {
expect(event.screenX).assertEqual(185)
if(density.x == 1080){
expect(event.screenY).assertEqual(533)
expect(Math.trunc(event.screenX)).assertEqual(185)
expect(event.x).assertEqual(100)
expect(Math.trunc(event.screenY)).assertEqual(533)
expect(event.y).assertEqual(50)
expect(Math.trunc(event.x)).assertEqual(100)
expect(Math.trunc(event.y)).assertEqual(50)
}else{
expect(Math.trunc(event.screenX)).assertEqual(185)
expect(Math.trunc(event.screenY)).assertEqual(523)
expect(Math.trunc(event.x)).assertEqual(100)
expect(Math.trunc(event.y)).assertEqual(50)
}
} catch (err) {
} catch (err) {
console.info("[testButton12_] expection err : " + JSON.stringify(err));
console.info("[testButton12_] expection err : " + JSON.stringify(err));
expect().assertFail();
expect().assertFail();
...
...
arkui/ace_ets_component_three/entry/src/main/ets/test/TabsJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -300,6 +300,7 @@ export default function tabsJsunit() {
...
@@ -300,6 +300,7 @@ export default function tabsJsunit() {
console.info("testTabs_1400 click result is: " + JSON.stringify(sendEventByKey('tabContent1', 10, "")));
console.info("testTabs_1400 click result is: " + JSON.stringify(sendEventByKey('tabContent1', 10, "")));
await Utils.sleep(1000);
await Utils.sleep(1000);
console.info('testTabs_1400 END');
console.info('testTabs_1400 END');
done();
});
});
})
})
}
}
\ No newline at end of file
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/slider.ets
浏览文件 @
aa795f5c
...
@@ -206,7 +206,7 @@ struct SliderExample {
...
@@ -206,7 +206,7 @@ struct SliderExample {
Text(this.modeT).fontSize(9).fontColor(0xCCCCCC).width('50%').margin(15).key('modeT')
Text(this.modeT).fontSize(9).fontColor(0xCCCCCC).width('50%').margin(15).key('modeT')
Row() {
Row() {
Slider({
Slider({
value: this.vInSetValueOne
1
,
value: this.vInSetValueOne,
style: this.style,
style: this.style,
direction: this.directionT,
direction: this.directionT,
reverse: this.reverse,// 竖向的Slider默认是上端是min值,下端是max值,因此想要从下往上滑动,需要设置reverse为true
reverse: this.reverse,// 竖向的Slider默认是上端是min值,下端是max值,因此想要从下往上滑动,需要设置reverse为true
...
@@ -215,7 +215,7 @@ struct SliderExample {
...
@@ -215,7 +215,7 @@ struct SliderExample {
step:this.step
step:this.step
}).showTips(true)
}).showTips(true)
.onChange((value: number, mode: SliderChangeMode) => {
.onChange((value: number, mode: SliderChangeMode) => {
this.vInSetValueOne
1
= value
this.vInSetValueOne = value
console.info('value:' + value + 'm`ode:' + mode.toString())
console.info('value:' + value + 'm`ode:' + mode.toString())
}).key('sliderConstructor')
}).key('sliderConstructor')
...
@@ -233,7 +233,7 @@ struct SliderExample {
...
@@ -233,7 +233,7 @@ struct SliderExample {
Slider().showTips(true)
Slider().showTips(true)
.onChange((value: number, mode: SliderChangeMode) => {
.onChange((value: number, mode: SliderChangeMode) => {
this.vInSetValueOne = value
this.vInSetValueOne
1
= value
this.modeT = mode.toString()
this.modeT = mode.toString()
console.info('value:' + value + 'm`ode:' + mode.toString())
console.info('value:' + value + 'm`ode:' + mode.toString())
}).key('sliderConstructor2')
}).key('sliderConstructor2')
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/stepper.ets
浏览文件 @
aa795f5c
...
@@ -88,7 +88,7 @@ struct StepperExample {
...
@@ -88,7 +88,7 @@ struct StepperExample {
// 第二个步骤页
// 第二个步骤页
StepperItem() {
StepperItem() {
Column() {
Column() {
Text('Page Two')
Text('Page Two')
.key('pageTwo')
.itemTextStyle()
.itemTextStyle()
Button('change status:' + this.secondState)
Button('change status:' + this.secondState)
.backgroundColor('#007dFF')
.backgroundColor('#007dFF')
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/BlankJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -88,7 +88,7 @@ export default function blankJsunit() {
...
@@ -88,7 +88,7 @@ export default function blankJsunit() {
let obj = JSON.parse(strJson);
let obj = JSON.parse(strJson);
console.info("[blankJsunit_0300'] component obj is: " + obj.$attrs.min);
console.info("[blankJsunit_0300'] component obj is: " + obj.$attrs.min);
// return not the default value to confirm ?
// return not the default value to confirm ?
expect(obj.$attrs.min).assertEqual('0.00
px
');
expect(obj.$attrs.min).assertEqual('0.00
vp
');
done();
done();
});
});
...
@@ -162,7 +162,7 @@ export default function blankJsunit() {
...
@@ -162,7 +162,7 @@ export default function blankJsunit() {
let strJson2 = getInspectorByKey('bl2');
let strJson2 = getInspectorByKey('bl2');
let obj2 = JSON.parse(strJson2);
let obj2 = JSON.parse(strJson2);
console.info("[blankJsunit_0300'] component obj2 is: " + JSON.stringify(obj2));
console.info("[blankJsunit_0300'] component obj2 is: " + JSON.stringify(obj2));
expect(obj2.$attrs.min).assertEqual('0.00
px
');
expect(obj2.$attrs.min).assertEqual('0.00
vp
');
done();
done();
});
});
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/GridJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -143,12 +143,9 @@ export default function GridJsunit() {
...
@@ -143,12 +143,9 @@ export default function GridJsunit() {
// Verify onScrollIndex event
// Verify onScrollIndex event
let grid2 = CommonFunc.getComponentRect('grid2');
let grid2 = CommonFunc.getComponentRect('grid2');
let top = grid2.top
let top = grid2.top
let grid2b = CommonFunc.getComponentRect('grid2');
let bottom = grid2.bottom
let bottom = grid2b.bottom
let left = grid2.left
let grid2l = CommonFunc.getComponentRect('grid2');
let right = grid2.right
let left = grid2l.left
let grid2r = CommonFunc.getComponentRect('grid2');
let right = grid2r.right
let driver = await UiDriver.create()
let driver = await UiDriver.create()
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
await driver.swipe(Math.round((right - left) / 2), Math.round(bottom - 10), Math.round((right - left) / 2), Math.round(top + 10));
...
@@ -166,9 +163,10 @@ export default function GridJsunit() {
...
@@ -166,9 +163,10 @@ export default function GridJsunit() {
let button = await driver.findComponent(BY.key('button'));
let button = await driver.findComponent(BY.key('button'));
await button.click();
await button.click();
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let button1 = await driver.findComponent(BY.key('button'));
let strJson = getInspectorByKey('button');
let text3 = await button1.getText();
let obj = JSON.parse(strJson);
expect(text3).assertEqual('clicked');
console.info('[GridJsunit_0400] component obj is: ' + obj.$attrs.content);
expect(obj.$attrs.label).assertEqual('clicked');
console.info('[GridJsunit_0400] END');
console.info('[GridJsunit_0400] END');
done();
done();
});
});
...
@@ -241,10 +239,10 @@ export default function GridJsunit() {
...
@@ -241,10 +239,10 @@ export default function GridJsunit() {
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let driver = await UiDriver.create()
let driver = await UiDriver.create()
let gridItem1 = CommonFunc.getComponentRect('0');
let gridItem1 = CommonFunc.getComponentRect('0');
let
top1 = gridItem1.top
let
left1 = gridItem1.left
let gridItem2 = CommonFunc.getComponentRect('
4
');
let gridItem2 = CommonFunc.getComponentRect('
1
');
let
top2 = gridItem2.top
let
left2 = gridItem2.left
expect(
top1).assertEqual(parseInt(top
2));
expect(
parseInt(left1)).assertEqual(parseInt(left
2));
console.info('[GridJsunit_0800] END');
console.info('[GridJsunit_0800] END');
done();
done();
});
});
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/SearchJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -134,18 +134,20 @@ export default function SearchJsunit() {
...
@@ -134,18 +134,20 @@ export default function SearchJsunit() {
let textComponent1 = await driver.findComponent(BY.key('search'));
let textComponent1 = await driver.findComponent(BY.key('search'));
await textComponent1.inputText("hello")
await textComponent1.inputText("hello")
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let change = await driver.findComponent(BY.key('change'));
let strJson1 = getInspectorByKey('change');
let text1 = await change.getText();
let obj1 = JSON.parse(strJson1);
expect(text1).assertEqual('onChange:hello');
console.info("[SearchJsunit_0300] obj1: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('onChange:hello');
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
// Verify the onSubmit function of the Search component
// Verify the onSubmit function of the Search component
let textComponent2 = await driver.findComponent(BY.text('CLICK_SEARCH'));
let textComponent2 = await driver.findComponent(BY.text('CLICK_SEARCH'));
await textComponent2.click()
await textComponent2.click()
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let submit = await driver.findComponent(BY.key('submit'));
let strJson2 = getInspectorByKey('submit');
let text2 = await submit.getText();
let obj2 = JSON.parse(strJson2);
expect(text2).assertEqual('onSubmit:hello');
console.info("[SearchJsunit_0300] obj2: " + JSON.stringify(obj2));
expect(obj2.$attrs.content).assertEqual('onSubmit:hello');
// Verify the onCopy function of the Search component
// Verify the onCopy function of the Search component
await textComponent1.longClick()
await textComponent1.longClick()
...
@@ -154,9 +156,11 @@ export default function SearchJsunit() {
...
@@ -154,9 +156,11 @@ export default function SearchJsunit() {
await textComponent3.click()
await textComponent3.click()
let textComponent4 = await driver.findComponent(BY.text('复制'));
let textComponent4 = await driver.findComponent(BY.text('复制'));
await textComponent4.click()
await textComponent4.click()
let copy = await driver.findComponent(BY.key('copy'));
await CommonFunc.sleep(1000);
let text3 = await copy.getText();
let strJson3 = getInspectorByKey('copy');
expect(text3).assertEqual('onCopy:hello');
let obj3 = JSON.parse(strJson3);
console.info("[SearchJsunit_0300] obj3: " + JSON.stringify(obj3));
expect(obj3.$attrs.content).assertEqual('onCopy:hello');
// Verify the onCut function of the Search component
// Verify the onCut function of the Search component
await textComponent1.longClick()
await textComponent1.longClick()
...
@@ -165,25 +169,29 @@ export default function SearchJsunit() {
...
@@ -165,25 +169,29 @@ export default function SearchJsunit() {
await textComponent5.click()
await textComponent5.click()
let textComponent6 = await driver.findComponent(BY.text('剪切'));
let textComponent6 = await driver.findComponent(BY.text('剪切'));
await textComponent6.click()
await textComponent6.click()
let cut = await driver.findComponent(BY.key('cut'));
await CommonFunc.sleep(1000);
let text4 = await cut.getText();
let strJson4 = getInspectorByKey('cut');
expect(text4).assertEqual('onCut:hello');
let obj4 = JSON.parse(strJson4);
console.info("[SearchJsunit_0300] obj4: " + JSON.stringify(obj4));
expect(obj4.$attrs.content).assertEqual('onCut:hello');
// Verify the onPaste function of the Search component
// Verify the onPaste function of the Search component
await textComponent1.longClick()
await textComponent1.longClick()
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let textComponent8 = await driver.findComponent(BY.text('粘贴'));
let textComponent8 = await driver.findComponent(BY.text('粘贴'));
await textComponent8.click()
await textComponent8.click()
let paste = await driver.findComponent(BY.key('paste'));
await CommonFunc.sleep(1000);
let text5 = await paste.getText();
let strJson5 = getInspectorByKey('paste');
expect(text5).assertEqual('onPaste:hello');
let obj5 = JSON.parse(strJson5);
console.info("[SearchJsunit_0300] obj5: " + JSON.stringify(obj5));
expect(obj5.$attrs.content).assertEqual('onPaste:hello');
// Verify the caretPosition function of the Search component
// Verify the caretPosition function of the Search component
let textComponent7 = await driver.findComponent(BY.key('button'));
let textComponent7 = await driver.findComponent(BY.key('button'));
await textComponent7.click();
await textComponent7.click();
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let text
6
= await textComponent7.getText();
let text = await textComponent7.getText();
expect(text
6
).assertEqual('Set caretPosition 2');
expect(text).assertEqual('Set caretPosition 2');
console.info('[SearchJsunit_0300] END');
console.info('[SearchJsunit_0300] END');
done();
done();
});
});
...
@@ -227,7 +235,7 @@ export default function SearchJsunit() {
...
@@ -227,7 +235,7 @@ export default function SearchJsunit() {
expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg');
expect(obj.$attrs.icon).assertEqual('resource:///ohos_search.svg');
expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH');
expect(obj.$attrs.searchButton).assertEqual('CLICK_SEARCH');
expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A');
expect(obj.$attrs.placeholderColor).assertEqual('#FF00000A');
expect(obj.$attrs.value).assertEqual('
hello
');
expect(obj.$attrs.value).assertEqual('');
expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}');
expect(obj.$attrs.placeholderFont).assertEqual('{"style":"FontStyle.Normal","size":"14.00fp","weight":"400","fontFamily":"sans-serif"}');
expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}');
expect(obj.$attrs.textFont).assertEqual('{"fontSize":"14.00fp","fontStyle":"FontStyle.Normal","fontWeight":"400","fontFamily":"HarmonyOS Sans"}');
expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start');
expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start');
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/SelectJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -71,11 +71,10 @@ export default function SelectJsunit() {
...
@@ -71,11 +71,10 @@ export default function SelectJsunit() {
expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}');
expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}');
expect(obj.$attrs.optionFontColor).assertEqual('#FFFF0000');
expect(obj.$attrs.optionFontColor).assertEqual('#FFFF0000');
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let driver = await UiDriver.create()
let strJson1 = getInspectorByKey('indexValue');
let textComponent = await driver.findComponent(BY.key('indexValue'));
let obj1 = JSON.parse(strJson1);
let text = await textComponent.getText();
console.info("[SelectJsunit_0300] component obj1 is: " + JSON.stringify(obj1));
console.info("[SelectJsunit_0100] indexValue: " + JSON.stringify(text));
expect(obj1.$attrs.content).assertEqual('indexValue:0');
expect(text).assertEqual('indexValue:0');
console.info('[SelectJsunit_0100] END');
console.info('[SelectJsunit_0100] END');
done();
done();
});
});
...
@@ -132,16 +131,16 @@ export default function SelectJsunit() {
...
@@ -132,16 +131,16 @@ export default function SelectJsunit() {
let textComponent1 = await driver.findComponent(BY.key('select'));
let textComponent1 = await driver.findComponent(BY.key('select'));
await textComponent1.click()
await textComponent1.click()
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let textMenuComponent = await driver.findComponent(BY.text('bbb'));
let textMenu = await textMenuComponent.getText();
expect(textMenu).assertEqual('bbb');
// Verify the onSelect function of the select component
// Verify the onSelect function of the select component
let textMenuComponent = await driver.findComponent(BY.text('bbb'));
await textMenuComponent.click()
await textMenuComponent.click()
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let textComponent2 = await driver.findComponent(BY.key('indexValue'));
let strJson1 = getInspectorByKey('indexValue');
let text = await textComponent2.getText();
let obj1 = JSON.parse(strJson1);
expect(text).assertEqual('indexValue:1');
console.info("[SelectJsunit_0300] component obj1 is: " + JSON.stringify(obj1));
expect(obj1.$attrs.content).assertEqual('indexValue:1');
let strJson = getInspectorByKey('select');
let strJson = getInspectorByKey('select');
let obj = JSON.parse(strJson);
let obj = JSON.parse(strJson);
console.info("[SelectJsunit_0300] component obj is: " + JSON.stringify(obj));
console.info("[SelectJsunit_0300] component obj is: " + JSON.stringify(obj));
...
@@ -196,10 +195,10 @@ export default function SelectJsunit() {
...
@@ -196,10 +195,10 @@ export default function SelectJsunit() {
expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}');
expect(obj.$attrs.optionFont).assertEqual('{"size":"16.00fp","weight":"400","family":"","style":"FontStyle.Normal"}');
expect(obj.$attrs.optionFontColor).assertEqual('#FFFFFF00');
expect(obj.$attrs.optionFontColor).assertEqual('#FFFFFF00');
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let
driver = await UiDriver.create()
let
strJson1 = getInspectorByKey('indexValue');
let
textComponent = await driver.findComponent(BY.key('indexValue')
);
let
obj1 = JSON.parse(strJson1
);
let text = await textComponent.getText(
);
console.info("[SelectJsunit_0400] component obj1 is: " + JSON.stringify(obj1)
);
expect(
tex
t).assertEqual('indexValue:1');
expect(
obj1.$attrs.conten
t).assertEqual('indexValue:1');
console.info('[SelectJsunit_0400] END');
console.info('[SelectJsunit_0400] END');
done();
done();
});
});
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/TextPickerJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -101,15 +101,15 @@ export default function TextPickerJsunit() {
...
@@ -101,15 +101,15 @@ export default function TextPickerJsunit() {
it('TextPickerJsunit_0300', 0, async function (done) {
it('TextPickerJsunit_0300', 0, async function (done) {
// Verify the functions of TextPicker component
// Verify the functions of TextPicker component
console.info('[TextPickerJsunit_0300] START');
console.info('[TextPickerJsunit_0300] START');
let bottomComponent = CommonFunc.getComponentRect('textPicker');
let component = CommonFunc.getComponentRect('textPicker');
let bottom = bottomComponent.bottom
let bottom = component.bottom
let rightComponent = CommonFunc.getComponentRect('textPicker');
let right = component.right
let right = rightComponent.right
console.info("[TextPickerJsunit_0300] bottom: " + JSON.stringify(bottom));
console.info("[TextPickerJsunit_0300] bottom: " + JSON.stringify(bottom));
console.info("[TextPickerJsunit_0300] right: " + JSON.stringify(right));
console.info("[TextPickerJsunit_0300] right: " + JSON.stringify(right));
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let driver = await UiDriver.create()
let driver = await UiDriver.create()
await driver.swipe(Math.round(right / 2), Math.round(bottom * 2 / 3), Math.round(right / 2), Math.round(bottom / 3));
await driver.swipe(Math.round(right / 2), Math.round(bottom * 2 / 3), Math.round(right / 2), Math.round(bottom / 3));
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('textContent1');
let strJson = getInspectorByKey('textContent1');
let obj = JSON.parse(strJson);
let obj = JSON.parse(strJson);
console.info("[TextPickerJsunit_0300] obj: " + JSON.stringify(obj));
console.info("[TextPickerJsunit_0300] obj: " + JSON.stringify(obj));
...
@@ -141,7 +141,7 @@ export default function TextPickerJsunit() {
...
@@ -141,7 +141,7 @@ export default function TextPickerJsunit() {
expect(obj.$attrs.range).assertEqual('["icon:,text:banana1","icon:,text:orange2","icon:,text:peach3","icon:,text:grape4"]');
expect(obj.$attrs.range).assertEqual('["icon:,text:banana1","icon:,text:orange2","icon:,text:peach3","icon:,text:grape4"]');
expect(obj.$attrs.selected).assertEqual('1');
expect(obj.$attrs.selected).assertEqual('1');
//expect(obj.$attrs.value).assertEqual('');
//expect(obj.$attrs.value).assertEqual('');
expect(obj.$attrs.defaultPickerItemHeight).assertEqual('
25
.00fp');
expect(obj.$attrs.defaultPickerItemHeight).assertEqual('
0
.00fp');
console.info('[TextPickerJsunit_0400] END');
console.info('[TextPickerJsunit_0400] END');
done();
done();
});
});
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/ToggleJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -190,7 +190,7 @@ export default function ToggleJsunit() {
...
@@ -190,7 +190,7 @@ export default function ToggleJsunit() {
console.info("[ToggleJsunit_0600] isOn: " + JSON.stringify(obj.$attrs.isOn));
console.info("[ToggleJsunit_0600] isOn: " + JSON.stringify(obj.$attrs.isOn));
console.info("[ToggleJsunit_0600] selectedColor: " + JSON.stringify(obj.$attrs.selectedColor));
console.info("[ToggleJsunit_0600] selectedColor: " + JSON.stringify(obj.$attrs.selectedColor));
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
expect(obj.$attrs.type).assertEqual('
ButtonType.Capsule
');
expect(obj.$attrs.type).assertEqual('
ToggleType.Switch
');
expect(obj.$attrs.isOn).assertEqual('false');
expect(obj.$attrs.isOn).assertEqual('false');
expect(obj.$attrs.selectedColor).assertEqual('#FF00007B');
expect(obj.$attrs.selectedColor).assertEqual('#FF00007B');
let strJson1 = getInspectorByKey('toggleSwitch');
let strJson1 = getInspectorByKey('toggleSwitch');
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/marqueeJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -52,7 +52,7 @@ export default function marqueeJsunit() {
...
@@ -52,7 +52,7 @@ export default function marqueeJsunit() {
// to confirm allowScale
// to confirm allowScale
console.info('marqueeJsunit_0100 component obj is: ' + obj.$attrs.allowScale);
console.info('marqueeJsunit_0100 component obj is: ' + obj.$attrs.allowScale);
expect(obj.$attrs.start).assertEqual('false');
expect(obj.$attrs.start).assertEqual('false');
expect(
obj.$attrs.step).assertEqual('50.000000'
);
expect(
parseInt(obj.$attrs.step)).assertEqual(vp2px(50)
);
expect(obj.$attrs.loop).assertEqual('2');
expect(obj.$attrs.loop).assertEqual('2');
expect(obj.$attrs.fromStart).assertEqual('true');
expect(obj.$attrs.fromStart).assertEqual('true');
expect(obj.$attrs.src).assertEqual('Running Marquee starts rolling');
expect(obj.$attrs.src).assertEqual('Running Marquee starts rolling');
...
@@ -107,7 +107,7 @@ export default function marqueeJsunit() {
...
@@ -107,7 +107,7 @@ export default function marqueeJsunit() {
// check the value of changed attribute
// check the value of changed attribute
let strJson = getInspectorByKey('marquee');
let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson);
let obj = JSON.parse(strJson);
expect(obj.$attrs.loop).assertEqual('-
30
');
expect(obj.$attrs.loop).assertEqual('-
1
');
done();
done();
});
});
...
@@ -119,7 +119,7 @@ export default function marqueeJsunit() {
...
@@ -119,7 +119,7 @@ export default function marqueeJsunit() {
// check the value of changed parameter
// check the value of changed parameter
let strJson = getInspectorByKey('marquee');
let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson);
let obj = JSON.parse(strJson);
expect(
obj.$attrs.step).assertEqual('50.000000'
);
expect(
parseInt(obj.$attrs.step)).assertEqual(vp2px(50)
);
done();
done();
});
});
...
@@ -131,7 +131,7 @@ export default function marqueeJsunit() {
...
@@ -131,7 +131,7 @@ export default function marqueeJsunit() {
let strJson = getInspectorByKey('marquee');
let strJson = getInspectorByKey('marquee');
let obj = JSON.parse(strJson);
let obj = JSON.parse(strJson);
// to confirm
// to confirm
expect(
obj.$attrs.step).assertEqual('-30.000000'
);
expect(
parseInt(obj.$attrs.step)).assertEqual(vp2px(6)
);
done();
done();
});
});
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/stepperJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -120,32 +120,36 @@ export default function stepperJsunit() {
...
@@ -120,32 +120,36 @@ export default function stepperJsunit() {
it('stepperJsunit_0600', 0, async function (done) {
it('stepperJsunit_0600', 0, async function (done) {
console.info('stepperJsunit_0600 START');
console.info('stepperJsunit_0600 START');
// reset the component init status
globalThis.value.message.notify({name:'nextLabel',value:'下一步'});
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'prevLabel',value:'返回'});
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'status',value:ItemState.Normal});
globalThis.value.message.notify({name:'status',value:ItemState.Normal});
// test the stepper onChange onNext onPrevious event
// test the stepper onChange onNext onPrevious event
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let driver = UiDriver.create();
let driver = UiDriver.create();
let button = await driver.findComponent(BY.text('Next'));
let button = await driver.findComponent(BY.text('Next'));
await button.click();
await button.click();
console.info('stepperJsunit_0600 button click succ');
await CommonFunc.sleep(1000);
// reset the component init status
globalThis.value.message.notify({name:'nextLabel',value:'下一步'});
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'prevLabel',value:'返回'});
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let button2 = await driver.findComponent(BY.text('下一步'));
let button2 = await driver.findComponent(BY.text('下一步'));
await button2.click();
await button2.click();
console.info('stepperJsunit_0600 button2 click succ');
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
let
textThree = await driver.findComponent(BY.text('Page Three')
);
let
strJson = getInspectorByKey('pageThree'
);
let
txt = await textThree.getText(
);
let
obj = JSON.parse(strJson
);
console.info('stepperJsunit_0
700 component obj is: ' + tx
t);
console.info('stepperJsunit_0
600 component obj is: ' + obj.$attrs.conten
t);
expect(
tx
t).assertEqual('Page Three');
expect(
obj.$attrs.conten
t).assertEqual('Page Three');
// test the previous
// test the previous
let button3 = await driver.findComponent(BY.text('返回'));
let button3 = await driver.findComponent(BY.text('返回'));
await button3.click();
await button3.click();
let textTwo = await driver.findComponent(BY.text('Page Two'));
await CommonFunc.sleep(1000);
let txtT = await textTwo.getText();
console.info('stepperJsunit_0600 button3 click succ');
console.info('stepperJsunit_0600 component obj is: ' + txtT);
let strJson1 = getInspectorByKey('pageTwo');
expect(txtT).assertEqual('Page Two');
let obj1 = JSON.parse(strJson1);
console.info('stepperJsunit_0600 component obj1 is: ' + obj1.$attrs.content);
expect(obj1.$attrs.content).assertEqual('Page Two');
done();
done();
});
});
...
@@ -157,17 +161,20 @@ export default function stepperJsunit() {
...
@@ -157,17 +161,20 @@ export default function stepperJsunit() {
await CommonFunc.sleep(2000);
await CommonFunc.sleep(2000);
let button2 = await driver.findComponent(BY.text('下一步'));
let button2 = await driver.findComponent(BY.text('下一步'));
await button2.click();
await button2.click();
console.info('stepperJsunit_0700 button2 click succ');
await CommonFunc.sleep(2000);
await CommonFunc.sleep(2000);
let button3 = await driver.findComponent(BY.text('下一步'));
let button3 = await driver.findComponent(BY.text('下一步'));
await button3.click();
await button3.click();
console.info('stepperJsunit_0700 button3 click succ');
await CommonFunc.sleep(2000);
await CommonFunc.sleep(2000);
let button4 = await driver.findComponent(BY.text('开始'));
let button4 = await driver.findComponent(BY.text('开始'));
await button4.click();
await button4.click();
console.info('stepperJsunit_0700 button4 click succ');
await CommonFunc.sleep(2000);
await CommonFunc.sleep(2000);
let
textTwo = await driver.findComponent(BY.text('Page Four')
);
let
strJson = getInspectorByKey('pageFour'
);
let
txtT = await textTwo.getText(
);
let
obj = JSON.parse(strJson
);
console.info('stepperJsunit_0700 component obj is: ' +
txtT
);
console.info('stepperJsunit_0700 component obj is: ' +
obj.$attrs.content
);
expect(
txtT
).assertEqual('Page Four');
expect(
obj.$attrs.content
).assertEqual('Page Four');
done();
done();
});
});
...
@@ -179,10 +186,10 @@ export default function stepperJsunit() {
...
@@ -179,10 +186,10 @@ export default function stepperJsunit() {
let button = await driver.findComponent(BY.text('返回'));
let button = await driver.findComponent(BY.text('返回'));
await button.click();
await button.click();
await CommonFunc.sleep(2000);
await CommonFunc.sleep(2000);
let
textTwo = await driver.findComponent(BY.text('Page Three')
);
let
strJson = getInspectorByKey('pageThree'
);
let
txtT = await textTwo.getText(
);
let
obj = JSON.parse(strJson
);
console.info('stepperJsunit_0800 component obj is: ' +
txtT
);
console.info('stepperJsunit_0800 component obj is: ' +
obj.$attrs.content
);
expect(
txtT
).assertEqual('Page Three');
expect(
obj.$attrs.content
).assertEqual('Page Three');
done();
done();
});
});
})
})
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/textAreaJsunit.test.ets
浏览文件 @
aa795f5c
...
@@ -158,10 +158,11 @@ export default function textAreaJsunit() {
...
@@ -158,10 +158,11 @@ export default function textAreaJsunit() {
it('textAreaJsunit_0800', 0, async function (done) {
it('textAreaJsunit_0800', 0, async function (done) {
console.info('textAreaJsunit_0800 START');
console.info('textAreaJsunit_0800 START');
globalThis.value.message.notify({name:'placeholder',value:''})
globalThis.value.message.notify({name:'text',value:''})
await CommonFunc.sleep(2000);
await CommonFunc.sleep(1000);
// test the change event
let driver = UiDriver.create();
let driver = UiDriver.create();
await CommonFunc.sleep(1000);
// test the change event
let text = await driver.findComponent(BY.key('textArea'));
let text = await driver.findComponent(BY.key('textArea'));
await text.inputText('123');
await text.inputText('123');
await CommonFunc.sleep(2000);
await CommonFunc.sleep(2000);
...
@@ -205,7 +206,7 @@ export default function textAreaJsunit() {
...
@@ -205,7 +206,7 @@ export default function textAreaJsunit() {
});
});
it('textAreaJsunit_1000', 0, async function (done) {
it('textAreaJsunit_1000', 0, async function (done) {
console.info('
marqueeJsunit_09
00 START');
console.info('
textAreaJsunit_10
00 START');
await CommonFunc.sleep(1000);
await CommonFunc.sleep(1000);
// test the cut event
// test the cut event
let driver = UiDriver.create();
let driver = UiDriver.create();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录