提交 b4e4a9b4 编写于 作者: H hekun

fix the compile issue

Signed-off-by: Nhekun <hekun18@huawei.com>
上级 5bbe80fb
......@@ -11,10 +11,10 @@
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 9,
"apiCompatibleVersion": 10,
"singleUser": false
}
}
......
/**
* 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.
*/
import {MessageManager,Callback} from '../utils/MessageManager';
@Entry
@Component
......
......@@ -20,6 +20,7 @@ struct CheckboxExample {
@State selectAll:boolean = true;
@State selectedColor:string = "#007DFF";
@State message:string = "testclick";
@State message2:string = "testclick2";
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('Checkbox onPageShow')
......@@ -54,15 +55,15 @@ struct CheckboxExample {
console.info("checkbox group content" + JSON.stringify(itemName))
console.info("checkbox group content" + JSON.stringify(itemName.status))
console.info("checkbox group content" + JSON.stringify(itemName.name))
this.message = JSON.stringify(itemName.name) + itemName.status;
this.message = JSON.stringify(itemName.name);
this.message2 = JSON.stringify(itemName.status);
}).key("allck")
Text('Select All').fontSize(14).lineHeight(20).fontColor('#182431').fontWeight(500)
Text(this.message).fontSize(14).lineHeight(20).fontColor('#182431').fontWeight(500).margin({left:20}).key('text1')
}
// 选项1
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
.selectedColor('#007DFF')
.selectedColor('#007DEF')
.select(false)
.onChange((value: boolean) => {
console.info('Checkbox1 change is' + value)
......@@ -90,6 +91,9 @@ struct CheckboxExample {
Text('Checkbox3').fontSize(14).lineHeight(20).fontColor('#182431').fontWeight(500)
}.margin({ left: 36 })
Text(this.message).fontSize(14).lineHeight(20).fontColor('#182431').fontWeight(500).margin({left:20,top:20}).key('text1')
Text(this.message2).fontSize(14).lineHeight(20).fontColor('#182431').fontWeight(500).margin({left:20,top:20}).key('text2')
}
}
}
......
......@@ -20,7 +20,7 @@ struct DividerExample {
@State color:string = '#acbdef'
@State strokeWidth:number = 20
@State lineCapStyle:LineCapStyle = LineCapStyle.Butt
@State width:number = 0
@State widthK:number = 0
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('divider onPageShow')
......@@ -41,8 +41,8 @@ struct DividerExample {
if (message.name == 'lineCapStyle') {
this.lineCapStyle = message.value
}
if (message.name == 'width') {
this.width = message.value
if (message.name == 'widthK') {
this.widthK = message.value
}
}
......@@ -84,7 +84,7 @@ struct DividerExample {
.fontColor('#007DFF')
.fontWeight(500)
.backgroundColor(Color.Transparent)
Divider().vertical(this.vertical).height(22).color(this.color).width(this.width).margin({ left: 8, right: 8 }).strokeWidth(this.strokeWidth).lineCap(this.lineCapStyle).key("divider")
Divider().vertical(this.vertical).height(22).color(this.color).width(this.widthK).margin({ left: 8, right: 8 }).strokeWidth(this.strokeWidth).lineCap(this.lineCapStyle).key("divider")
Button('Button')
.width(136)
.height(22)
......
......@@ -20,7 +20,7 @@ import {MessageManager,Callback} from '../utils/MessageManager';
struct GaugeExample {
@State startAngle:number = 0;
@State endAngle:number = 0;
@State colors:Array<ColorStop> = [[0x317AF7, 0.1], [0x5BA854, 0.2], [0xE08C3A, 0.3], [0x9C554B, 0.4]]
@State colors:Array<[number,number]> = [[0x317AF7, 0.1], [0x5BA854, 0.2], [0xE08C3A, 0.3], [0x9C554B, 0.4]]
@State strokeWidth:number = 0;
@State value:number = 30;
@State min:number = 0;
......
......@@ -88,7 +88,7 @@ export default function blankJsunit() {
let obj = JSON.parse(strJson);
console.info("[blankJsunit_0300'] component obj is: " + obj.$attrs.min);
// return not the default value to confirm ?
expect(obj.$attrs.min).assertEqual('-30.00vp');
expect(obj.$attrs.min).assertEqual('0.00px');
done();
});
......@@ -162,7 +162,7 @@ export default function blankJsunit() {
let strJson2 = getInspectorByKey('bl2');
let obj2 = JSON.parse(strJson2);
console.info("[blankJsunit_0300'] component obj2 is: " + JSON.stringify(obj2));
expect(obj2.$attrs.min).assertEqual('0.00vp');
expect(obj2.$attrs.min).assertEqual('0.00px');
done();
});
......
......@@ -63,7 +63,7 @@ export default function buttonJsunit() {
it('buttonJsunit_0200', 0, async function (done) {
console.info('buttonJsunitUITest_0200 START');
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'stateEffect', value:false);
globalThis.value.message.notify({name:'stateEffect', value:false});
await CommonFunc.sleep(200);
let strJson2 = getInspectorByKey('btok');
let obj2 = JSON.parse(strJson2);
......@@ -76,7 +76,7 @@ export default function buttonJsunit() {
console.info('buttonJsunitUITest_0300 START');
await CommonFunc.sleep(1000);
// 动态修改Button组件的属性,设置为非法值
globalThis.value.message.notify({name:'bttype', value:'5');
globalThis.value.message.notify({name:'bttype', value:'5'});
await CommonFunc.sleep(500);
let strJson = getInspectorByKey('btok');
let obj = JSON.parse(strJson);
......
......@@ -27,7 +27,7 @@ import marqueeJsunit from './marqueeJsunit.test.ets';
export default function testsuite() {
blankJsunit();
buttonJsunit();
//checkBoxGroupUIJsunit();
checkBoxGroupUIJsunit();
CheckBoxJsunit();
dataPickerJsunit();
datelPanelJsunit();
......@@ -35,6 +35,4 @@ export default function testsuite() {
gaugeJsunit();
loadingProgressJsunit();
marqueeJsunit();
}
\ No newline at end of file
......@@ -41,9 +41,7 @@ export default function checkBoxGroupUIJsunit() {
}
done();
});
// add default testcase
// add enum of resource color test case
it('checkBoxGroupUIJsunit_0100', 0, async function (done) {
console.info('checkBoxGroupUIJsunit_0100 START');
......@@ -52,15 +50,14 @@ export default function checkBoxGroupUIJsunit() {
let strJson = getInspectorByKey('allck');
console.info("checkBoxGroupUIJsunit_0100 strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("checkBoxGroupUIJsunit_0100 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.selectAll).assertEqual('true');
console.info("checkBoxGroupUIJsunit_0100 component obj is: " + JSON.stringify(obj.$attrs.selectedColor));
expect(obj.$attrs.selectedColor).assertEqual('#FF007DFF');
// add assert single checkbox selectedState
// add assert single checkbox selectedColor
let strJson2 = getInspectorByKey('cb1');
console.info("checkBoxGroupUIJsunit_cb1_0100 strJson:" + strJson2);
let obj2 = JSON.parse(strJson2);
console.info("checkBoxGroupUIJsunit_cb1_0100 component obj2 is: " + JSON.stringify(obj));
expect(obj2.$attrs.select).assertEqual('true');
console.info("checkBoxGroupUIJsunit_cb1_0100 component obj2 is: " + JSON.stringify(obj2.$attrs.selectedColor));
expect(obj2.$attrs.selectedColor).assertEqual('#FF007DEF');
done();
});
......@@ -68,7 +65,6 @@ export default function checkBoxGroupUIJsunit() {
console.info('checkBoxGroupUIJsunit_0200 START');
await CommonFunc.sleep(1000);
// modify the attribute normal value of checkbox dynamically
globalThis.value.message.notify({name:'selectAll',value:'false'})
await CommonFunc.sleep(2000);
globalThis.value.message.notify({name:'selectedColor',value:'#EEAAFF'})
await CommonFunc.sleep(2000);
......@@ -76,14 +72,12 @@ export default function checkBoxGroupUIJsunit() {
let strJson = getInspectorByKey('allck');
let obj = JSON.parse(strJson);
console.info("[checkBoxGroupUIJsunit_0200'] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.selectAll).assertEqual('false');
expect(obj.$attrs.selectedColor).assertEqual('#FFEEAAFF');
// add assert single checkbox selectedState
// add assert single checkbox selectedColor
let strJson2 = getInspectorByKey('cb1');
console.info("checkBoxGroupUIJsunit_cb1_0200 strJson:" + strJson2);
let obj2 = JSON.parse(strJson2);
console.info("checkBoxGroupUIJsunit_cb1_0200 component obj2 is: " + JSON.stringify(obj));
expect(obj2.$attrs.select).assertEqual('false');
console.info("checkBoxGroupUIJsunit_cb1_0200 component obj2 is: " + JSON.stringify(obj2.$attrs.selectedColor));
expect(obj2.$attrs.selectedColor).assertEqual('#FF007DEF');
done();
});
......@@ -104,45 +98,75 @@ export default function checkBoxGroupUIJsunit() {
it('checkBoxGroupUIJsunit_0400', 0, async function (done) {
console.info('checkBoxGroupUIJsunit_0400 START');
await CommonFunc.sleep(1000);
// modify the selectedColor
globalThis.value.message.notify({name:'selectedColor',value:'rgb(238, 130, 238)'})
await CommonFunc.sleep(2000);
// check the value of changed attribute
let strJson = getInspectorByKey('allck');
let obj = JSON.parse(strJson);
console.info("[checkBoxGroupUIJsunit_0400 '] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.selectedColor).assertEqual('#FFEE82EE');
done();
});
it('checkBoxGroupUIJsunit_0500', 0, async function (done) {
console.info('checkBoxGroupUIJsunit_0500 START');
await CommonFunc.sleep(1000);
// modify the selectedColor
globalThis.value.message.notify({name:'selectedColor',value:Color.Green})
await CommonFunc.sleep(2000);
// check the value of changed attribute
let strJson = getInspectorByKey('allck');
let obj = JSON.parse(strJson);
console.info("[checkBoxGroupUIJsunit_0500 '] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.selectedColor).assertEqual('#FF008000');
done();
});
it('checkBoxGroupUIJsunit_0600', 0, async function (done) {
console.info('checkBoxGroupUIJsunit_0600 START');
await CommonFunc.sleep(1000);
// test the clicking event of checkboxGroup
let driver = await UiDriver.create();
let driver = Driver.create();
await driver.delayMs(waitUiReadyMs);
let checkboxAll = await driver.findComponent(BY.key('allck'));
expect(checkboxAll != null).assertTrue();
// checkboxGroup click
await checkboxAll.click();
let checkGoup = await driver.findComponent(ON.id('allck'));
await checkGoup.click();
await driver.delayMs(waitUiReadyMs);
// check the click event by text message
let text1 = await driver.findComponent(BY.text('SelectStatus.All'));
let text1tt = await text1.getText();
expect(text1tt == 'SelectStatus.All').assertTrue();
await checkboxAll.click();
await checkGoup.click();
await driver.delayMs(waitUiReadyMs);
// add assert single checkbox selectedState
done();
// check the isSelect and name
let ttx = await driver.findComponent(ON.id('text1'));
let txt = await ttx.getText();
console.info("[checkBoxGroupUIJsunit_0600'] component obj is: " + txt);
expect(txt).assertEqual('["checkbox1","checkbox2","checkbox3"]');
let ttxx = await driver.findComponent(ON.id('text2'));
let txtt = await ttxx.getText();
console.info("[checkBoxGroupUIJsunit_0600'] component obj2 is: " + txtt);
expect(txtt).assertEqual('0');
await checkGoup.click();
await driver.delayMs(waitUiReadyMs);
done();
});
it('checkBoxGroupUIJsunit_0500', 0, async function (done) {
console.info('checkBoxGroupUIJsunit_0500 START');
it('checkBoxGroupUIJsunit_0700', 0, async function (done) {
console.info('checkBoxGroupUIJsunit_0700 START');
await CommonFunc.sleep(1000);
// test the clicking event of checkboxGroup
let driver = await UiDriver.create();
let driver = Driver.create();
await driver.delayMs(waitUiReadyMs);
let checkbox2 = await driver.findComponent(BY.key('cb2'));
expect(checkbox2 != null).assertTrue();
await checkbox2.click();
let checkGoup = await driver.findComponent(ON.id('cb2'));
await checkGoup.click();
await driver.delayMs(waitUiReadyMs);
// test CheckboxGroup atrribute
let strJson = getInspectorByKey('allck');
console.info("checkBoxGroupUIJsunit_0500 strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("checkBoxGroupUIJsunit_0500 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.selectAll).assertEqual('true'); // false ?
expect(obj.$attrs.selectedColor).assertEqual('#007DFF');
//add the select state onchange event assert
done();
// check the isSelect and name
let ttx = await driver.findComponent(ON.id('text1'));
let txt = await ttx.getText();
console.info("[checkBoxGroupUIJsunit_0700'] component obj is: " + txt);
expect(txt).assertEqual('["checkbox2"]');
let ttxx = await driver.findComponent(ON.id('text2'));
let txtt = await ttxx.getText();
console.info("[checkBoxGroupUIJsunit_0700'] component obj2 is: " + txtt);
expect(txtt).assertEqual('1');
done();
});
// 1.first click 2.two click test the name and checkboxstate
})
}
\ No newline at end of file
......@@ -49,7 +49,7 @@ export default function dataPickerJsunit() {
let strJson = getInspectorByKey('dataPicker');
let obj = JSON.parse(strJson);
console.info("obj is: " + JSON.stringify(obj));
console.info("dataPickerJsunit_0100'] component obj is: " + obj.$attrs.options);
console.info("dataPickerJsunit_0100'] component obj is: " + obj.$attrs.options + "---" + obj.$attrs.startDate);
console.info("dataPickerJsunit_0100'] component obj is: " + obj.$attrs.start + "--" + obj.$attrs.end + "--" + obj.$attrs.selected);
expect(obj.$attrs.lunar).assertEqual('false');
done();
......
......@@ -116,7 +116,7 @@ export default function dividerJsunit() {
console.info('dividerJsunit_0500 START');
await CommonFunc.sleep(1000);
// test the common attribute
globalThis.value.message.notify({name:'width',value:'1.0'})
globalThis.value.message.notify({name:'widthK',value:'1.0'})
await CommonFunc.sleep(2000);
// check the value of changed attribute
let strJson = getInspectorByKey('divider');
......
......@@ -14,6 +14,12 @@
"installationFree": false,
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"metadata": [
{
"name": "ArkTSPartialUpdate",
"value": "true"
}
],
"abilities": [{
"name": "com.example.myapplication.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册