提交 b4e4a9b4 编写于 作者: H hekun

fix the compile issue

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