提交 1d4f76a1 编写于 作者: W wang-xupeng2

update slider steper and grid testcases

Signed-off-by: Nwang-xupeng2 <wangxupeng2@huawei.com>
上级 ec8b0dfc
......@@ -206,7 +206,7 @@ struct SliderExample {
Text(this.modeT).fontSize(9).fontColor(0xCCCCCC).width('50%').margin(15).key('modeT')
Row() {
Slider({
value: this.vInSetValueOne1,
value: this.vInSetValueOne,
style: this.style,
direction: this.directionT,
reverse: this.reverse,// 竖向的Slider默认是上端是min值,下端是max值,因此想要从下往上滑动,需要设置reverse为true
......@@ -215,7 +215,7 @@ struct SliderExample {
step:this.step
}).showTips(true)
.onChange((value: number, mode: SliderChangeMode) => {
this.vInSetValueOne1 = value
this.vInSetValueOne = value
console.info('value:' + value + 'm`ode:' + mode.toString())
}).key('sliderConstructor')
......@@ -233,7 +233,7 @@ struct SliderExample {
Slider().showTips(true)
.onChange((value: number, mode: SliderChangeMode) => {
this.vInSetValueOne = value
this.vInSetValueOne1 = value
this.modeT = mode.toString()
console.info('value:' + value + 'm`ode:' + mode.toString())
}).key('sliderConstructor2')
......
......@@ -88,7 +88,7 @@ struct StepperExample {
// 第二个步骤页
StepperItem() {
Column() {
Text('Page Two')
Text('Page Two').key('pageTwo')
.itemTextStyle()
Button('change status:' + this.secondState)
.backgroundColor('#007dFF')
......
......@@ -143,12 +143,9 @@ export default function GridJsunit() {
// Verify onScrollIndex event
let grid2 = CommonFunc.getComponentRect('grid2');
let top = grid2.top
let grid2b = CommonFunc.getComponentRect('grid2');
let bottom = grid2b.bottom
let grid2l = CommonFunc.getComponentRect('grid2');
let left = grid2l.left
let grid2r = CommonFunc.getComponentRect('grid2');
let right = grid2r.right
let bottom = grid2.bottom
let left = grid2.left
let right = grid2.right
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));
......@@ -166,9 +163,10 @@ export default function GridJsunit() {
let button = await driver.findComponent(BY.key('button'));
await button.click();
await CommonFunc.sleep(1000);
let button1 = await driver.findComponent(BY.key('button'));
let text3 = await button1.getText();
expect(text3).assertEqual('clicked');
let strJson = getInspectorByKey('button');
let obj = JSON.parse(strJson);
console.info('[GridJsunit_0400] component obj is: ' + obj.$attrs.content);
expect(obj.$attrs.content).assertEqual('clicked');
console.info('[GridJsunit_0400] END');
done();
});
......
......@@ -120,32 +120,36 @@ export default function stepperJsunit() {
it('stepperJsunit_0600', 0, async function (done) {
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});
// test the stepper onChange onNext onPrevious event
await CommonFunc.sleep(1000);
let driver = UiDriver.create();
let button = await driver.findComponent(BY.text('Next'));
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);
let button2 = await driver.findComponent(BY.text('下一步'));
await button2.click();
console.info('stepperJsunit_0600 button2 click succ');
await CommonFunc.sleep(1000);
let textThree = await driver.findComponent(BY.text('Page Three'));
let txt = await textThree.getText();
console.info('stepperJsunit_0700 component obj is: ' + txt);
expect(txt).assertEqual('Page Three');
let strJson = getInspectorByKey('pageThree');
let obj = JSON.parse(strJson);
console.info('stepperJsunit_0600 component obj is: ' + obj.$attrs.content);
expect(obj.$attrs.content).assertEqual('Page Three');
// test the previous
let button3 = await driver.findComponent(BY.text('返回'));
await button3.click();
let textTwo = await driver.findComponent(BY.text('Page Two'));
let txtT = await textTwo.getText();
console.info('stepperJsunit_0600 component obj is: ' + txtT);
expect(txtT).assertEqual('Page Two');
await CommonFunc.sleep(1000);
console.info('stepperJsunit_0600 button3 click succ');
let strJson1 = getInspectorByKey('pageTwo');
let obj1 = JSON.parse(strJson1);
console.info('stepperJsunit_0600 component obj1 is: ' + obj1.$attrs.content);
expect(obj1.$attrs.content).assertEqual('Page Two');
done();
});
......@@ -157,17 +161,20 @@ export default function stepperJsunit() {
await CommonFunc.sleep(2000);
let button2 = await driver.findComponent(BY.text('下一步'));
await button2.click();
console.info('stepperJsunit_0700 button2 click succ');
await CommonFunc.sleep(2000);
let button3 = await driver.findComponent(BY.text('下一步'));
await button3.click();
console.info('stepperJsunit_0700 button3 click succ');
await CommonFunc.sleep(2000);
let button4 = await driver.findComponent(BY.text('开始'));
await button4.click();
console.info('stepperJsunit_0700 button4 click succ');
await CommonFunc.sleep(2000);
let textTwo = await driver.findComponent(BY.text('Page Four'));
let txtT = await textTwo.getText();
console.info('stepperJsunit_0700 component obj is: ' + txtT);
expect(txtT).assertEqual('Page Four');
let strJson = getInspectorByKey('pageFour');
let obj = JSON.parse(strJson);
console.info('stepperJsunit_0700 component obj is: ' + obj.$attrs.content);
expect(obj.$attrs.content).assertEqual('Page Four');
done();
});
......@@ -179,10 +186,10 @@ export default function stepperJsunit() {
let button = await driver.findComponent(BY.text('返回'));
await button.click();
await CommonFunc.sleep(2000);
let textTwo = await driver.findComponent(BY.text('Page Three'));
let txtT = await textTwo.getText();
console.info('stepperJsunit_0800 component obj is: ' + txtT);
expect(txtT).assertEqual('Page Three');
let strJson = getInspectorByKey('pageThree');
let obj = JSON.parse(strJson);
console.info('stepperJsunit_0800 component obj is: ' + obj.$attrs.content);
expect(obj.$attrs.content).assertEqual('Page Three');
done();
});
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册