diff --git a/arkui/BUILD.gn b/arkui/BUILD.gn index eb91b36276c270498e1d0bdebe11dcbdc56aa3cc..4c26fdd499df4d97701d31d1fa623c4f7339a3f6 100644 --- a/arkui/BUILD.gn +++ b/arkui/BUILD.gn @@ -16,6 +16,7 @@ group("arkui") { deps = [ "ace_ets_component:ActsAceEtsComponentTest", "ace_ets_component_apilack:ActsAceEtsApiLackTest", + "ace_ets_component_attrlack:ActsAceEtsAttrLackTest", "ace_ets_component_five:ActsAceEtsComponentFiveTest", "ace_ets_component_four:ActsAceEtsComponentFourTest", "ace_ets_component_three:ActsAceEtsComponentThreeTest", diff --git a/arkui/ace_ets_component_apilack/entry/src/main/config.json b/arkui/ace_ets_component_apilack/entry/src/main/config.json index fdd020d711d8e79b86309e3c53f1efe29e7762c9..97af9a51af13cff779f962e068b58fa720a83a52 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/config.json +++ b/arkui/ace_ets_component_apilack/entry/src/main/config.json @@ -81,8 +81,10 @@ "pages/curves", "pages/ellipse", "pages/featureAbility", + "pages/focusControl", "pages/form_component", "pages/gauge", + "pages/global", "pages/grid", "pages/grid_col", "pages/grid_row", @@ -95,6 +97,7 @@ "pages/mediaQuery", "pages/navigator", "pages/page1", + "pages/pageRoute", "pages/page_transition", "pages/panel", "pages/path", diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/focusControl.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/focusControl.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3cedb8d724d305dcf8c04329ebf2fbf6a4ab006 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/focusControl.ets @@ -0,0 +1,278 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 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 events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct FocusControlExample { + @State inputValue: string = '' + @State touchOnFocusName: string = 'OnTouchGrpBtn' + @State touchOnFocusName1: string = 'OnTouchBtn1' + @State touchOnFocusName2: string = 'OnTouchBtn2' + @State touchOnFocusName3: string = 'OnTouchBtn3' + @State touchOnFocusName4: string = 'OnTouchBtn4' + + build() { + Scroll() { + Row({ space: 20 }) { + Column({ space: 20 }) { + Column({ space: 5 }) { + Button(this.touchOnFocusName) + .width(165) + .height(40) + .key('OnTouchGrpBtn') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + try { + this.touchOnFocusName = 'Focus' + this.touchOnFocusName + console.info("onFocus value changed " + this.touchOnFocusName) + var eventData = { + data: { + "value": this.touchOnFocusName, + } + } + var event = { + eventId: 60232, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchGrpBtn start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchGrpBtn emit action state err: " + JSON.stringify(err.message)) + } + }) + .focusOnTouch(true) //该Button组件点击后可获焦 + Row({ space: 5 }) { + Button(this.touchOnFocusName1) + .width(80) + .height(40) + .key('OnTouchBtn1') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + try { + this.touchOnFocusName1 = 'Focus' + this.touchOnFocusName1 + console.info("onFocus value changed " + this.touchOnFocusName1) + var eventData = { + data: { + "value": this.touchOnFocusName1, + } + } + var event = { + eventId: 60233, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchBtn1 start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchBtn1 emit action state err: " + JSON.stringify(err.message)) + } + }) + .focusOnTouch(true) + Button(this.touchOnFocusName2) + .width(80) + .height(40) + .key('OnTouchBtn2') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + try { + this.touchOnFocusName2 = 'Focus' + this.touchOnFocusName2 + console.info("onFocus value changed " + this.touchOnFocusName2) + var eventData = { + data: { + "value": this.touchOnFocusName2, + } + } + var event = { + eventId: 60234, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchBtn2 start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchBtn2 emit action state err: " + JSON.stringify(err.message)) + } + }) + .focusOnTouch(true) //该Button组件点击后可获焦 + } + Row({ space: 5 }) { + Button(this.touchOnFocusName3) + .width(80) + .height(40) + .key('OnTouchBtn3') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + this.touchOnFocusName3 = 'Focus' + this.touchOnFocusName3 + console.info("onFocus value changed " + this.touchOnFocusName3) + }) + .onClick(() => { + try { + var eventData = { + data: { + "value": this.touchOnFocusName3, + } + } + var event = { + eventId: 60235, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchBtn3 start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchBtn3 emit action state err: " + JSON.stringify(err.message)) + } + }) + + Button(this.touchOnFocusName4) + .width(80) + .height(40) + .key('OnTouchBtn4') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + this.touchOnFocusName4 = 'Focus' + this.touchOnFocusName4 + console.info("onFocus value changed " + this.touchOnFocusName4) + }) + .onClick(() => { + try { + console.info("onClick event " + this.touchOnFocusName4) + var eventData = { + data: { + "value": this.touchOnFocusName4, + } + } + var event = { + eventId: 60236, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchBtn4 start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchBtn4 emit action state err: " + JSON.stringify(err.message)) + } + }) + } + }.borderWidth(2).borderColor(Color.Red).borderStyle(BorderStyle.Dashed) + .tabIndex(1) //该Column组件为按TAB键走焦的第一个获焦的组件 + Column({ space: 5 }) { + Button('Group2') + .width(165) + .height(40) + .fontColor(Color.White) + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + .groupDefaultFocus(true) //该Button组件上级Column组件获焦时获焦 + } + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + } + }.borderWidth(2).borderColor(Color.Green).borderStyle(BorderStyle.Dashed) + .tabIndex(2) //该Column组件为按TAB键走焦的第二个获焦的组件 + } + Column({ space: 5 }) { + TextInput({placeholder: 'input', text: this.inputValue}) + .onChange((value: string) => { + this.inputValue = value + }) + .fontColor(Color.Blue) + .focusable(true) + .key('defaultFocusText') + .onFocus(() => { + try { + this.inputValue = 'defaultFocus' + console.info("onFocus value changed " + this.inputValue) + var eventData = { + data: { + "value": this.inputValue, + } + } + var event = { + eventId: 60237, + priority: events_emitter.EventPriority.LOW + } + console.info("defaultFocus test start to emit action start") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("defaultFocus test emit action state err: " + JSON.stringify(err.message)) + } + }) + .defaultFocus(true) //该TextInput组件为页面的初始默认焦点 + Button('Group3') + .width(165) + .height(40) + .fontColor(Color.White) + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + } + Button() + .width(165) + .height(40) + .fontColor(Color.White) + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + } + Button() + .width(165) + .height(40) + .fontColor(Color.White) + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + } + }.borderWidth(2).borderColor(Color.Orange).borderStyle(BorderStyle.Dashed) + .tabIndex(3) //该Column组件为按TAB键走焦的第三个获焦的组件 + }.alignItems(VerticalAlign.Top) + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/global.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/global.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea6537e9e02501f52bd996fafcf74b06dbf3d007 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/global.ets @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct GlobalLack { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GlobalLack start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GlobalLack end`) + } + + build() { + Column() { + Button("Click2").fontSize(50) + .onClick(() => { + console.info("Click2" + JSON.stringify(sendEventByKey("Del", 10, ""))); + }).key("Click2") + List({space:10}) { + ListItem() { + Text("Hello world") { + } + .width('100%') + .height(100) + .fontSize(16) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + } + .key("ListItem") + .sticky(Sticky.None) + .selectable(false) + .editable(true) + } + } + .padding(10) + .backgroundColor(0xDCDCDC) + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets index 81c1b49dbd0f0998c279a2fc1ebfef57a59b118c..e6c3fc94a0039f83736dcda0f072a2612705a67c 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets @@ -21,10 +21,6 @@ import events_emitter from '@ohos.events.emitter'; @Component export default struct List_itemOnSelect { - @State selectIndex:boolean = false - @State arr: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] - @State alignListItem: ListItemAlign = ListItemAlign.Start - aboutToAppear() { Log.showInfo(TAG, `aboutToAppear List_itemOnSelect start`) } @@ -33,70 +29,41 @@ struct List_itemOnSelect { Log.showInfo(TAG, `aboutToDisAppear List_itemOnSelect end`) } - build(){ - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ - - Text("list_item-OnSelect") - .width(100) - .height(70) - .fontSize(20) - .opacity(1) - .align(Alignment.TopStart) - .fontColor(0xCCCCCC) - .lineHeight(25) - .border({ width: 1 }) - .padding(10) - .textAlign(TextAlign.Center) - .textOverflow({ overflow: TextOverflow.None }) - .key("onSelectText") - - List({ space: 20, initialIndex: 0 }) { - ForEach(this.arr, (item) => { - ListItem() { - Text('' + item) - .width('100%') - .height(100) - .fontSize(16) + @Builder itemEnd() { + Row () { + Button("Del").margin("4vp").key("Del") + Button("Set").margin("4vp").key("Set") + }.padding("4vp").justifyContent(FlexAlign.SpaceEvenly) + } + build() { + Column() { + Button("Click2").fontSize(50) + .onClick(() => { + console.info("Click2" + JSON.stringify(sendEventByKey("Del", 10, ""))); + }).key("Click2") + List({space:10}) { + ListItem() { + Text("Hello world") { } - .editable(true) - .sticky(Sticky.None) - .selectable(true) - .key("ListItem") - .onClick(()=> { - console.info("ListItem onClick") - }) - .border({ width: 2, color: Color.Green }) - .onSelect((index:boolean)=>{ - console.info("Select: " + index) - this.selectIndex = index - try { - var backData = { - data: { - "selectIndex": this.selectIndex - } - } - let backEvent = { - eventId: 60217, - priority: events_emitter.EventPriority.LOW - } - console.info("listItemOnSelect start to emit action state") - events_emitter.emit(backEvent, backData) - } catch (err) { - console.info("listItemOnSelect emit action state err: " + JSON.stringify(err.message)) - } - }) - }, item => item) + .width('100%') + .height(100) + .fontSize(16) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + } + .key("ListItem") + .sticky(Sticky.None) + .selectable(false) + .editable(true) + .swipeAction({ end:this.itemEnd}) } - .height(300) - .width("90%") - .editMode(true) - .border({ width: 3, color: Color.Red }) - .lanes({ minLength: 40, maxLength: 60 }) - //lanes(5) - .alignListItem(this.alignListItem) - - }.width("100%").height("100%") + } + .padding(10) + .backgroundColor(0xDCDCDC) + .width('100%') + .height('100%') } } diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pageRoute.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pageRoute.ets new file mode 100644 index 0000000000000000000000000000000000000000..b98d8a6f13820272316d2957bc54354176204b1d --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pageRoute.ets @@ -0,0 +1,95 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct PageRouteExample { + @State private angle:number = 1; + @State private imageSize:number = 2; + @State private speed:number = 5; + @State private interval:number = 0; + @State private state:string = ''; + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) + { + Image($rawfile('test.png')) + .width(100).height(100).objectFit(ImageFit.Contain) + .margin({top:50,bottom:150,right:10}) + .rotate({ x: 0, y: 0, z: 2, angle:this.angle}) // 组件以(1,1,1)为旋转轴,中心点顺时针旋转 300度 + .scale({ x: this.imageSize, y: this.imageSize }) + Text('speed '+ this.speed) + .fontSize(20).fontWeight(FontWeight.Bold) + Slider({ + value: this.speed, + min: 1, + max: 50, + step: 1, + style: SliderStyle.OutSet + }) + .blockColor(Color.Orange) + .onChange((value: number) => { + this.speed = value + }) + Button('Next', { type: ButtonType.Capsule, stateEffect: true }) + .backgroundColor(0x317aff) + .width(90) + .key('next') + .onClick(() => { + console.info('to next page') + router.push({ + uri:'pages/index' + }) + }) + } + .width('100%') + .height('100%') + } + speedChange(){ + var that = this + this.interval = setInterval(function(){ + that.angle += that.speed + },15) + } + + onPageHide() { + console.info('current page will be hidden, value changed') + this.state = 'onPageHide' + try { + var eventData = { + data: { + "value": this.state, + } + } + var event = { + eventId: 10, + priority: events_emitter.EventPriority.LOW + } + console.info("page start to emit action state") + events_emitter.emit(event, eventData) + } catch(err) { + console.info("page emit action state err: " + JSON.stringify(err.message)) + } + } + + onPageShow(){ + this.speedChange() + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets index e2f8f320dbc54064d64187188639b574d327da7f..4aeb79f585041843fcd5bae2b53144541a6c8033 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets @@ -13,14 +13,14 @@ * limitations under the License. */ +import events_emitter from '@ohos.events.emitter'; import Log from '../common/Log.ets'; const TAG = 'ets_apiLack_add'; @Entry @Component export default struct PanelBackgroundMask { - @State show1: boolean = false - @State show2: boolean = false + @State mode: PanelMode = PanelMode.Full aboutToAppear() { Log.showInfo(TAG, `aboutToAppear PanelBackgroundMask start`) @@ -31,24 +31,7 @@ export default struct PanelBackgroundMask { } build() { - // Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { Column() { - Text("panel-BackgroundMask") - .width(100) - .height(70) - .fontSize(20) - .opacity(1) - .align(Alignment.TopStart) - .fontColor(0xCCCCCC) - .lineHeight(25) - .border({ width: 1 }) - .padding(10) - .textAlign(TextAlign.Center) - .textOverflow({ overflow: TextOverflow.None }) - .key("backgroundMaskText") - .onClick(() => { - this.show1 = !this.show1 - }) Text("panel-OnHeightChange") .width(100) @@ -64,40 +47,43 @@ export default struct PanelBackgroundMask { .textOverflow({ overflow: TextOverflow.None }) .key("onHeightChangeText") .onClick(() => { - this.show2 = !this.show2 + this.mode = PanelMode.Half }) - Panel(this.show1) { + Panel(true) { Column() { Text("panel-BackgroundMask").fontSize(30) } } + .key("panel") + .mode(this.mode) .backgroundColor('green') .type(PanelType.Foldable) - .mode(PanelMode.Half) .dragBar(false) .halfHeight(300) .onChange((width: number, height: number, mode: PanelMode) => { Log.showInfo(TAG, `width:${width},height:${height},mode:${mode}`) }) .backgroundMask('red') - - Panel(this.show2) { - Column() { - Text("panel-OnHeightChange").fontSize(30) - } - } - .backgroundColor('red') - .type(PanelType.Foldable) - .mode(PanelMode.Half) - .dragBar(false) - .halfHeight(300) - .onChange((width: number, height: number, mode: PanelMode) => { - console.log(`width:${width},height:${height},mode:${mode}`) - }) .onHeightChange((value: number) => { Log.showInfo(TAG, 'onHeightChange: ' + value) - }) + try { + var backData = { + data: { + "result":"success" + } + } + let backEvent = { + eventId: 10111, + priority: events_emitter.EventPriority.LOW + } + console.info("onHeightChange start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("testpanelOnHeightChange0002 emit action state err: " + JSON.stringify(err.message)) + } + }) + }.width("100%").height("100%") } } diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/sideBar.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/sideBar.ets index 6af90e0dbc1004970102bf8d5c5685a53ad99de0..10fb672b2d215452cbb39f6bbfaad774228cc9d5 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/sideBar.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/sideBar.ets @@ -65,6 +65,7 @@ struct SideBarShowSideBar { .showSideBar(true) .autoHide(false) .sideBarWidth(240) + .sideBarPosition(SideBarPosition.End) .minSideBarWidth(210) .maxSideBarWidth(260) .onChange((value: boolean) => { diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/FocusControlJsunit.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/FocusControlJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a2d6bd3dff0449ca6610725808c4c0e900ca047 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/FocusControlJsunit.test.ets @@ -0,0 +1,187 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; + +export default function focusControlJsunit() { + describe('focusControlTest', function () { + beforeEach(async function (done) { + console.info("focusControlTest beforeEach start"); + let options = { + uri: 'pages/focusControl', + } + let result; + try { + router.clear(); + let pages = router.getState(); + console.info("get focus state pages: " + JSON.stringify(pages)); + if (!("focusControl" == pages.name)) { + console.info("get focus state pages.name: " + JSON.stringify(pages.name)); + result = await router.push(options); + await Utils.sleep(2000); + console.info("push focus page result: " + JSON.stringify(result)); + } + } catch (err) { + console.error("push focus page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("focus after each called"); + }) + + it('testFocusOnTouch01', 0, async function (done) { + console.info('[testFocusOnTouch01] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch01] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('FocusOnTouchGrpBtn') + done() + } + } + var innerEvent = { + eventId: 60232, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch01 click result is: " + JSON.stringify(sendEventByKey('OnTouchGrpBtn', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch01] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch01] testSendTouchEvent END'); + }); + + it('testFocusOnTouch02', 0, async function (done) { + console.info('[testFocusOnTouch02] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch02] get event state result is: " + JSON.stringify(eventData)) + expect(eventData.data.value).assertEqual('FocusOnTouchBtn1') + done() + } + } + var innerEvent = { + eventId: 60233, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch02 click result is: " + JSON.stringify(sendEventByKey('OnTouchBtn1', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch02] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch02] testSendTouchEvent END'); + }); + + it('testFocusOnTouch03', 0, async function (done) { + console.info('[testFocusOnTouch03] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch03] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('FocusOnTouchBtn2') + done() + } + } + var innerEvent = { + eventId: 60234, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch03 click result is: " + JSON.stringify(sendEventByKey('OnTouchBtn2', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch03] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch03] testSendTouchEvent END'); + }); + + it('testFocusOnTouch04', 0, async function (done) { + console.info('[testFocusOnTouch04] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch04] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('OnTouchBtn3') + done() + } + } + var innerEvent = { + eventId: 60235, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch04 click result is: " + JSON.stringify(sendEventByKey('OnTouchBtn3', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch04] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch04] testSendTouchEvent END'); + }); + + it('testFocusOnTouch05', 0, async function (done) { + console.info('[testFocusOnTouch05] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch05] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('OnTouchBtn4') + done() + } + } + var innerEvent = { + eventId: 60236, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch05 click result is: " + JSON.stringify(sendEventByKey('OnTouchBtn4', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch05] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch05] testSendTouchEvent END'); + }); + + it('testDefaultFocus06', 0, async function (done) { + console.info('[testDefaultFocus06] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testDefaultFocus06] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('defaultFocus') + done() + } + } + var innerEvent = { + eventId: 60237, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testDefaultFocus06] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testDefaultFocus06] END'); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets index 98f0ec7b1a13c48dbdc61e613131ab54fdbd3dc9..ead1df032237f27f1495b033b71e891db91813bf 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets @@ -21,8 +21,10 @@ import commonBackgroundBlurStyleJsunit from './common.test.ets'; import common_ts_ets_apiStaticClearJsunit from './common_ts_ets_api.test.ets'; import ellipseNeJsunit from './ellipse.test.ets'; import featureAbilityStartAbilityJsunit from './featureAbility.test.ets'; +import focusControlJsunit from './FocusControlJsunit.test.ets' import gaugeColorsJsunit from './gauge.test.ets'; import gestureSetDirectionJsunit from './gesture.test.ets'; +import globalJsunit from './global.test.ets'; import gridMaxCountJsunit from './grid.test.ets'; import gridItemOnSelectJsunit from './gridItem.test.ets'; import grid_colSpanJsunit from './grid_col.test.ets'; @@ -34,6 +36,7 @@ import listNewJsunit from './listTest.test.ets'; import list_itemOnSelectJsunit from './list_item.test.ets'; import mediaQueryOffJsunit from './mediaQuery.test.ets'; import navigatorTargetJsunit from './navigator.test.ets' +import pageRouteTest from './pageRoute.test.ets' import panelBackgroundMaskJsunit from './panel.test.ets'; import pathNewTest from './path.test.ets'; import polygonNewJsunit from './polygon.test.ets'; @@ -69,6 +72,7 @@ export default function testsuite() { featureAbilityStartAbilityJsunit() gaugeColorsJsunit() gestureSetDirectionJsunit() + globalJsunit() gridMaxCountJsunit() gridItemOnSelectJsunit() inspectorJsunit() @@ -77,6 +81,7 @@ export default function testsuite() { list_itemOnSelectJsunit() mediaQueryOffJsunit() navigatorTargetJsunit() + pageRouteTest() panelBackgroundMaskJsunit() pathNewTest() polygonNewJsunit() diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/global.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/global.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e2cbde4c685427a7f37c5f6407fdb88136fb1c0 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/global.test.ets @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function globalJsunit() { + describe('globalJsunit', function () { + beforeEach(async function (done) { + console.info("global beforeEach start"); + let options = { + uri: 'pages/global', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get global state pages:" + JSON.stringify(pages)); + if (!("global" == pages.name)) { + console.info("get global state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push global page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push global page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testglobal_getInspectorTree0001 + * @tc.desic aceGlobal_getInspectorTree0001 + */ + it('testglobal_getInspectorTree0001', 0, async function (done) { + console.info('testglobal_getInspectorTree0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorTree(); + console.info("[testglobal_getInspectorTree0001] strJson:" + strJson); + expect(strJson !== null).assertTrue(); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testglobal_sendKeyEvent0002 + * @tc.desic aceGlobal_sendKeyEvent0002 + */ + it('testglobal_sendKeyEvent0002', 0, async function (done) { + console.info('testglobal_sendKeyEvent0002 START'); + await Utils.sleep(2000); + let KeyEvent = {type:1,keyCode:2027,keyText:"Unknown",keySource:4,deviceId:7,metaKey:0,timestamp:5284417765376}; + let result = sendKeyEvent(KeyEvent); + console.info("[testglobal_sendKeyEvent0002] result:" + result); + expect(JSON.stringify(result)).assertEqual("true"); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testglobal_sendMouseEvent0003 + * @tc.desic aceGlobal_sendMouseEvent0003 + */ + it('testglobal_sendMouseEvent0003', 0, async function (done) { + console.info('testglobal_sendMouseEvent0003 START'); + await Utils.sleep(2000); + let mouseEvent = {button:0,action:3,screenX:202.66666666666666,screenY:102.66666666666667,x:34,y:34,timestamp:8261302454000,source:1, + target:{area:{position:{x:158.66666666666666,y:58.666666666666664},globalPosition:{x:168.66666666666666,y:68.66666666666666},width:142.66666666666666,height:58.666666666666664}}}; + let result = sendMouseEvent(mouseEvent); + console.info("[testglobal_sendMouseEvent0003] result:" + result); + expect(JSON.stringify(result)).assertEqual("true"); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets index eccce3c9170f5945d140ca2c2e9e94bb9175f8f8..f10dc1c67a892377be8877d287b0da08a02e8d7f 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets @@ -96,5 +96,18 @@ export default function list_itemOnSelectJsunit() { console.info("[testlist_itemOnSelect0003] sticky value :" + obj.$attrs.sticky); done(); }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testlist_itemSwipeAction0004 + * @tc.desic acelist_itemSwipeActionEtsTest0004 + */ + it('testlist_itemSwipeAction0004', 0, async function (done) { + console.info('selectOnSelect testlist_itemSwipeAction0004 START'); + await Utils.sleep(2000); + let obj = JSON.stringify(sendEventByKey('Del', 10, "")) + expect(obj).assertEqual('false'); + done(); + }); }) } diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/pageRoute.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/pageRoute.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e7507444adac3afed7d432c83b969aac56058d53 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/pageRoute.test.ets @@ -0,0 +1,71 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils' + +export default function pageRouteTest() { + describe('pageRouteTest', function () { + beforeEach(async function (done) { + console.info("pageRouteTest beforeEach start"); + let options = { + uri: 'pages/pageRoute', + } + let result; + try { + router.clear(); + let pages = router.getState(); + console.info("get pageRouteTest pages: " + JSON.stringify(pages)); + if (!("pageRoute" == pages.name)) { + console.info("get pageRouteTest pages.name: " + JSON.stringify(pages.name)); + result = await router.push(options); + await Utils.sleep(2000); + console.info("pageRouteTest page result: " + JSON.stringify(result)); + } + } catch (err) { + console.error("pageRouteTest page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("pageRouteTest after each called"); + }) + + it('testOnPageHide01', 0, function () { + console.info('[testOnPageHide01] START'); + var callback = (eventData) => { + console.info("[testOnPageHide01] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('onPageHide') + done() + } + var innerEvent = { + eventId: 10, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + console.info("testOnPageHide01 click result is: " + JSON.stringify(sendEventByKey('next', 10, ""))); + } catch (err) { + console.info("[testOnPageHide01] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testOnPageHide01] testSendTouchEvent END'); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets index 847dfd018bea4b88c6d02f2ed157ee5948244f5a..07d434e17712d6c5d0703b7af9c1b368ee92fd27 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets @@ -14,6 +14,7 @@ */ import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import Utils from './Utils.ets' @@ -53,149 +54,44 @@ export default function panelBackgroundMaskJsunit() { it('testpanelBackgroundMask0001', 0, async function (done) { console.info('panelBackgroundMask testpanelBackgroundMask0001 START'); await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0001] component width strJson:" + strJson); + let strJson = getInspectorByKey('panel'); let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.width).assertEqual("100.00vp"); - console.info("[testpanelBackgroundMask0001] width value :" + obj.$attrs.width); + console.info("get inspector value is: " + JSON.stringify(obj)); + console.log(JSON.stringify(obj.$type)) + expect(obj.$type).assertEqual('Panel') + console.log('Panel‘s backgroundMask is ' + JSON.stringify(obj.$attrs.backgroundMask)) + expect(obj.$attrs.backgroundMask).assertEqual('#FFFF0000'); done(); }); /* * @tc.number SUB_ACE_BASIC_ETS_API_0002 - * @tc.name testpanelBackgroundMask0002 + * @tc.name testpanelOnHeightChange0002 * @tc.desic acepanelBackgroundMaskEtsTest0002 */ - it('testpanelBackgroundMask0002', 0, async function (done) { - console.info('panelBackgroundMask testpanelBackgroundMask0002 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0002] component height strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.height).assertEqual("70.00vp"); - console.info("[testpanelBackgroundMask0002] height value :" + obj.$attrs.height); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0003 - * @tc.name testpanelBackgroundMask0003 - * @tc.desic acepanelBackgroundMaskEtsTest0003 - */ - it('testpanelBackgroundMask0003', 0, async function (done) { - console.info('panelBackgroundMask testpanelBackgroundMask0003 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0003] component fontSize strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.fontSize).assertEqual("20.00fp"); - console.info("[testpanelBackgroundMask0003] fontSize value :" + obj.$attrs.fontSize); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0004 - * @tc.name testpanelBackgroundMask0004 - * @tc.desic acepanelBackgroundMaskEtsTest0004 - */ - it('testpanelBackgroundMask0004', 0, async function (done) { - console.info('panelBackgroundMask testpanelBackgroundMask0004 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0004] component opacity strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.opacity).assertEqual(1); - console.info("[testpanelBackgroundMask0004] opacity value :" + obj.$attrs.opacity); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0005 - * @tc.name testpanelBackgroundMask0005 - * @tc.desic acepanelBackgroundMaskEtsTest0005 - */ - it('testpanelBackgroundMask0005', 0, async function (done) { - console.info('panelBackgroundMask testpanelBackgroundMask0005 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0005] component align strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); - console.info("[testpanelBackgroundMask0005] align value :" + obj.$attrs.align); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0006 - * @tc.name testpanelBackgroundMask0006 - * @tc.desic acepanelBackgroundMaskEtsTest0006 - */ - it('testpanelBackgroundMask0006', 0, async function (done) { - console.info('panelBackgroundMask testpanelBackgroundMask0006 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0006] component fontColor strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); - console.info("[testpanelBackgroundMask0006] fontColor value :" + obj.$attrs.fontColor); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0007 - * @tc.name testpanelBackgroundMask0007 - * @tc.desic acepanelBackgroundMaskEtsTest0007 - */ - it('testpanelBackgroundMask0007', 0, async function (done) { - console.info('panelBackgroundMask testpanelBackgroundMask0007 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0007] component lineHeight strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); - console.info("[testpanelBackgroundMask0007] lineHeight value :" + obj.$attrs.lineHeight); - done(); - }); - - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0009 - * @tc.name testpanelBackgroundMask0009 - * @tc.desic acepanelBackgroundMaskEtsTest0009 - */ - it('testpanelBackgroundMask0009', 0, async function (done) { - console.info('panelBackgroundMask testpanelBackgroundMask009 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0009] component padding strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.padding).assertEqual("10.00vp"); - console.info("[testpanelBackgroundMask0009] padding value :" + obj.$attrs.padding); - done(); + it('testpanelOnHeightChange0002', 0, async function (done) { + console.info('panelBackgroundMask testpanelOnHeightChange0002 START'); + var panelOnHeightChangeEvent = { + eventId: 10111, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (backData) => { + console.info("testpanelOnHeightChange0002 backData.data.result is: " + backData.data.result); + try{ + console.info("testpanelOnHeightChange0002 callback1 success" ); + expect(backData.data.result).assertEqual("success"); + done(); + }catch(err){ + console.info("testpanelOnHeightChange0002 on events_emitter err : " + JSON.stringify(err)); + } + } + try { + console.info("testpanelOnHeightChange0002 click result is: " + JSON.stringify(sendEventByKey('onHeightChangeText', 10, ""))); + events_emitter.on(panelOnHeightChangeEvent, callback1); + } catch (err) { + console.info("testpanelOnHeightChange0002 on events_emitter err : " + JSON.stringify(err)); + } }); - /* - * @tc.number SUB_ACE_BASIC_ETS_API_0010 - * @tc.name testpanelBackgroundMask0010 - * @tc.desic acepanelBackgroundMaskEtsTest0010 - */ - it('testpanelBackgroundMask0010', 0, async function (done) { - console.info('panelBackgroundMask testpanelBackgroundMask0010 START'); - await Utils.sleep(2000); - let strJson = getInspectorByKey('backgroundMaskText'); - console.info("[testpanelBackgroundMask0010] component textAlign strJson:" + strJson); - let obj = JSON.parse(strJson); - expect(obj.$type).assertEqual('Text'); - expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); - console.info("[testpanelBackgroundMask0010] textAlign value :" + obj.$attrs.textAlign); - done(); - }); }) } diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/sideBar.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/sideBar.test.ets index b25780f63d5e609a00a3b763754eee3a57f9411e..991bec94f35e9ed7c7bba74be637a966c82063c2 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/sideBar.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/sideBar.test.ets @@ -79,5 +79,21 @@ export default function sideBarShowSideBarJsunit() { done(); }); + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testsideBarShowSideBar0003 + * @tc.desic acesideBarShowSideBarEtsTest0003 + */ + it('testsideBarShowSideBar0003', 0, async function (done) { + console.info('sideBarShowSideBar testsideBarShowSideBar0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('SideBarContainer'); + console.info("[testsideBarShowSideBar0003] component autoHide strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('SideBarContainer'); + expect(obj.$attrs.sideBarPosition).assertEqual(undefined); + console.info("[testsideBarShowSideBar0003] autoHide value :" + obj.$attrs.autoHide); + done(); + }); }) } diff --git a/arkui/ace_ets_component_attrlack/BUILD.gn b/arkui/ace_ets_component_attrlack/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..afada8b8fbb59d885f37f9ff3b48eddceee06925 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2021 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAceEtsAttrLackTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_ets_dev_assets", + ":ace_ets_dev_resources", + ":ace_ets_dev_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAceEtsAttrLackTest" +} +ohos_js_assets("ace_ets_dev_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("ace_ets_dev_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("ace_ets_dev_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/arkui/ace_ets_component_attrlack/Test.json b/arkui/ace_ets_component_attrlack/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7a568e735eb08f4683506d00b2f34d20cf18e3d4 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for aceEtsAttrLack Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.open.harmony.aceEtsAttrLack", + "package-name": "com.open.harmony.aceEtsAttrLack", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAceEtsAttrLackTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/config.json b/arkui/ace_ets_component_attrlack/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c1fa0bbe374b6018f8ee4cbfb24c59204a8b0bf3 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/config.json @@ -0,0 +1,137 @@ +{ + "app": { + "bundleName": "com.open.harmony.aceEtsAttrLack", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.aceEtsAttrLack", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.aceEtsAttrLack.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/page1", + "pages/page2", + "pages/alertDialog", + "pages/animate_play_mode", + "pages/animator", + "pages/app", + "pages/attr_animate", + "pages/canvas", + "pages/checkBox", + "pages/checkBoxGroup", + "pages/common", + "pages/curves", + "pages/datePicker", + "pages/edgeEffect", + "pages/enums", + "pages/featureAbility", + "pages/fill_mode", + "pages/gesture", + "pages/gridCol", + "pages/gridRow", + "pages/listtest", + "pages/loadingProgress", + "pages/pluginComponent", + "pages/progress", + "pages/radio", + "pages/refresh", + "pages/router", + "pages/scroll_edge", + "pages/sidebar", + "pages/slider", + "pages/stateManagement", + "pages/stepperItem", + "pages/swiper", + "pages/text_input", + "pages/units", + "pages/web", + "pages/copyOption", + "pages/responseType", + "pages/hoverEffect" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/app.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..07722b56d3d02df5fb59b51789007b844b43e63c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Log.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Log.ets new file mode 100644 index 0000000000000000000000000000000000000000..6dbc97e1227f29a08d60463d8bf5ed6586ee5920 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Log.ets @@ -0,0 +1,38 @@ + +const TAG = 'ets_apiLack_add'; + +/** + * Basic log class + */ +export default class Log { + + /** + * print info level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showInfo(tag, log) { + console.info(`${TAG} tag: ${tag} --> ${log}`); + } + + /** + * print debug level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showDebug(tag, log) { + console.debug(`${TAG} tag: ${tag} --> ${log}`); + } + + /** + * print error level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showError(tag, log) { + console.error(`${TAG} tag: ${tag} --> ${log}`); + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Utils.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ca8c904c5373019759b101f63fe919e1fab5658 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 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) { + var xStep; + var yStep; + var swipeSteps; + var 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) + var downPoint: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPoint); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var 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) + } + var 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) + } +} + + + + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg1.png b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg1.png new file mode 100644 index 0000000000000000000000000000000000000000..f97eae0b4cd0f7b3b2ef8c4db1af68ce861181e9 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg1.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg2.png b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg2.png new file mode 100644 index 0000000000000000000000000000000000000000..187dad546d1c335de78e8469c1ad0dd06e20a045 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg2.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/plugin_component.js b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/plugin_component.js new file mode 100644 index 0000000000000000000000000000000000000000..6a3b4ed6c92a847bc0c1a8421cefc8a5b8b52d1c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/plugin_component.js @@ -0,0 +1,98 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 pluginComponentManager from '@ohos.pluginComponent' + +function onPushListener(source, template, data, extraData) { + console.log("onPushListener template.source=" + template.source) + var jsonObject = JSON.parse(data.componentTemplate.source) + console.log("request_callback1:source json object" + jsonObject) + var jsonArry = jsonObject.ExternalComponent + for (var i in jsonArry) { + console.log(jsonArry[i]) + } + console.log("onPushListener:source json object" + jsonObject) + console.log("onPushListener:source json string" + JSON.stringify(jsonObject)) + console.log("onPushListener template.ability=" + template.ability) + console.log("onPushListener data=" + JSON.stringify(data)) + console.log("onPushListener extraData=" + JSON.stringify(extraData)) +} + +function onRequestListener(source, name, data) +{ + console.log("onRequestListener name=" + name); + console.log("onRequestListener data=" + JSON.stringify(data)); + return {template:"plugintemplate", data:data}; +} + +export default { + //register listener + onListener() { + pluginComponentManager.on("push", onPushListener) + pluginComponentManager.on("request", onRequestListener) + }, + Push() { + // 组件提供方主动发送事件 + pluginComponentManager.push( + { + want: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback: push ok!"); + } + ) + }, + Request() { + // 组件使用方主动发送事件 + pluginComponentManager.request({ + want: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + jsonPath: "", + }, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + var jsonObject = JSON.parse(data.componentTemplate.source) + console.log("request_callback:source json object" + jsonObject) + var jsonArry = jsonObject.ExternalComponent + for (var i in jsonArry) { + console.log(jsonArry[i]) + } + console.log("request_callback:source json string" + JSON.stringify(jsonObject)) + console.log("request_callback: data=" + JSON.stringify(data.data)) + console.log("request_callback: extraData=" + JSON.stringify(data.extraData)) + } + ) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a97a6fb48d2fd1961f1b88bee8ebc0e5f2bde06 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 plugin from "plugin_component.js" + +@Entry +@Component +struct PluginProviderExample { + @State message: string = 'no click!' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Register Push Listener') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.onListener() + console.log("Button('Register Push Listener')") + }) + Button('Push') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.Push() + this.message = "Button('Push')" + console.log("Button('Push')") + }) + Text(this.message) + .height(150) + .fontSize(30) + .padding(5) + .margin(5) + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/alertDialog.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/alertDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..56667c8963b12bd1b54045fc29c9b43ea8d0f7c6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/alertDialog.ets @@ -0,0 +1,146 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct AlertDialogCenterStart { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear AlertDialogCenterStart start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear AlertDialogCenterStart end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("alertDialog-CenterStart") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("CenterStartText") + + Text("alertDialog-CenterEnd") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("CenterEndText") + + Button('one button dialog') + .key("CenterStartButton") + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback') + } + }, + cancel: () => { + console.info('Closed callbacks') + }, + alignment:DialogAlignment.CenterStart + } + ) + try { + var backData = { + data: { + "Result": true + } + } + let backEvent = { + eventId: 81601, + priority: events_emitter.EventPriority.LOW + } + console.info("CenterStart start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("CenterStart emit action state err: " + JSON.stringify(err.message)) + } + }) + .backgroundColor(0x317aff) + + Button('two button dialog') + .key("CenterEndButton") + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + primaryButton: { + value: 'cancel', + action: () => { + console.info('Callback when the first button is clicked') + } + }, + secondaryButton: { + value: 'ok', + action: () => { + console.info('Callback when the second button is clicked') + } + }, + cancel: () => { + console.info('Closed callbacks') + }, + alignment:DialogAlignment.CenterEnd + } + ) + try { + var backData = { + data: { + "Result": true + } + } + let backEvent = { + eventId: 81602, + priority: events_emitter.EventPriority.LOW + } + console.info("CenterEnd start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("CenterEnd emit action state err: " + JSON.stringify(err.message)) + } + }).backgroundColor(0x317aff) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animate_play_mode.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animate_play_mode.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb499e08453ac1aa9ba0ee94c90371ee52d290d0 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animate_play_mode.ets @@ -0,0 +1,125 @@ +/** + * Copyright (c) 2021 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct AttrAnimationExample { + @State widthSize: number = 200 + @State heightSize: number = 100 + @State flag: boolean = true + + @State widthSizeAlternate: number = 200 + @State heightSizeAlternate: number = 100 + @State flagAlternate: boolean = true + @State widthSizeNormal: number = 200 + @State heightSizeNormal: number = 100 + @State flagNormal: boolean = true + + @State widthSizeAlternateReverse: number = 200 + @State heightSizeAlternateReverse: number = 100 + @State flagAlternateReverse: boolean = true + + build() { + Column() { + Button('PlayMode.Reverse') + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 200 + this.heightSize = 100 + } + this.flag = !this.flag + }) + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .key("Reverse") + .animation({ + duration: 3000, // 动画时长 + curve: Curve.EaseOut, // 动画曲线 + delay: 1000, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Reverse // 动画模式 + }) // 对Button组件的宽高属性进行动画配置 + + Button('PlayMode.Alternate') + .onClick((event: ClickEvent) => { + if (this.flagAlternate) { + this.widthSizeAlternate = 100 + this.heightSizeAlternate = 50 + } else { + this.widthSizeAlternate = 200 + this.heightSizeAlternate = 100 + } + this.flagAlternate = !this.flagAlternate + }) + .width(this.widthSizeAlternate).height(this.heightSizeAlternate).backgroundColor(0x317aff) + .key("Alternate") + .animation({ + duration: 3000, + curve: Curve.EaseOut, + delay: 1000, + iterations: 1, + playMode: PlayMode.Alternate + }) + + Button('PlayMode.Normal') + .onClick((event: ClickEvent) => { + if (this.flagNormal) { + this.widthSizeNormal = 100 + this.heightSizeNormal = 50 + } else { + this.widthSizeNormal = 200 + this.heightSizeNormal = 100 + } + this.flagNormal = !this.flagNormal + }) + .width(this.widthSizeNormal).height(this.heightSizeNormal).backgroundColor(0x317aff) + .key("Normal") + .animation({ + duration: 3000, + curve: Curve.EaseOut, + delay: 1000, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('PlayMode.AlternateReverse') + .onClick((event: ClickEvent) => { + if (this.flagAlternateReverse) { + this.widthSizeAlternateReverse = 100 + this.heightSizeAlternateReverse = 50 + } else { + this.widthSizeAlternateReverse = 200 + this.heightSizeAlternateReverse = 100 + } + this.flagAlternateReverse = !this.flagAlternateReverse + }) + .width(this.widthSizeAlternateReverse).height(this.heightSizeAlternateReverse).backgroundColor(0x317aff) + .key("AlternateReverse") + .animation({ + duration: 3000, + curve: Curve.EaseOut, + delay: 1000, + iterations: 1, + playMode: PlayMode.AlternateReverse + }) + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animator.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animator.ets new file mode 100644 index 0000000000000000000000000000000000000000..7bb0c726ad120268e713e303fce85504369e6abb --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animator.ets @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct AnimatorOnframe { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear AnimatorOnframe start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear AnimatorOnframe end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("animator-Onframe") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onframeText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/app.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..48ea7769373274c8e64d77a2e7a9629beb595409 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/app.ets @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 app from '@system.app'; +import events_emitter from '@ohos.events.emitter'; + +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct AppVersionCode { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear AppVersionCode start:`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear AppVersionCode end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("app-VersionCode") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("versionCodeText") + .onClick(()=>{ + app.getInfo().versionCode = 1 + try { + var backData = { + data: { + "Code": app.getInfo().versionCode + } + } + let backEvent = { + eventId: 60302, + priority: events_emitter.EventPriority.LOW + } + console.info("versionCode start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("versionCode emit action state err: " + JSON.stringify(err.message)) + } + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/attr_animate.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/attr_animate.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1a2014a7efd7631a6f99029b85133cd5cb619b9 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/attr_animate.ets @@ -0,0 +1,267 @@ +/** + * Copyright (c) 2021 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct AttrAnimationExample { + @State widthSize: number = 200 + @State heightSize: number = 80 + @State flag: boolean = true + + @State widthSizeEaseOut: number = 200 + @State heightSizeEaseOut: number = 80 + @State flagEaseOut: boolean = true + + @State widthSizeFastOutSlowIn: number = 200 + @State heightSizeFastOutSlowIn: number = 80 + @State flagFastOutSlowIn: boolean = true + + @State widthSizeLinearOutSlowIn: number = 200 + @State heightSizeLinearOutSlowIn: number = 80 + @State flagLinearOutSlowIn: boolean = true + + @State widthSizeFastOutLinearIn: number = 200 + @State heightSizeFastOutLinearIn: number = 80 + @State flagFastOutLinearIn: boolean = true + + @State widthSizeExtremeDeceleration: number = 200 + @State heightSizeExtremeDeceleration: number = 80 + @State flagExtremeDeceleration: boolean = true + + @State widthSizeSharp: number = 200 + @State heightSizeSharp: number = 80 + @State flagSharp: boolean = true + + @State widthSizeRhythm: number = 200 + @State heightSizeRhythm: number = 80 + @State flagRhythm: boolean = true + + @State widthSizeSmooth: number = 200 + @State heightSizeSmooth: number = 80 + @State flagSmooth: boolean = true + + @State widthSizeFriction: number = 200 + @State heightSizeFriction: number = 80 + @State flagFriction: boolean = true + + build() { + Column() { + Button('EaseInOut') + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 200 + this.heightSize = 80 + } + this.flag = !this.flag + }) + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 2000, // 动画时长 + curve: Curve.EaseInOut, // 动画曲线 + delay: 500, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Normal // 动画模式 + }) + + Button('Curve.EaseOut') + .onClick((event: ClickEvent) => { + if (this.flagEaseOut) { + this.widthSizeEaseOut = 100 + this.heightSizeEaseOut = 50 + } else { + this.widthSizeEaseOut = 200 + this.heightSizeEaseOut = 80 + } + this.flagEaseOut = !this.flagEaseOut + }) + .width(this.widthSizeEaseOut).height(this.heightSizeEaseOut).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.EaseOut, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('FastOutSlowIn') + .onClick((event: ClickEvent) => { + if (this.flagFastOutSlowIn) { + this.widthSizeFastOutSlowIn = 100 + this.heightSizeFastOutSlowIn = 50 + } else { + this.widthSizeFastOutSlowIn = 200 + this.heightSizeFastOutSlowIn = 80 + } + this.flagFastOutSlowIn = !this.flagFastOutSlowIn + }) + .width(this.widthSizeFastOutSlowIn).height(this.heightSizeFastOutSlowIn).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.FastOutSlowIn, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('LinearOutSlowIn') + .onClick((event: ClickEvent) => { + if (this.flagLinearOutSlowIn) { + this.widthSizeLinearOutSlowIn = 100 + this.heightSizeLinearOutSlowIn = 50 + } else { + this.widthSizeLinearOutSlowIn = 200 + this.heightSizeLinearOutSlowIn = 80 + } + this.flagLinearOutSlowIn = !this.flagLinearOutSlowIn + }) + .width(this.widthSizeLinearOutSlowIn).height(this.heightSizeLinearOutSlowIn).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.LinearOutSlowIn, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('FastOutLinearIn') + .onClick((event: ClickEvent) => { + if (this.flagFastOutLinearIn) { + this.widthSizeFastOutLinearIn = 100 + this.heightSizeFastOutLinearIn = 50 + } else { + this.widthSizeFastOutLinearIn = 200 + this.heightSizeFastOutLinearIn = 80 + } + this.flagFastOutLinearIn = !this.flagFastOutLinearIn + }) + .width(this.widthSizeFastOutLinearIn).height(this.heightSizeFastOutLinearIn).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.FastOutLinearIn, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('ExtremeDeceleration') + .onClick((event: ClickEvent) => { + if (this.flagExtremeDeceleration) { + this.widthSizeExtremeDeceleration = 100 + this.heightSizeExtremeDeceleration = 50 + } else { + this.widthSizeExtremeDeceleration = 200 + this.heightSizeExtremeDeceleration = 80 + } + this.flagExtremeDeceleration = !this.flagExtremeDeceleration + }) + .width(this.widthSizeExtremeDeceleration).height(this.heightSizeExtremeDeceleration).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.ExtremeDeceleration, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('Sharp') + .onClick((event: ClickEvent) => { + if (this.flagSharp) { + this.widthSizeSharp = 100 + this.heightSizeSharp = 50 + } else { + this.widthSizeSharp = 200 + this.heightSizeSharp = 80 + } + this.flagSharp = !this.flagSharp + }) + .width(this.widthSizeSharp).height(this.heightSizeSharp).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.Sharp, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('Rhythm') + .onClick((event: ClickEvent) => { + if (this.flagRhythm) { + this.widthSizeRhythm = 100 + this.heightSizeRhythm = 50 + } else { + this.widthSizeRhythm = 200 + this.heightSizeRhythm = 80 + } + this.flagRhythm = !this.flagRhythm + }) + .width(this.widthSizeRhythm).height(this.heightSizeRhythm).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.Rhythm, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('Smooth') + .onClick((event: ClickEvent) => { + if (this.flagSmooth) { + this.widthSizeSmooth = 100 + this.heightSizeSmooth = 50 + } else { + this.widthSizeSmooth = 200 + this.heightSizeSmooth = 80 + } + this.flagSmooth = !this.flagSmooth + }) + .width(this.widthSizeSmooth).height(this.heightSizeSmooth).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.Smooth, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('Friction') + .onClick((event: ClickEvent) => { + if (this.flagFriction) { + this.widthSizeFriction = 100 + this.heightSizeFriction = 50 + } else { + this.widthSizeFriction = 200 + this.heightSizeFriction = 80 + } + this.flagFriction = !this.flagFriction + }) + .width(this.widthSizeFriction).height(this.heightSizeFriction).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.Friction, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/calendar.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/calendar.ets new file mode 100644 index 0000000000000000000000000000000000000000..7be4f5545d0b194f859f2a6baa7c4125c5bfec01 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/calendar.ets @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2021 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct calendar { + @State curMonth: MonthData = { year: 0, month: 0, data: [] }; + @State preMonth: MonthData = { year: 0, month: 0, data: [] }; + @State nextMonth: MonthData = { year: 0, month: 0, data: [] } + @State year: number = 0 + @State month: number = 0 + Controller: CalendarController = new CalendarController(); + private lunarMonthDays: string[] = [ + '初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十', + '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', + '廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '三十'] + private lunarMonthNames: string[] = ['正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月'] + + build() { + Calendar({ + date: { year: 2021, month: 8, day: 35 }, + currentData: this.curMonth, + preData: this.preMonth, + nextData: this.nextMonth, + controller: this.Controller + }) + .showLunar(true) + .showHoliday(true) + .needSlide(true) + .offDays(Week.Fri | Week.Sat | Week.Mon | Week.Thur) + .startOfWeek(Week.Sun) + .direction(Axis.Horizontal) + .currentDayStyle({ + dayColor: Color.Black, + lunarColor: Color.Gray, + markLunarColor: Color.Black, + dayFontSize: 15, + lunarDayFontSize: 10, + boundaryColOffset: 10, + }) + .nonCurrentDayStyle({ + nonCurrentMonthDayColor: Color.Black, + nonCurrentMonthLunarColor: Color.Gray, + nonCurrentMonthWorkDayMarkColor: Color.Green, + nonCurrentMonthOffDayMarkColor: Color.Brown, + }) + .todayStyle({ + focusedDayColor: Color.Red, + focusedLunarColor: Color.Orange, + focusedAreaBackgroundColor: Color.Blue, + focusedAreaRadius: 20 + }) + .weekStyle({ + weekColor: Color.Black, + weekendDayColor: Color.Orange, + weekendLunarColor: Color.Blue, + weekFontSize: 20, + weekHeight: 5, + weekWidth: 48, + }) + .workStateStyle({ + workDayMarkColor: Color.Red, + offDayMarkColor: Color.Orange, + workDayMarkSize: 10, + offDayMarkSize: 2, + workStateWidth: 12, + workStateHorizontalMovingDistance: 0, + workStateVerticalMovingDistance: 12, + }) + .onSelectChange((request) => { + this.year = request.year; + this.month = request.month; + console.info('On Select change: ' + this.year + '/' + this.month) + }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/canvas.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/canvas.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e2e4affc2fced5a3c1529a15b3dbf8e13ddeadc --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/canvas.ets @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct CanvasActualBoundingBoxAscent { + + private settings: RenderingContextSettings = new RenderingContextSettings(true)//antialias:boolean + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CanvasActualBoundingBoxAscent start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CanvasActualBoundingBoxAscent end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .key('Canvas') + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .position({x:3,y:5}) + .align(Alignment.Center) + .onReady(() =>{ + this.context.font = '50px sans-serif' + this.context.fillText("Hello World!", 20, 100) + this.context.textBaseline = 'top' + this.context.fillText("width:" + this.context.measureText("Hello World!").width, 20, 150) + this.context.fillText("actualBoundingBoxAscent:" + this.context.measureText("Hello World!").actualBoundingBoxAscent, 20, 200) + this.context.fillText("actualBoundingBoxDescent:" + this.context.measureText("Hello World!").actualBoundingBoxDescent, 20, 250) + this.context.fillText("actualBoundingBoxLeft:" + this.context.measureText("Hello World!").actualBoundingBoxLeft, 20, 300) + this.context.fillText("actualBoundingBoxRight:" + this.context.measureText("Hello World!").actualBoundingBoxRight, 20, 350) + this.context.fillText("alphabeticBaseline:" + this.context.measureText("Hello World!").alphabeticBaseline, 20, 400) + this.context.fillText("emHeightAscent:" + this.context.measureText("Hello World!").emHeightAscent, 20, 450) + this.context.fillText("emHeightDescent:" + this.context.measureText("Hello World!").emHeightDescent, 20, 500) + this.context.fillText("fontBoundingBoxAscent:" + this.context.measureText("Hello World!").fontBoundingBoxAscent, 20, 550) + this.context.fillText("fontBoundingBoxDescent:" + this.context.measureText("Hello World!").fontBoundingBoxDescent, 20, 600) + this.context.fillText("hangingBaseline:" + this.context.measureText("Hello World!").hangingBaseline, 20, 650) + this.context.fillText("ideographicBaseline" + this.context.measureText("Hello World!").ideographicBaseline, 20, 700) + //this.context.fillText("antialias" + this.context.measureText("Hello World!").antialias, 20, 700) + }) + } + .width('100%') + .height('100%') + + + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBox.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBox.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5e30c37435814541ade95cac85dab10c9bdf12f --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBox.ets @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct CheckBoxGroup { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CheckBoxGroup start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CheckBoxGroup end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("checkBox-Group") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("groupText") + + Row() { + CheckboxGroup({group : 'checkboxGroup'}) + .selectedColor(0xed6f21) + .key('CheckboxGroup') + .onChange((itemName:CheckboxGroupResult) => { + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) + }) + Text('select all').fontSize(20) + Checkbox({name: 'checkbox1', group: 'checkboxGroup'}) + .key('Checkbox1') + .select(true) + .selectedColor(0xed6f21) + .onChange((value: boolean) => { + console.info('Checkbox1 change is'+ value) + }) + Checkbox({name: 'checkbox2', group: 'checkboxGroup'}) + .key('Checkbox2') + .select(false) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox2 change is'+ value) + }) + } + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets new file mode 100644 index 0000000000000000000000000000000000000000..025f99e48e646d0afcd9a1b89bc3cf3f0e054854 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct CheckBoxGroupPart { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CheckBoxGroupPart start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CheckBoxGroupPart end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("checkBoxGroup-Part") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("PartText") + + Text("checkBoxGroup-Group") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("groupText") + + CheckboxGroup({group : 'checkboxGroup'}) + .key('CheckboxGroup') + .selectedColor(0xed6f21) + .onChange((itemName:CheckboxGroupResult) => { + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) + try { + var backData = { + data: { + "STATUS": itemName.status + } + } + let backEvent = { + eventId: 60301, + priority: events_emitter.EventPriority.LOW + } + console.info("Part start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Part emit action state err: " + JSON.stringify(err.message)) + } + }) + Text('select all').fontSize(20) + Checkbox({name: 'checkbox1', group: 'checkboxGroup'}) + .key('Checkbox1') + .select(true) + .selectedColor(0xed6f21) + .onChange((value: boolean) => { + console.info('Checkbox1 change is'+ value) + }) + Checkbox({name: 'checkbox2', group: 'checkboxGroup'}) + .key('Checkbox2') + .select(false) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox2 change is'+ value) + }) + + + }.width("100%").height("100%") + + + + + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets new file mode 100644 index 0000000000000000000000000000000000000000..b413cc63f7a328c1089ee8c31811f62749bab0c2 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets @@ -0,0 +1,577 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct CommonColorMode { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CommonColorMode start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear CommonColorMode end`) + } + + @Styles normalStyles() { + .backgroundColor("#0A59F7") + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("common-FontScale") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("fontScaleText") + + Text("common-OnFinish") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onFinishText") + .animation({ + onFinish: () => { + Log.showInfo(TAG, 'animation onFinish success') + } + }) + + Text("common-MotionPath") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("motionPathText") + .sharedTransition('motionPathText', { + motionPath: { + path: '' + } + }) + + Text("common-Middle") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("middleText") + .alignRules({ + middle: { anchor: 'string', align: HorizontalAlign.Center } + }) + + Text("common-Area") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("areaText") + .onClick((event) => { + Log.showInfo(TAG, 'area: ' + JSON.stringify(event.target.area)) + }) + Text("common-Repeat") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("RepeatText") + .borderImage({ + source: { angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Repeat, + fill: false + }); + + Text("common-Space") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("SpaceText") + .borderImage({ + source: { angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Space, + fill: false + }); + + Text("common-Thin") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ThinText") + .backgroundBlurStyle(BlurStyle.Thin) + + Text("common-Thick") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ThickText") + .backgroundBlurStyle(BlurStyle.Thick) + + Text("common-Slice") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("sliceText") + .borderImage({ + source: { angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Stretch, + fill: false + }); + + Text("common-Outset") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("outsetText") + .borderImage({ + source: { angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Stretch, + fill: false, + outset: 2 + }); + + + Text("common-Touches") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("touchesText") + .onTouch((event) => { + Log.showInfo(TAG, 'touches: ' + JSON.stringify(event.touches)) + }) + + Text("common-ChangedTouches") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("changedTouchesText") + .onTouch((event) => { + Log.showInfo(TAG, 'changedTouches: ' + JSON.stringify(event.changedTouches)) + }) + + Text("common-KeyCode") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("keyCodeText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'keyCode: ' + event.keyCode) + }) + + Text("common-KeyText") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("keyTextText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'keyText: ' + event.keyText) + }) + + Text("common-KeySource") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("keySourceText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'keySource: ' + event.keySource) + }) + + Text("common-DeviceId") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("deviceIdText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'deviceId: ' + event.deviceId) + }) + + Text("common-MetaKey") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("metaKeyText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'metaKey: ' + event.metaKey) + }) + + Text("common-Normal") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("normalText") + .stateStyles({ normal: this.normalStyles }) + + Text("common-Pressed") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("pressedText") + .stateStyles({ pressed: this.normalStyles }) + + Text("common-Focused") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("focusedText") + .stateStyles({ focused: this.normalStyles }) + + Text("common-Clicked") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("clickedText") + .stateStyles({ clicked: this.normalStyles }) + + }.width("100%").height("100%") + } +} + +@Preview({ + locale: 'locale' +}) +@Component +struct PreviewParamsLocale { + build() { + Flex() { + Text("common-locale") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("LocaleText") + } + } +} + +@Preview({ + colorMode: 'red', +}) +@Component +struct PreviewParamsColorMode { + build() { + Flex() { + Text("common-colorMode") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ColorModeText") + } + } +} + +@Preview({ + deviceType: 'phone' +}) +@Component +struct PreviewParamsDeviceType { + build() { + Flex() { + Text("common-deviceType") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("DeviceTypeText") + } + } +} + +@Preview({ + dpi: 160 +}) +@Component +struct PreviewParamsDpi { + build() { + Flex() { + Text("common-dpi") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("DpiText") + } + } +} + +@Preview({ + orientation: '' +}) +@Component +struct PreviewParamsOrientation { + build() { + Flex() { + Text("common-orientation") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("OrientationText") + } + } +} + +@Preview({ + roundScreen: true +}) +@Component +struct PreviewParamsRoundScreen { + build() { + Flex() { + Text("common-roundScreen") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("RoundScreenText") + } + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/copyOption.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/copyOption.ets new file mode 100644 index 0000000000000000000000000000000000000000..e96d89fe933bc352dd0728f6ed1ae3952b072517 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/copyOption.ets @@ -0,0 +1,70 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct CopyOption { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CopyOption start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CopyOption end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Text("copyOption-InApp") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("InAppText") + .copyOption(CopyOption.InApp) + .visibility(Visibility.None) + + Text("copyOption-LocalDevice") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("LocalDeviceText") + .copyOption(CopyOption.LocalDevice) + .visibility(Visibility.None) + + }.width("100%").height("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/curves.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/curves.ets new file mode 100644 index 0000000000000000000000000000000000000000..234d01e3ec45155bc8677943cc80aeaa56545cc0 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/curves.ets @@ -0,0 +1,262 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct CurvesEaseOut { + @State widthSize: number = 400 + @State heightSize: number = 200 + @State flag: boolean = true + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CurvesEaseOut start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CurvesEaseOut end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("EaseOutText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, // 动画时长 + curve: Curve.EaseOut, // 动画曲线:以低速结束 + delay: 100, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Normal // 动画模式 + }) // 对Button组件的宽高属性进行动画配置 + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("EaseInOutText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.EaseInOut, //以低速开始和结束 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("FastOutSlowInText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.FastOutSlowIn, //标准曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("LinearOutSlowInText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.LinearOutSlowIn, //减速曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("FastOutLinearInText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.FastOutLinearIn, //加速曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("ExtremeDecelerationText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.ExtremeDeceleration, //急缓曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("SharpText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.Sharp, //锐利曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("RhythmText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.Rhythm, //节奏曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("SmoothText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.Smooth, //平滑曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("FrictionText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.Friction, //阻尼曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/datePicker.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/datePicker.ets new file mode 100644 index 0000000000000000000000000000000000000000..558b73166c484a252e8963d6c50b240ad480a15a --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/datePicker.ets @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct DatePickerLunar { + private selectedDate: Date = new Date('2021-08-08') + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear DatePickerLunar start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear DatePickerLunar end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("datePicker-Lunar") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("lunarText") + + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate, + }) + .key("DatePicker") + .lunar(true) + .onChange((date: DatePickerResult) => { + Log.showInfo(TAG, 'select current date is: ' + JSON.stringify(date)) + }) + + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate, + }) + .lunar(false) + .onChange((date: DatePickerResult) => { + Log.showInfo(TAG, 'select current date is: ' + JSON.stringify(date)) + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/edgeEffect.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/edgeEffect.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f5db39807d791c938aa184e7f61c75d86a97d38 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/edgeEffect.ets @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2021 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 events_emitter from '@ohos.events.emitter'; + +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct ListExample { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State edgeEffect: EdgeEffect = EdgeEffect.Fade + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Column() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%').height(100).fontSize(16) + .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) + }.editable(true) + }, item => item) + } + .key('list') + .listDirection(Axis.Vertical) // 排列方向 + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线 + .edgeEffect(this.edgeEffect) // 滑动到边缘无效果 + .chainAnimation(false) // 联动特效关闭 + .onScrollIndex((firstIndex: number, lastIndex: number) => { + console.info('first' + firstIndex) + console.info('last' + lastIndex) + }) + .onItemDelete((index: number) => { + console.info(this.arr[index] + 'Delete') + this.arr.splice(index, 1) + console.info(JSON.stringify(this.arr)) + return true + }).width('90%') + }.width('100%') + + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets new file mode 100644 index 0000000000000000000000000000000000000000..b29688e27b63b7ff4c5359666abc9f4350421d07 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets @@ -0,0 +1,624 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct EnumsCancel { + + @State widthSize: number = 200 + @State heightSize: number = 100 + @State flag: boolean = true + + @State state: AnimationStatus = AnimationStatus.Initial + @State reverse: boolean = false + @State iterations: number = 1 + + @State value: string = '' + @State text: string = '' + @State eventType: string = '' + + @State mouseText: string = 'MouseText' + + @Styles pressedStyles() { + .backgroundColor('red') + .opacity(1) + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear EnumsCancel start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear EnumsCancel end`) + } + + @State responseTypeClick: ResponseType = ResponseType.RightClick; + @State responseTypePress: ResponseType = ResponseType.LongPress; + @Builder ContextMenuBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('text3') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + Divider().height(10) + } + } + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("enums-Cancel") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("CancelText") + .visibility(Visibility.None) + + Text("enums-Middle") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("MiddleText") + .visibility(Visibility.None) + + Text("enums-Forward") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ForwardText") + .visibility(Visibility.None) + + Text("enums-Press") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("PressText") + .visibility(Visibility.None) + + Text("enums-EaseOut") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("EaseOutText") + .visibility(Visibility.None) + + Text("enums-EaseInOut") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("EaseInOutText") + .visibility(Visibility.None) + + Text("enums-FastOutSlowIn") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FastOutSlowInText") + .visibility(Visibility.None) + + Text("enums-LinearOutSlowIn") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("LinearOutSlowInText") + .visibility(Visibility.None) + + Text("enums-FastOutLinearIn") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FastOutLinearInText") + .visibility(Visibility.None) + + Text("enums-ExtremeDeceleration") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ExtremeDecelerationText") + .visibility(Visibility.None) + + Text("enums-Sharp") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("SharpText") + .visibility(Visibility.None) + + Text("enums-Rhythm") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("RhythmText") + .visibility(Visibility.None) + + Text("enums-Smooth") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("SmoothText") + .visibility(Visibility.None) + + Text("enums-Friction") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FrictionText") + .visibility(Visibility.None) + + Text("enums-Forwards") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ForwardsText") + .visibility(Visibility.None) + + Text("enums-Reverse") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ReverseText") + .visibility(Visibility.None) + + Text("enums-Alternate") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("AlternateText") + .visibility(Visibility.None) + + Text("enums-Keyboard") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("KeyboardText") + .visibility(Visibility.None) + + Text("enums-Middle") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("MiddleText") + .visibility(Visibility.None) + + Text("enums-Mon") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("MonText") + .visibility(Visibility.None) + + Text("enums-Thur") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ThurText") + .visibility(Visibility.None) + + Text("enums-Fri") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FriText") + .visibility(Visibility.None) + + Text("enums-Sat") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("SatText") + .visibility(Visibility.None) + + Text("enums-Fade") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FadeText") + .visibility(Visibility.None) + + Text("enums-FILL") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FILLText") + .visibility(Visibility.None) + + Text("enums-FIT") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FITText") + .visibility(Visibility.None) + + Text("enums-RightClick") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("RightClickText") + .bindContextMenu(this.ContextMenuBuilder(), this.responseTypeClick) + .visibility(Visibility.None) + + Text("enums-LongPress") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("LongPressText") + .bindContextMenu(this.ContextMenuBuilder(), this.responseTypePress) + .visibility(Visibility.None) + + Text("enums-Scale") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ScaleText") + .hoverEffect(HoverEffect.Scale) + .visibility(Visibility.None) + + Text("enums-Highlight") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("HighlightText") + .hoverEffect(HoverEffect.Highlight) + .visibility(Visibility.None) + + Text("enums-InApp") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("InAppText") + .copyOption(CopyOptions.InApp) + .visibility(Visibility.None) + + Text("enums-LocalDevice") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("LocalDeviceText") + .copyOption(CopyOptions.LocalDevice) + .visibility(Visibility.None) + Text("enums-CrossDevice") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("CrossDeviceText") + .copyOption(CopyOption.CrossDevice) + .visibility(Visibility.None) + + Button('Touch').backgroundColor(0x2788D9).height(40).width(80) + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Down) { + this.eventType = 'Down' + } + if (event.type === TouchType.Up) { + this.eventType = 'Up' + } + if (event.type === TouchType.Move) { + this.eventType = 'Move' + } + if (event.type === TouchType.Cancel) { + this.eventType = 'Cancel' + } + console.info(this.text = 'TouchType:' + this.eventType + '\nDistance between touch point and touch element:\nx: ' + + event.touches[0].x + '\n' + 'y: ' + event.touches[0].y + '\ncomponent globalPos:(' + + event.target.area.globalPosition.x + ',' + event.target.area.globalPosition.y + ')\nwidth:' + + event.target.area.width + '\nheight:' + event.target.area.height) + }) + Text(this.text) + + Button(this.mouseText) + .onMouse((event: MouseEvent) => { + if (MouseAction.Press || MouseButton.Middle) { + console.log(this.mouseText = 'onMouse:\nButton = ' + event.button + + '\nAction = ' + event.action + '\nlocalXY=(' + event.x + ',' + event.y + ')' + + '\nscreenXY=(' + event.screenX + ',' + event.screenY + ')') + } + else if (MouseAction.Press && MouseButton.Forward) { + console.log(this.mouseText = 'onMouse:\nButton = ' + event.button + + '\nAction = ' + event.action + '\nlocalXY=(' + event.x + ',' + event.y + ')' + + '\nscreenXY=(' + event.screenX + ',' + event.screenY + ')') + } + else if (MouseAction.Press) { + console.info("pressed") + } + }) + + Text("enums-FillMode") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FillModeText") + .visibility(Visibility.None) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/featureAbility.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/featureAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8c72d5fc13bbcf0075c450a36d218d66a037efb --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/featureAbility.ets @@ -0,0 +1,402 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct FeatureAbilityAbilityName { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear FeatureAbilityAbilityName start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear FeatureAbilityAbilityName end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("featureAbility-SubscribeMessageResponse-DeviceId") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeMessageResponseDeviceIdText") + .onClick(() => { + FeatureAbility.subscribeMsg({ + success: (data) => { + console.log(`deviceId: ${data.deviceId}`) + }, + fail: (data, code) => { + console.log(`data: ${data} code: ${code}`) + } + }) + }) + + Text("featureAbility-SubscribeMessageResponse-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeMessageResponseAbilityNameText") + .onClick(() => { + FeatureAbility.subscribeMsg({ + success: (data) => { + console.log(`deviceId: ${data.abilityName}`) + }, + fail: (data, code) => { + console.log(`data: ${data} code: ${code}`) + } + }) + }) + + Text("featureAbility-CallAbilityParam-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("callAbilityParamAbilityNameText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1001, + data: { + firstNum: 1024, + secondNum: 2048 + }, + abilityType: 0, + syncOption: 0 + }) + }) + + Text("featureAbility-CallAbilityParam-MessageCode") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("callAbilityParamMessageCodeText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1001, + data: { + firstNum: 1024, + secondNum: 2048 + }, + abilityType: 0, + syncOption: 0 + }) + }) + + Text("featureAbility-CallAbilityParam-AbilityType") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("callAbilityParamAbilityTypeText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1001, + data: { + firstNum: 1024, + secondNum: 2048 + }, + abilityType: 0, + syncOption: 0 + }) + }) + + Text("featureAbility-CallAbilityParam-SyncOption") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("callAbilityParamSyncOptionText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1001, + data: { + firstNum: 1024, + secondNum: 2048 + }, + abilityType: 0, + syncOption: 0 + }) + }) + + Text("featureAbility-SubscribeAbilityEventParam-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeAbilityEventParamAbilityNameText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1005, + abilityType: 0, + syncOption: 0 + }, (callbackData) => { + var callbackJson = JSON.parse(callbackData); + console.info('eventData is: ' + JSON.stringify(callbackJson.data)); + }) + }) + + Text("featureAbility-SubscribeAbilityEventParam-MessageCode") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeAbilityEventParammessageCodeText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1005, + abilityType: 0, + syncOption: 0 + }, (callbackData) => { + var callbackJson = JSON.parse(callbackData); + console.info('eventData is: ' + JSON.stringify(callbackJson.data)); + }) + }) + + Text("featureAbility-SubscribeAbilityEventParam-AbilityType") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeAbilityEventParamAbilityTypeText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1005, + abilityType: 0, + syncOption: 0 + }, (callbackData) => { + var callbackJson = JSON.parse(callbackData); + console.info('eventData is: ' + JSON.stringify(callbackJson.data)); + }) + }) + + Text("featureAbility-SubscribeAbilityEventParam-SyncOption") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeAbilityEventParamSyncOptionText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1005, + abilityType: 0, + syncOption: 0 + }, (callbackData) => { + var callbackJson = JSON.parse(callbackData); + console.info('eventData is: ' + JSON.stringify(callbackJson.data)); + }) + }) + + + Text("featureAbility-SendMessageOptions-DeviceId") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("sendMessageOptionsDeviceIdText") + .onClick(() => { + FeatureAbility.sendMsg({ + deviceId: '1001', + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility' + }) + }) + + Text("featureAbility-SendMessageOptions-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("sendMessageOptionsAbilityNameText") + .onClick(() => { + FeatureAbility.sendMsg({ + deviceId: '1001', + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility' + }) + }) + + Text("featureAbility-RequestParams-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("requestParamsAbilityNameText") + .onClick(() => { + FeatureAbility.startAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility' + }) + }) + + Text("featureAbility-Entities") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("entitiesText") + .onClick(() => { + FeatureAbility.startAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + entities: ["this is a test"] + }) + }) + + Text("featureAbility-DeviceType") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("deviceTypeText") + .onClick(() => { + FeatureAbility.startAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + deviceType: 1001 + }) + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/fill_mode.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/fill_mode.ets new file mode 100644 index 0000000000000000000000000000000000000000..57eb7a70fe83ea7156a4e2123d271fb4328eb83a --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/fill_mode.ets @@ -0,0 +1,111 @@ +/** + * Copyright (c) 2021 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct ImageAnimatorExample { + @State state: AnimationStatus = AnimationStatus.Initial + @State reverse: boolean = false + @State iterations: number = 1 + + build() { + Column({ space:5 }) { + ImageAnimator() + .images([ + { + src: '/comment/bg1.png', + duration: 500, + width: 325, + height: 200, + top: 0, + left: 0 + }, + { + src: '/comment/bg2.png', + duration: 500, + width: 325, + height: 200, + top: 0, + left: 0 + }, + { + src: $rawfile('bg3.png'), + duration: 500, + width: 325, + height: 200, + top: 0, + left: 0 + }, + { + src: $rawfile('bg4.png'), + duration: 500, + width: 325, + height: 200, + top: 0, + left: 0 + } + ]) + .key("ImageAnimator") + .state(this.state).reverse(this.reverse).fixedSize(false).preDecode(2) + .fillMode(FillMode.Forwards) + .iterations(this.iterations) + .width(325) + .height(210) + .margin({top:100}) + .onStart(() => { // 当帧动画开始播放后触发 + console.info('Start') + }) + .onPause(() => { + console.info('Pause') + }) + .onRepeat(() => { + console.info('Repeat') + }) + .onCancel(() => { + console.info('Cancel') + }) + .onFinish(() => { // 当帧动画播放完成后触发 + this.state = AnimationStatus.Stopped + console.info('Finish') + }) + Row() { + Button('start').width(100).padding(5).onClick(() => { + this.state = AnimationStatus.Running + }) + Button('pause').width(100).padding(5).onClick(() => { + this.state = AnimationStatus.Paused + }) + Button('stop').width(100).padding(5).onClick(() => { + this.state = AnimationStatus.Stopped + }) + } + Row() { + Button('reverse').width(100).padding(5).onClick(() => { + this.reverse = !this.reverse + }) + Button('once').width(100).padding(5).onClick(() => { + this.iterations = 1 + }) + Button('iteration').width(100).padding(5).onClick(() => { + this.iterations = -1 + }) + } + }.width('100%').height('100%').backgroundColor(0xF1F3F5) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gesture.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gesture.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9a951d76a3f39c623b4d91a6cc25428bab5697b --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gesture.ets @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct GestureParallel { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GestureParallel start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear GestureParallel end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("gesture-Parallel") + .width(320) + .height(120) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ParallelText") + .gesture( + GestureGroup(GestureMode.Parallel, + LongPressGesture({ repeat: true }) + .onAction((event: GestureEvent) => { + Log.showInfo(TAG, `LongPress onAction`) + }) + .onActionEnd(() => { + Log.showInfo(TAG, `LongPress end`) + }), + PanGesture({}) + .onActionStart(() => { + Log.showInfo(TAG, `onActionStart`) + }) + .onActionUpdate((event: GestureEvent) => { + Log.showInfo(TAG, `onActionUpdate`) + }) + ) + ) + + Text("gesture-Exclusive") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ExclusiveText") + .gesture( + GestureGroup(GestureMode.Exclusive, + LongPressGesture({ repeat: true }) + .onAction((event: GestureEvent) => { + Log.showInfo(TAG, `LongPress onAction`) + }) + .onActionEnd(() => { + Log.showInfo(TAG, `LongPress end`) + }), + PanGesture({}) + .onActionStart(() => { + Log.showInfo(TAG, `onActionStart`) + }) + .onActionUpdate((event: GestureEvent) => { + Log.showInfo(TAG, `onActionUpdate`) + }) + ) + ) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridCol.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridCol.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d949160c18b711c61c61d7e4a916ed052961342 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridCol.ets @@ -0,0 +1,96 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct GridColXl { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GridColXl start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GridColXl end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + GridRow(){ + GridCol({ span: { xl: 2 } }){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol({ span: { xl: 2 } }){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("xlText") + + GridRow(){ + GridCol({ span: { xxl: 2 } }){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol({ span: { xxl: 2 } }){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("xxlText") + + GridRow(){ + GridCol({ span: { xl: 2 } }){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .key("GridCol") + .order({xl: 10}) + .backgroundColor(Color.Green) + GridCol({ span: { xl: 2 } }){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .order(10) + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("orderText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridRow.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridRow.ets new file mode 100644 index 0000000000000000000000000000000000000000..95ca6fdfff9a6a4c6ff8b87e5939b26a01a9af53 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridRow.ets @@ -0,0 +1,186 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct GridRowXl { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GridRowXl start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GridRowXl end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + + GridRow({columns: {xl: 2}}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + } + .backgroundColor(Color.Red) + .key("GridRowColumnOption——xl") + + GridRow({columns: {xxl: 2}}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("GridRowColumnOption——xxl") + + GridRow({gutter:{x: {xl: 2}}}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("GridRowSizeOption——xl") + + GridRow({gutter:{x: {xxl: 2}}}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("GridRowSizeOption——xxl") + + GridRow({breakpoints: { reference: BreakpointsReference.WindowSize }}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("WindowSizeText") + + GridRow({breakpoints: { reference: BreakpointsReference.ComponentSize }}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("ComponentSizeText") + + GridRow({breakpoints: { reference: BreakpointsReference.ComponentSize }}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("referenceText") + + GridRow({breakpoints: { reference: BreakpointsReference.ComponentSize }}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("breakpointsText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hoverEffect.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hoverEffect.ets new file mode 100644 index 0000000000000000000000000000000000000000..28aec9fabce9ad5b8b24d2c43e1c07731f301683 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hoverEffect.ets @@ -0,0 +1,70 @@ +//@ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct HoverEffect { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear HoverEffect start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear HoverEffect end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Text("hoverEffect-Scale") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ScaleText") + .hoverEffect(HoverEffect.Scale) + .visibility(Visibility.None) + + Text("hoverEffect-Highlight") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("HighlightText") + .hoverEffect(HoverEffect.Highlight) + .visibility(Visibility.None) + + }.width("100%").height("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/index.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a6b007e1fd812f435b9a4df440d690df9524363 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ace AttrLack ets test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/keysource.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/keysource.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe91c2bb2cdb3b7c76d12949f5229ad33648cdff --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/keysource.ets @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct KeyEventExample { + @State text: string = '' + @State eventType: string = '' + + build() { + Column() { + Button('KeyEvent').backgroundColor(0x2788D9) + .onKeyEvent((event: KeyEvent) => { + if (event.type === KeyType.Down) { + this.eventType = 'Down' + } + if (event.type === KeyType.Up) { + this.eventType = 'Up' + } + console.info(this.text = 'KeyType:' + this.eventType + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText + + '\nKeyboard:' + event.keySource.Keyboard) + }) + Text(this.text).padding(15) + }.height(300).width('100%').padding(35) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/listtest.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/listtest.ets new file mode 100644 index 0000000000000000000000000000000000000000..855f724d58c2232b0e21fe189e8a4f124969b648 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/listtest.ets @@ -0,0 +1,149 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ListIdle { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State editFlag: boolean = false + private scroller: Scroller = new Scroller() + @State onScroll: boolean = false + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ListIdle start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ListIdle end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("list-Idle") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("IdleText") + + Text("list-Scroll") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ScrollText") + + Text("list-Fling") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("FlingText") + + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%').height(100).fontSize(16) + .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) + }.editable(true) + }, item => item) + + } + .editMode(true) + .key("ScrollList") + .listDirection(Axis.Vertical) // 排列方向 + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线 + .edgeEffect(EdgeEffect.None) // 滑动到边缘无效果 + .chainAnimation(false) // 联动特效关闭 + .onScroll((scrollOffset: 5, scrollState:ScrollState) => { + console.info('scrollOffset' + scrollOffset) + console.info('scrollState ' + scrollState) + }) + .onClick(()=>{ + try { + var backData = { + data: { + "State": this.onScroll + } + } + let backEvent = { + eventId: 60303, + priority: events_emitter.EventPriority.LOW + } + console.info("Scroll start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Scroll emit action state err: " + JSON.stringify(err.message)) + } + try { + this.scroller.scrollPage({ next: true }) + this.onScroll = true + } catch (err) { + console.info("Scroll emit action state err: " + JSON.stringify(err.message)) + } + }) + } + .scrollable(ScrollDirection.Vertical) + .scrollBar(BarState.On) + .scrollBarColor(Color.Gray) + .scrollBarWidth(30) + .onScroll((xOffset: number, yOffset: number) => { + console.info(xOffset + ' ' + yOffset) + }) + .onScrollEdge((side: Edge) => { + console.info('To the edge') + }) + .onScrollEnd(() => { + console.info('Scroll Stop') + }) + } + }.width("100%").height("100%") + + + + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/loadingProgress.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/loadingProgress.ets new file mode 100644 index 0000000000000000000000000000000000000000..1353d00b78f82b9957c54f1afb626110fc8a6802 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/loadingProgress.ets @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct LoadingProgressCircular { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear LoadingProgressCircular start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear LoadingProgressCircular end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("loadingProgress-Circular") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("CircularText") + + Text("loadingProgress-Orbital") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("OrbitalText") + + Text('Orbital LoadingProgress ').fontSize(9).fontColor(0xCCCCCC).width('100%') + LoadingProgress() + .color(Color.Blue) + }.width("100%").height("100%") + } +} + + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/onFrame.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/onFrame.ets new file mode 100644 index 0000000000000000000000000000000000000000..4fd2052f3a1e7cc3d4da105fe2aebf2641b7cdc3 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/onFrame.ets @@ -0,0 +1,126 @@ +/** + * Copyright (c) 2021 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 animator from '@ohos.animator'; +import prompt from '@system.prompt'; + +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct ColumnExample { + @State divWidth: number = 120; + @State divHeight: number = 120; + @State animation: AnimatorResult = animator.createAnimator({ + duration: 3000, + fill: 'forwards', + direction: "normal", + begin: 200, + end: 270 + }); + + onPageShow() { + this.animation.onrepeat(() => { + var repeatoptions = { + duration: 2000, + iterations: 1, + direction: 'alternate', + begin: 180, + end: 240 + }; + this.animation.update(repeatoptions); + this.animation.play(); + }); + } + + playAnimation() { + var _this = this; + this.animation.onframe = function(value) { + _this.translateVal= value + }; + this.animation.play(); + } + + build() { + Column() { + Column() { + Column() { + Column().width(this.divWidth).height(this.divHeight).backgroundColor(0xAFEEEE) + }.width('100%') + }.width('100%').padding({ top: 5 }) + + Column() { + Row() { + Button('play') + .borderRadius(8) + .backgroundColor(0x317aff) + .width(90) + .key("button1") + .onClick(() => { + this.animation.onframe((value) => { + this.divWidth = value + this.divHeight = value + }); + this.animation.play(); + }); + Button('update').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + var newoptions = { + duration: 5000, + iterations: 2, + begin: 120, + end: 180 + }; + this.animation.update(newoptions); + this.animation.play(); + }); + }.margin({ top: 5 }) + + Row() { + Button('pause').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.pause(); + }); + Button('finish').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.onfinish(() => { + prompt.showToast({ + message: 'finish' + }) + }); + this.animation.finish(); + }); + }.margin({ top: 5 }) + + Row() { + Button('cancel').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.cancel(); + }); + Button('reverse').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.reverse(); + }); + }.margin({ top: 5 }) + + Row() { + Button('onframe') + .key("button1") + .borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.playAnimation() + }); + }.margin({ top: 5 }) + }.margin({ top: 30 }) + } + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page1.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page1.ets new file mode 100644 index 0000000000000000000000000000000000000000..0a3cea52a5108a0fc35925c3a4cb32a0c945e651 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page1.ets @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2021 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. + */ + +//在second页面中接收传递过来的参数 +import router from '@ohos.router' +import events_emitter from '@ohos.events.emitter'; +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct Second { + private content: string = "这是第二页" + @State text: string = router.getParams()['text'] + @State data: any = router.getParams()['data'] + @State secondData : string = '' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text(this.text) + .fontSize(30) + .key("DataText") + .onClick(()=>{ + this.secondData = (this.data.array[1]).toString() + try { + var backData = { + data: { + "ArrayData": this.secondData + } + } + let backEvent = { + eventId: 101, + priority: events_emitter.EventPriority.LOW + } + console.info("page1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("page1 emit action state err: " + JSON.stringify(err.message)) + } + }) + .margin({top:20}) + Text('第一页传来的数值是' + ' ' + this.secondData) + .fontSize(20) + .margin({top:20}) + .backgroundColor('red') + } + .width('100%') + .height('100%') + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets new file mode 100644 index 0000000000000000000000000000000000000000..72be9f5739354996e17186ec6e5f5c39066165c9 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2021 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. + */ + +//在second页面中接收传递过来的参数 +import router from '@ohos.router' +import events_emitter from '@ohos.events.emitter'; +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct Second { + private content: string = "这是第二页" + @State text: string = router.getParams()['text'] + @State data: any = router.getParams()['data'] + @State secondData : string = '' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text(this.text) + .fontSize(30) + .key("SingleDataText") + .onClick(()=>{ + this.secondData = (this.data.array[1]).toString() + try { + var backData = { + data: { + "ArrayData": this.secondData + } + } + let backEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + console.info("page1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("page1 emit action state err: " + JSON.stringify(err.message)) + } + }) + .margin({top:20}) + Text('第一页传来的数值是' + ' ' + this.secondData) + .fontSize(20) + .margin({top:20}) + .backgroundColor('red') + } + .width('100%') + .height('100%') + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/progress.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/progress.ets new file mode 100644 index 0000000000000000000000000000000000000000..057015c5faab833b68bed41a12e1239b78896771 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/progress.ets @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ProgressScaleCount { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ProgressScaleCount start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ProgressScaleCount end`) + } + + build() { + Column({ space: 15 }) { + Text('Linear Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Progress({ value: 10, type: ProgressType.Linear }).width(200) + Progress({ value: 20, total: 150, type: ProgressType.Linear }).color(Color.Grey).value(50).width(200) + + Text('Eclipse Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Row({ space: 40 }) { + Progress({ value: 10, type: ProgressType.Eclipse }).width(100) + Progress({ value: 20, total: 150, type: ProgressType.Eclipse }).color(Color.Grey).value(50).width(100) + } + + Text('ScaleRing Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Row({ space: 40 }) { + Progress({ value: 10, type: ProgressType.ScaleRing }).width(100) + Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }) + .key("progressStyleOptions") + .color(Color.Grey).value(50).width(100) + .style({ strokeWidth: 15, scaleCount: 15, scaleWidth: 5 }) + } + + Text('Ring Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Row({ space: 40 }) { + Progress({ value: 10, type: ProgressType.Ring }).width(100) + Progress({ value: 20, total: 150, type: ProgressType.Ring }) + .color(Color.Grey).value(50).width(100) + .style({ strokeWidth: 20, scaleCount: 30, scaleWidth: 20 }) + } + + Text('Capsule Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Row({ space: 40 }) { + Progress({ value: 10, type: ProgressType.Capsule }).width(100).height(50) + Progress({ value: 20, total: 150, type: ProgressType.Capsule }) + .color(Color.Grey) + .value(50) + .width(100) + .height(50) + } + }.width('100%').margin({ top: 30 }) + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/radio.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/radio.ets new file mode 100644 index 0000000000000000000000000000000000000000..17dab9a83e3135e812e619ac82a7563bfcea7d1e --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/radio.ets @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct RadioGroup { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear RadioGroup start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear RadioGroup end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("radio-Group") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("groupText") + + Radio({ value: 'Radio1', group: 'radioGroup' }) + .checked(true) + .key("RadioOne") + .height(50) + .width(50) + .onChange((value: boolean) => { + console.log('Radio1 status is ' + value) + }) + Radio({ value: 'Radio2', group: 'radioGroup' }) + .checked(false) + .key("RadioTwo") + .height(50) + .width(50) + .onChange((value: boolean) => { + console.log('Radio2 status is ' + value) + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/refresh.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/refresh.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec2dc2d18dc842443660667e2636661e94cc71fa --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/refresh.ets @@ -0,0 +1,126 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +import Utils from '../common/Utils.ets'; +import events_emitter from '@ohos.events.emitter'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct RefreshDrag { + dragRefresh() { + var rect = Utils.getComponentRect("Refresh") + Utils.drag(rect["left"],rect["top"],rect["right"],rect["bottom"],20) + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear RefreshDrag start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear RefreshDrag end`) + } + + @State isRefreshing: boolean = false + @State counter: number = 0 + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("refresh-Drag") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("DragText") + + Text("refresh-Refresh") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("RefreshText") + + + Refresh({refreshing: this.isRefreshing, offset: 120, friction: 100}) { + Text('Pull Down and refresh: ' + this.counter) + .fontSize(30) + .margin(10) + } + .key("Refresh") + .onClick(()=>{ + this.dragRefresh() + }) + .onStateChange((refreshStatus: RefreshStatus) => { + console.info('Refresh onStatueChange state is ' + refreshStatus) + try { + var backDataTwo = { + data: { + "Result": true + } + } + let backEventTwo = { + eventId: 60305, + priority: events_emitter.EventPriority.LOW + } + console.info("Refresh start to emit action state") + events_emitter.emit(backEventTwo, backDataTwo) + } catch (err) { + console.info("Refresh emit action state err: " + JSON.stringify(err.message)) + } + }) + .onRefreshing(() => { + setTimeout(() => { + this.counter++ + this.isRefreshing = false + }, 1000) + console.log('onRefreshing test') + try { + var backData = { + data: { + "Result": true + } + } + let backEvent = { + eventId: 60304, + priority: events_emitter.EventPriority.LOW + } + console.info("Drag start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Drag emit action state err: " + JSON.stringify(err.message)) + } + }) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/remoteWindow.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/remoteWindow.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d1fae1d35d873433cf92093dc480f6d9a00c3f6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/remoteWindow.ets @@ -0,0 +1,61 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct FormComponentFormDimension { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Dimension start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear Dimension end`) + } + + build() { + Row() { + Column({ space: 10 }) { + Text("formComponent-FormDimension-WindowBounds") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("formComponentFormDimensionWindowBoundsText") + + RemoteWindow(this.target) + .translate({ x: 100, y: 200 }) + .scale({ x: 0.5, y: 0.5 }) + .opacity(0.8) + .position({ x: px2vp(this.target?.windowBounds.left), y: px2vp(this.target?.windowBounds.top) }) + .width(px2vp(this.target?.windowBounds.width)) + .height(px2vp(this.target?.windowBounds.height)) + + } + .width('100%') + } + .height('100%') + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/responseType.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/responseType.ets new file mode 100644 index 0000000000000000000000000000000000000000..d892d7305c9042220d1d901320a68efc3e07e0f1 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/responseType.ets @@ -0,0 +1,88 @@ +//@ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ResponseType { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ResponseType start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ResponseType end`) + } + + @Builder ContextMenuBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('text3') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + Divider().height(10) + } +} + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Text("responseType-RightClick") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("RightClickText") + .bindContextMenu(this.ContextMenuBuilder(), ResponseType.RightClick) + .visibility(Visibility.None) + + Text("responseType-LongPress") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("LongPressText") + .bindContextMenu(this.ContextMenuBuilder(), ResponseType.LongPress) + .visibility(Visibility.None) + + Column() { + Text('rightclick for menu') + } + .key("TestColumn") + .width('100%') + .margin({ top: 5 }) + .bindContextMenu(this.MenuBuilder, ResponseType.RightClick) + + }.width("100%").height("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/router.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/router.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb1ee208787174f03a7fd6604461e9ed06daefbb --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/router.ets @@ -0,0 +1,126 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@ohos.router' +import uiAppearance from '@ohos.uiAppearance'; + +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct RouterStandard { + + + async routePage() { + let options = { + url: 'pages/page1', + params: { + text: '这是第一页的值', + data: { + array: [12, 45, 78] + } + } + } + try { + await router.push(options,router.RouterMode.Standard) + } catch (err) { + console.info(`Standard Page fail callback, code: ${err.code}, msg: ${err.msg}`) + } + } + + async routeSinglePage() { + let options = { + url: 'pages/page2', + params: { + text: '这是第二页的值', + data: { + array: [13, 46, 79] + } + } + } + try { + await router.push(options,router.RouterMode.Single) + } catch (err) { + console.info(`Single Page fail callback, code: ${err.code}, msg: ${err.msg}`) + } + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear RouterStandard start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear RouterStandard end`) + } + + build(){ + + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("router-Standard") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("StandardText") + .onClick(() => { + this.routePage() + }) + + Text("router-Single") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("SingleText") + .onClick(() => { + this.routeSinglePage() + }) + + Text('这是第一页') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ top: 20 }) + .backgroundColor('#ccc') + .onClick(() => { + this.routePage() + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/scroll_edge.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/scroll_edge.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b9cc0077bf0b50a1bbcbb1ee5693b5b790796f4 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/scroll_edge.ets @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2021 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 Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item) => { + Text(item.toString()) + .width('90%').height(150).backgroundColor(0xFFFFFF) + .borderRadius(15).fontSize(16).textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, item => item) + }.width('100%') + } + .scrollable(ScrollDirection.Vertical).scrollBar(BarState.On) + .scrollBarColor(Color.Gray).scrollBarWidth(30) + .onScroll((xOffset: number, yOffset: number) => { + console.info(xOffset + ' ' + yOffset) + }) + .onScrollEdge((side: Edge) => { + console.info('To the edge') + }) + .onScrollEnd(() => { + console.info('Scroll Stop') + }) + Button('back Middle') + .key("MiddleText") + .onClick(() => { // 点击后回到顶部 + this.scroller.scrollEdge(Edge.Middle) + var result=(this.scroller.scrollEdge(Edge.Middle)!=null) + try { + var backData = { + data: { + "STATUS": result + } + } + let backEvent = { + eventId: 60306, + priority: events_emitter.EventPriority.LOW + } + console.info("onRequestPopupData start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onRequestPopupData emit action state err: " + JSON.stringify(err.message)) + } + }) + .margin({ top: 60, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/sidebar.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/sidebar.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee12737a8ebfd56821557a7c18158461ddb14b04 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/sidebar.ets @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct SidebarIcons { + @State arr: number[] = [1, 2] + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SidebarIcons start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear SidebarIcons end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("sidebar-Icons") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("iconsText") + + SideBarContainer(SideBarContainerType.Embed) { + Column() { + ForEach(this.arr, (item, index) => { + Column({ space: 5 }) { + Text("Index0" + item) + .fontSize(20) + } + }, item => item) + }.width('100%') + .justifyContent(FlexAlign.SpaceEvenly) + .backgroundColor('#19000000') + + RowSplit() { + Column() { + Text('Split page').fontSize(30) + } + }.width('100%') + } + .key("SideBarContainer") + .sideBarWidth(240) + .minSideBarWidth(210) + .maxSideBarWidth(260) + .controlButton({ + icons: { + shown: $r("app.media.icon"), + hidden: $r("app.media.icon") + } + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/slider.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/slider.ets new file mode 100644 index 0000000000000000000000000000000000000000..91ee60b8f6021dd6fe2092cd04cc4a78df660df5 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/slider.ets @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +import Utils from '../common/Utils.ets'; +import events_emitter from '@ohos.events.emitter'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct SliderMoving { + @State outSetValue: number = 40 + slide() { + var rect = Utils.getComponentRect("Slider") + Utils.drag(rect["left"],rect["top"],rect["right"],rect["bottom"],20) + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SliderMoving start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear SliderMoving end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("slider-Moving") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("MovingText") + + Slider({ + value: this.outSetValue, + min: 0, + max: 100, + step: 1, + style: SliderStyle.OutSet + }) + .key("Slider") + .blockColor(Color.Blue) + .trackColor(Color.Gray) + .selectedColor(Color.Blue) + .showSteps(true) + .showTips(true) + .onChange((value: number, mode: SliderChangeMode) => { + Log.showInfo(TAG, 'SliderChangeMode.Moving: ' + SliderChangeMode.Moving.toString()) + Log.showInfo(TAG, 'value:' + value + 'mode:' + mode.toString()) + try { + var backData = { + data: { + "Mode": (mode==0)||(mode==1)||(mode==2) + } + } + let backEvent = { + eventId: 60307, + priority: events_emitter.EventPriority.LOW + } + console.info("Slider start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Slider emit action state err: " + JSON.stringify(err.message)) + } + }) + .onClick(() => { + this.slide() + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stateManagement.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stateManagement.ets new file mode 100644 index 0000000000000000000000000000000000000000..99b385c0257c5ba609512300c0c9e82660c2fb4c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stateManagement.ets @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct StateManagementDARK { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear StateManagementDARK start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear StateManagementDARK end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("stateManagement-DARK") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .backgroundColor(ColorMode.DARK) + .key("DARKText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stepperItem.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stepperItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd55e9512f41c981ed88e5afa95b48759aed4c42 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stepperItem.ets @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct StepperItemDisabled { + @State currentIndex: number = 0 + @State firstState: ItemState = ItemState.Normal + @State secondState: ItemState = ItemState.Normal + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear StepperItemDisabled start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear StepperItemDisabled end`) + } + + build() { + Row() { + Column({ space: 10 }) { + Text('message') + .fontSize(50) + .fontWeight(FontWeight.Bold) + + Stepper({ + index: this.currentIndex + }) { + StepperItem() { + Text('Page One') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({ top: 250 }) + } + .nextLabel('') + .position({ x: '35%', y: 0 }) + + StepperItem() { + Text('Page Two') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({ top: 250 }) + .onClick(() => { + this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip + }) + } + .key("StepperItem") + .nextLabel('Finish') + .prevLabel('Previous') + .status(this.firstState) + .position({ x: '35%', y: 0 }) + .status(ItemState.Disabled) + } + .onFinish(() => { + Log.showInfo(TAG, 'onFinish') + }) + .onSkip(() => { + Log.showInfo(TAG, 'onSkip') + }) + .onChange((prevIndex: number, index: number) => { + this.currentIndex = index + }) + .align(Alignment.Center) + .height('50%') + + } + .width('100%') + } + .height('100%') + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/swiper.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/swiper.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d10b8c60f11e1aa62ebb2be98210fcc8d9b7de2 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/swiper.ets @@ -0,0 +1,112 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct SwiperMask { + private swiperController: SwiperController = new SwiperController() + private data: MyDataSource = new MyDataSource([]) + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SwiperMask start`) + let list = [] + for (var i = 1; i <= 5; i++) { + list.push(i.toString()); + } + this.data = new MyDataSource(list) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear SwiperMask end`) + } + + build() { + Row() { + Column({ space: 10 }) { + Text("swiper-Mask") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("maskText") + + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item) + .width('90%') + .height(160) + .backgroundColor(0xAFEEEE) + .textAlign(TextAlign.Center) + .fontSize(20) + }, item => item) + } + .cachedCount(2) + .index(1) + .autoPlay(true) + .interval(4000) + .indicator(true) // 默认开启指示点 + .loop(false) // 默认开启循环播放 + .duration(1000) + .vertical(false) // 默认横向切换 + .itemSpace(0) + .curve(Curve.Linear) // 动画曲线 + .key("maskSwiper") + .indicatorStyle({ + mask: false + }) + + } + .width('100%') + } + .height('100%') + } +} + + +class MyDataSource implements IDataSource { + private list: number[] = [] + private listener: DataChangeListener + + constructor(list: number[]) { + this.list = list + } + + totalCount(): number { + return this.list.length + } + + getData(index: number): any { + return this.list[index] + } + + registerDataChangeListener(listener: DataChangeListener): void { + this.listener = listener + } + + unregisterDataChangeListener() { + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/text_input.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/text_input.ets new file mode 100644 index 0000000000000000000000000000000000000000..784b28a6ac75430bff4980a1c64e40f8052bbab6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/text_input.ets @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct Text_inputPhoneNumber { + @State text: string = '' + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Text_inputPhoneNumber start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear Text_inputPhoneNumber end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + TextInput({ placeholder: 'input your word' }) + .key("PhoneNumberText") + .placeholderColor("rgb(0,0,225)") + .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic }) + .caretColor(Color.Blue) + .height(50) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .fontFamily("sans-serif") + .fontStyle(FontStyle.Normal) + .fontColor(Color.Red) + .type(InputType.PhoneNumber) + .onChange((value: string) => { + this.text = value + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/uiAppearance.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/uiAppearance.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e5c60eb237ba6e725483fa5b7ca26bab1b19cf0 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/uiAppearance.ets @@ -0,0 +1,113 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 uiAppearance from '@ohos.uiAppearance'; +import Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; + +const TAG = 'ets_apiLack_add'; +uiAppearance.DarkMode.ALWAYS_DARK + +@Entry +@Component +export default +struct UiAppearanceALWAYS_DARK { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear UiAppearanceALWAYS_DARK start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear UiAppearanceALWAYS_DARK end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("uiAppearance-ALWAYS_DARK") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ALWAYS_DARKText") + .onClick(()=>{ + uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (err) => { + console.info(`${err}`); + }) + let darkMode = uiAppearance.getDarkMode(); + try{ + var backData = { + data: { + "Mode": darkMode + } + } + let backEvent = { + eventId: 60308, + priority: events_emitter.EventPriority.LOW + } + console.info("AlwaysDark start to emit action state") + events_emitter.emit(backEvent, backData) + } catch(err) { + console.info("AlwaysDark emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("uiAppearance-ALWAYS_LIGHT") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ALWAYS_LIGHTText") + .onClick(()=>{ + uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT, (err) => { + console.info(`${err}`); + }) + let darkMode = uiAppearance.getDarkMode(); + try{ + var backData = { + data: { + "Mode": darkMode + } + } + let backEvent = { + eventId: 60309, + priority: events_emitter.EventPriority.LOW + } + console.info("AlwaysLight start to emit action state") + events_emitter.emit(backEvent, backData) + } catch(err) { + console.info("AlwaysLight emit action state err: " + JSON.stringify(err.message)) + } + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/units.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/units.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c0c963569e156b6c8de078ac3791bf08ca14d98 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/units.ets @@ -0,0 +1,178 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct UnitsModuleName { + @State textHeight: number = 50 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear UnitsModuleName start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear UnitsModuleName end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("units-ModuleName") + .width(320) + .height(this.textHeight) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("moduleNameText") + .onClick(() => { + console.log($r('app.string.MainAbility_label').bundleName) + try { + var backData = { + data: { + "ModuleName": ($r('app.string.MainAbility_label').bundleName != null) + } + } + let backEvent = { + eventId: 60310, + priority: events_emitter.EventPriority.LOW + } + console.info("ModuleName start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("ModuleName emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("units-GlobalPosition") + .width(320) + .height(this.textHeight) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("globalPositionText") + .onClick(() => { + this.textHeight = 100 + }) + .onAreaChange((oldValue: Area, newValue: Area) => { + console.info(`oldValue.globalPosition: ${JSON.stringify(oldValue.globalPosition)}`) + console.info(`newValue.globalPosition: ${JSON.stringify(newValue.globalPosition)}`) + try { + var backData = { + data: { + "Result": true + } + } + let backEvent = { + eventId: 60311, + priority: events_emitter.EventPriority.LOW + } + console.info("GlobalPosition start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("GlobalPosition emit action state err: " + JSON.stringify(err.message)) + } + }) + + + Text("units-MinWidth") + .width(100) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("minWidthText") + .constraintSize({ + minWidth: 200 + }) + + Text("units-MaxWidth") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("maxWidthText") + .constraintSize({ + maxWidth: 200 + }) + + Text("units-MinHeight") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("minHeightText") + + .constraintSize({ + minHeight: 100 + }) + + Text("units-MaxHeight") + .width(320) + .height(200) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("maxHeightText") + .constraintSize({ + maxHeight: 100 + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/web.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/web.ets new file mode 100644 index 0000000000000000000000000000000000000000..b48af9231b452ac0d80c24792acc7ad449993de5 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/web.ets @@ -0,0 +1,100 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct WebEditText { + controller: WebController = new WebController(); + webResourceResponse: WebResourceResponse = new WebResourceResponse(); + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear WebEditText start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear WebEditText end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Web({ src:'www.baidu.com', controller:this.controller }) + .javaScriptAccess(true) + .height(500) + .padding(20) + .blur(2) + .fileFromUrlAccess(true) + .initialScale(2) + .webDebuggingAccess(true) + .onRenderExited((event) => { + console.info('onRenderExited getAcceptType: ', event.renderExitReason); + }) + .onShowFileSelector((event) => { + console.info('onShowFileSelector getAcceptType: ', event.fileSelector.getAcceptType()); + console.info('onShowFileSelector getTitle: ', event.fileSelector.getTitle()); + console.info('onShowFileSelector getMode: ', event.fileSelector.getMode()); + console.info('onShowFileSelector isCapture: ', event.fileSelector.isCapture()); + event.result.handleFileList(["D:\DevEcoStudioProjects","D:\DevEcoStudioProjects"]) + return true; + }) + .onInterceptRequest((event) => { + console.info('onInterceptRequest getRequestUrl: ', event.request.getRequestUrl()); + console.info('onInterceptRequest isMainFrame: ', event.request.isMainFrame()); + console.info('onInterceptRequest isRedirect: ', event.request.isRedirect()); + console.info('onInterceptRequest isRequestGesture: ', event.request.isRequestGesture()); + let result = event.request.getRequestHeader(); + console.log('The request header result size is ' + result.length); + for (let i of result) { + console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + return this.webResourceResponse; + }) + .onPermissionRequest((event) => { + AlertDialog.show({ + title: 'title', + message: 'text', + confirm: { + value: 'onConfirm', + action: () => { + event.request.grant(event.request.getAccessibleResource()); + } + }, + cancel: () => { + event.request.deny(); + } + }) + }) + .onHttpErrorReceive((event) => { + console.log('setResponseHeader:' + event.response.setResponseHeader([])); + console.log('web getExtra:' + this.controller.getHitTestValue().getExtra()); + console.log('web getType:' + this.controller.getHitTestValue().getType()); + let result = event.request.getRequestHeader(); + console.log('The request header result size is ' + result.length); + for (let i of result) { + console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + let resph = event.response.getResponseHeader(); + console.log('The response header result size is ' + resph.length); + for (let i of resph) { + console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + }) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/app.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b29cb8048a4edbca5f8fbc6197c0fb227c00f64 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/pages/index.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d0efe0a85177331cccf9524a7cd747c966dcbe5 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 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 router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..07cb0b784984c6c4cc6d911c3c82643bff9df263 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..45ccbfd3369b972d510145699d07a49c42414845 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 animatorOnframeJsunit from './animator.test.ets'; +import curvesEaseOutJsunit from './curves.test.ets'; +import routerStandardJsunit from './router.test.ets'; +import uiAppearanceALWAYS_DARKJsunit from './uiAppearance.test.ets'; +import appVersionCodeJsunit from './app.test.ets'; +import alertDialogCenterStartJsunit from './alertDialog.test.ets'; +import canvasActualBoundingBoxAscentJsunit from './canvas.test.ets'; +import checkBoxGroupJsunit from './checkBox.test.ets'; +import checkBoxGroupPartJsunit from './checkBoxGroup.test.ets'; +import commonColorModeJsunit from './common.test.ets'; +import datePickerLunarJsunit from './datePicker.test.ets'; +import enumsCancelJsunit from './enums.test.ets'; +import gestureParallelJsunit from './gesture.test.ets'; +import listtestIdleJsunit from './listtest.test.ets'; +import loadingProgressCircularJsunit from './loadingProgress.test.ets'; +import progressScaleCountJsunit from './progress.test.ets'; +import radioGroupJsunit from './radio.test.ets'; +import refreshDragJsunit from './refresh.test.ets'; +import sidebarIconsJsunit from './sidebar.test.ets'; +import sliderMovingJsunit from './slider.test.ets'; +import stateManagementDARKJsunit from './stateManagement.test.ets'; +import stepperItemDisabledJsunit from './stepperItem.test.ets'; +import swiperMaskJsunit from './swiper.test.ets'; +import text_inputPhoneNumberJsunit from './text_input.test.ets'; +import unitsModuleNameJsunit from './units.test.ets'; +import webEditTextJsunit from './web.test.ets'; +import hoverEffectJsunit from './hoverEffect.test.ets'; +import responseTypeJsunit from './responseType.test.ets'; +import copyOptionJsunit from './copyOption.test.ets'; + +export default function testsuite() { + animatorOnframeJsunit() + curvesEaseOutJsunit() + routerStandardJsunit() + uiAppearanceALWAYS_DARKJsunit() + appVersionCodeJsunit() + alertDialogCenterStartJsunit() + canvasActualBoundingBoxAscentJsunit() + checkBoxGroupJsunit() + checkBoxGroupPartJsunit() + commonColorModeJsunit() + datePickerLunarJsunit() + enumsCancelJsunit() + gestureParallelJsunit() + listtestIdleJsunit() + loadingProgressCircularJsunit() + progressScaleCountJsunit() + radioGroupJsunit() + refreshDragJsunit() + sidebarIconsJsunit() + sliderMovingJsunit() + stateManagementDARKJsunit() + stepperItemDisabledJsunit() + swiperMaskJsunit() + text_inputPhoneNumberJsunit() + unitsModuleNameJsunit() + webEditTextJsunit() + hoverEffectJsunit() + responseTypeJsunit() + copyOptionJsunit() +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/Utils.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa94fe4f7e0a3a0c066b9141e118b2229c839a96 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * Copyright (c) 2021 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) { + var xStep; + var yStep; + var swipeSteps; + var 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) + var 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 (var i = 1;i <= swipeSteps; i++) { + var 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) + } + var 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) + } +} + + + + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/alertDialog.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/alertDialog.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2dca5c993afa6b9decc1dc0db4699970d56234dd --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/alertDialog.test.ets @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function alertDialogCenterStartJsunit() { + describe('alertDialogCenterStartTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/alertDialog', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get alertDialog state success " + JSON.stringify(pages)); + if (!("alertDialog" == pages.name)) { + console.info("get alertDialog state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push alertDialog page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push alertDialog page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("alertDialogCenterStart after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testalertDialogCenterStart0001 + * @tc.desic acealertDialogCenterStartEtsTest0001 + */ + it('testalertDialogCenterStart0001', 0, async function (done) { + console.info('alertDialogCenterStart testalertDialogCenterStart0011 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 81601, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testalertDialogCenterStart0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(true); + console.info('testalertDialogCenterStart0011 END'); + done(); + } + console.info("testalertDialogCenterStart0001 click result is: " + JSON.stringify(sendEventByKey('CenterStartButton', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testalertDialogCenterStart0001 on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animate_play_mode.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animate_play_mode.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d27f16274cc72bd705cd0bb66f060d9b8ec2a661 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animate_play_mode.test.ets @@ -0,0 +1,94 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +export default function playModeReverseJsunit() { + describe('playModeReverseTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/animate_play_mode', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get animate_play_mode state success " + JSON.stringify(pages)); + if (!("PlayModeReverse" == pages.name)) { + console.info("get animate_play_mode state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push animate_play_mode page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push animate_play_mode page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("playModeReverse after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testPlayModeReverse0001 + * @tc.desic acePlayModeReverseEtsTest0001 + */ + it('testPlayModeReverse0001', 0, async function (done) { + console.info('PlayModeReverse testPlayModeReverse0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Reverse'); + console.info("[testradioGroup0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.animation).assertEqual({ + duration: 3000, // 动画时长 + curve: Curve.EaseOut, // 动画曲线 + delay: 1000, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Reverse // 动画模式 + }); + console.info("[testPlayModeReverse0001] width value :" + obj.$attrs.animation); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testPlayModeAlternate0001 + * @tc.desic acePlayModeAlternateEtsTest0009 + */ + it('testPlayModeAlternate0001', 0, async function (done) { + console.info('radioGroup testPlayModeAlternate0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Alternate'); + console.info("[testPlayModeAlternate0001] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.animation).assertEqual({ + duration: 3000, + curve: Curve.EaseOut, + delay: 1000, + iterations: 1, + playMode: PlayMode.Alternate + }); + console.info("[testPlayModeAlternate0001] padding value :" + obj.$attrs.animation); + done(); + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animator.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animator.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..24f65f9b3227120a5e752ec2cc0c810b71c5210d --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animator.test.ets @@ -0,0 +1,202 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function animatorOnframeJsunit() { + describe('animatorOnframeTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/animator', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get animator state success " + JSON.stringify(pages)); + if (!("animator" == pages.name)) { + console.info("get animator state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push animator page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push animator page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("animatorOnframe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testanimatorOnframe0001 + * @tc.desic aceanimatorOnframeEtsTest0001 + */ + it('testanimatorOnframe0001', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testanimatorOnframe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testanimatorOnframe0002 + * @tc.desic aceanimatorOnframeEtsTest0002 + */ + it('testanimatorOnframe0002', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testanimatorOnframe0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testanimatorOnframe0003 + * @tc.desic aceanimatorOnframeEtsTest0003 + */ + it('testanimatorOnframe0003', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testanimatorOnframe0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testanimatorOnframe0004 + * @tc.desic aceanimatorOnframeEtsTest0004 + */ + it('testanimatorOnframe0004', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testanimatorOnframe0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testanimatorOnframe0005 + * @tc.desic aceanimatorOnframeEtsTest0005 + */ + it('testanimatorOnframe0005', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testanimatorOnframe0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testanimatorOnframe0006 + * @tc.desic aceanimatorOnframeEtsTest0006 + */ + it('testanimatorOnframe0006', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testanimatorOnframe0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testanimatorOnframe0007 + * @tc.desic aceanimatorOnframeEtsTest0007 + */ + it('testanimatorOnframe0007', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testanimatorOnframe0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testanimatorOnframe0009 + * @tc.desic aceanimatorOnframeEtsTest0009 + */ + it('testanimatorOnframe0009', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testanimatorOnframe0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testanimatorOnframe0010 + * @tc.desic aceanimatorOnframeEtsTest0010 + */ + it('testanimatorOnframe0010', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testanimatorOnframe0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1d4b22716f28e9e1758bcf205a36a159d5ba770 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets' + +export default function appVersionCodeJsunit() { + describe('appVersionCodeTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/app', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get app state success " + JSON.stringify(pages)); + if (!("app" == pages.name)) { + console.info("get app state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push app page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push app page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("appVersionCode after each called"); + }); + + it('testappVersionCode0011', 0, async function (done) { + console.info('appVersionCode testappVersionCode0011 START'); + await Utils.sleep(1000); + try { + var innerEvent = { + eventId: 60302, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testappVersionCode_0011 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Code).assertEqual("1"); + } + console.info("testappVersion click result is: " + JSON.stringify(sendEventByKey('versionCodeText', 10, ""))); + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testappVersionCode_0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testappVersionCode_0011 END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/canvas.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/canvas.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..27e88fa4f8102087e174ed2e3f61812383795834 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/canvas.test.ets @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function canvasActualBoundingBoxAscentJsunit() { + describe('canvasActualBoundingBoxAscentTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/canvas', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get canvas state success " + JSON.stringify(pages)); + if (!("canvas" == pages.name)) { + console.info("get canvas state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push canvas page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push canvas page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("canvasActualBoundingBoxAscent after each called"); + }); + + it('testcanvasAttributes0001', 0, async function (done) { + console.info('canvasAttributes0001 testcanvasAttributes0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.width).assertEqual("100.00%"); + console.info("[testcanvasAttributes0001] width value :" + obj.$attrs.width); + done(); + }); + + it('testcanvasAttributes0002', 0, async function (done) { + console.info('canvasAttributes0002 testcanvasAttributes0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.height).assertEqual("100.00%"); + console.info("[testcanvasAttributes0002] height value :" + obj.$attrs.height); + done(); + }); + + it('testcanvasAttributes0003', 0, async function (done) { + console.info('canvasAttributes0003 testcanvasAttributes0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0003] component backgroundColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.backgroundColor).assertEqual("#FFFFFF00"); + console.info("[testcanvasAttributes0003] backgroundColor value :" + obj.$attrs.backgroundColor); + done(); + }); + + it('testcanvasAttributes0004', 0, async function (done) { + console.info('canvasAttributes0003 testcanvasAttributes0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0004] component position strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.position.x).assertEqual("3.00vp"); + console.info("[testcanvasAttributes0004] position value :" + obj.$attrs.position); + done(); + }); + + it('testcanvasAttributes0005', 0, async function (done) { + console.info('canvasAttributes0005 testcanvasAttributes0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.align).assertEqual("Alignment.Center"); + console.info("[testcanvasAttributes0005] align value :" + obj.$attrs.align); + done(); + }); + + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBox.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBox.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..753af21a4fe9f9788d054dcb199c674f8c2b9811 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBox.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function checkBoxGroupJsunit() { + describe('checkBoxGroupTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/checkBox', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get checkBox state success " + JSON.stringify(pages)); + if (!("checkBox" == pages.name)) { + console.info("get checkBox state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push checkBox page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push checkBox page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("checkBoxGroup after each called"); + }); + + it('testcheckBoxGroup001', 0, async function (done) { + console.info('checkBoxGroup testcheckBoxGroup001 START'); + await Utils.sleep(2000); + try { + console.info("testcheckBoxGroup_0011 click result is: " + JSON.stringify(sendEventByKey('CheckboxGroup', 10, ""))); + let strJson = getInspectorByKey('Checkbox2'); + console.info("[testcheckBoxGroup001] component select strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Checkbox'); + expect(obj.$attrs.select).assertEqual("false"); + } catch (err) { + console.info("testcheckBoxGroup_0011 on click err : " + JSON.stringify(err)); + } + console.info('testcheckBoxGroup001 END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBoxGroup.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBoxGroup.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..55765c38521b11b6be3d8f700cb2243beb949997 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBoxGroup.test.ets @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets' + +export default function checkBoxGroupPartJsunit() { + describe('checkBoxGroupPartTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/checkBoxGroup', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get checkBoxGroup state success " + JSON.stringify(pages)); + if (!("checkBoxGroup" == pages.name)) { + console.info("get checkBoxGroup state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push checkBoxGroup page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push checkBoxGroup page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("checkBoxGroupPart after each called"); + }); + + it('testcheckBoxGroupPart0011', 0, async function (done) { + console.info('checkBoxGroupPart testcheckBoxGroupPart0011 START'); + await Utils.sleep(2000); + try { + console.info("testcheckBoxGroupPart_0011 click result is: " + JSON.stringify(sendEventByKey('CheckboxGroup', 10, ""))); + let strJson = getInspectorByKey('Checkbox2'); + console.info("[testcheckBoxGroupPart0011] component select strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Checkbox'); + expect(obj.$attrs.select).assertEqual("false"); + } catch (err) { + console.info("testcheckBoxGroupPart_0011 on click err : " + JSON.stringify(err)); + } + console.info('testcheckBoxGroupPart0011 END'); + done(); + }); + + it('testcheckBoxGroup0001', 0, async function (done) { + console.info('checkBoxGroup testcheckBoxGroup0001 START'); + await Utils.sleep(2000); + try { + console.info("testcheckBoxGroup0001 click result is: " + JSON.stringify(sendEventByKey('CheckboxGroup', 10, ""))); + var innerEvent = { + eventId: 60301, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testcheckBoxGroup0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(2); + done(); + } + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testcheckBoxGroup0001 on click err : " + JSON.stringify(err)); + } + console.info('testcheckBoxGroup0001 END'); + }) + }) +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/common.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/common.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d22eb6ecea74a58866eb72ff814ddad1007d963 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/common.test.ets @@ -0,0 +1,170 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function commonColorModeJsunit() { + describe('commonColorModeTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/common', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get common state success " + JSON.stringify(pages)); + if (!("common" == pages.name)) { + console.info("get common state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push common page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push common page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("commonColorMode after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testcommonColorMode0011 + * @tc.desic acecommonColorModeEtsTest0011 + */ + it('testcommonColorMode0011', 0, async function (done) { + console.info('commonColorMode testcommonColorMode0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ThinText'); + console.info("[testcommonColorMode0011] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined); + console.info("[testcommonColorMode0011] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0012 + * @tc.name testcommonColorMode0012 + * @tc.desic acecommonColorModeEtsTest0012 + */ + it('testcommonColorMode0012', 0, async function (done) { + console.info('commonColorMode testcommonColorMode0012 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ThickText'); + console.info("[testcommonColorMode0012] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined); + console.info("[testcommonColorMode0012] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00017 + * @tc.name testcommonMiddle0001 + * @tc.desic acecommonMiddleEtsTest0001 + */ + it('testcommonMiddle0001', 0, async function (done) { + console.info('commonMiddle testcommonMiddle0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('middleText'); + console.info("[testcommonMiddle0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + console.info("[testcommonMiddle0001] alignRules value :" + obj.$attrs.alignRules); + expect(obj.$attrs.alignRules).assertEqual(undefined); + console.info("[testcommonMiddle0001] alignRules value :" + obj.$attrs.alignRules); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00018 + * @tc.name testcommonOutset0001 + * @tc.desic acecommonOutsetEtsTest0001 + */ + it('testcommonOutset0001', 0, async function (done) { + console.info('commonOutset testcommonOutset0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('outsetText'); + console.info("[testcommonOutset0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + console.info("[testcommonOutset0001] borderImage value :" + obj.$attrs.borderImage); + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testcommonOutset0001] borderImage value :" + obj.$attrs.borderImage); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00019 + * @tc.name testcommonRepeat0001 + * @tc.desic acecommonRepeatEtsTest0001 + */ + it('testcommonRepeat0001', 0, async function (done) { + console.info('commonRepeat testcommonRepeat0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('RepeatText'); + console.info("[testcommonRepeat0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testcommonOutset0001] borderImage value :" + obj.$attrs.borderImage); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00020 + * @tc.name testcommonSpace0001 + * @tc.desic acecommonSpaceEtsTest0001 + */ + it('testcommonSpace0001', 0, async function (done) { + console.info('commonSpace testcommonSpace0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('SpaceText'); + console.info("[testcommonSpace0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testcommonSpace0001] borderImage value :" + obj.$attrs.borderImage); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00021 + * @tc.name testcommonSlice0001 + * @tc.desic acecommonSliceEtsTest0001 + */ + it('testcommonSlice0001', 0, async function (done) { + console.info('commonSlice testcommonSlice0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('sliceText'); + console.info("[testcommonSlice0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + console.info("[testcommonSlice0001] borderImage value :" + obj.$attrs.borderImage); + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testcommonSlice0001] borderImage value :" + obj.$attrs.borderImage); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/copyOption.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/copyOption.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b12cd1d3284d4fdc5d6bc205e246dd15defa4876 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/copyOption.test.ets @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function copyOptionJsunit() { + describe('copyOptionTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/copyOption', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get copyOption state success " + JSON.stringify(pages)); + if (!("copyOption" == pages.name)) { + console.info("get copyOption state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push copyOption page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push copyOption page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("copyOption after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testcopyOption0001 + * @tc.desic acecopyOptionEtsTest0001 + */ + it('testcopyOption0001', 0, async function (done) { + console.info('hoverEffect testcopyOption0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('InAppText'); + console.info("[testcopyOption0001] component copyOption strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.copyOption).assertEqual(undefined); + console.info("[testcopyOption0001] copyOption value :" + obj.$attrs.copyOption); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testcopyOption0002 + * @tc.desic acecopyOptionEtsTest0002 + */ + it('testcopyOption0002', 0, async function (done) { + console.info('hoverEffect testcopyOption0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LocalDeviceText'); + console.info("[testcopyOption0002] component copyOption strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.copyOption).assertEqual(undefined); + console.info("[testcopyOption0002] copyOption value :" + obj.$attrs.copyOption); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/curves.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/curves.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..677aeb0f476a7a818474bfccda3631efb2f3f871 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/curves.test.ets @@ -0,0 +1,262 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function curvesEaseOutJsunit() { + describe('curvesEaseOutTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/curves', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get curves state success " + JSON.stringify(pages)); + if (!("curves" == pages.name)) { + console.info("get curves state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push curves page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push curves page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("curvesEaseOut after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testeaseOutText0001 + * @tc.desic aceeaseOutTextEtsTest0001 + */ + it('testeaseOutText0001', 0, async function (done){ + console.info('easeOutText testeaseOutText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('EaseOutText') + console.info("[testeaseOutText0001] component EaseOutText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testeaseOutText0001] width value :" + obj.$attrs.width); + console.info("[testeaseOutText0001] height value :" + obj.$attrs.height); + console.info("[testeaseOutText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testeaseInOutText0001 + * @tc.desic aceeaseInOutTextEtsTest0001 + */ + it('testeaseInOutText0001', 0, async function (done){ + console.info('easeInOutText testeaseInOutText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('EaseInOutText') + console.info("[testeaseInOutText0001] component EaseInOutText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testeaseInOutText0001] width value :" + obj.$attrs.width); + console.info("[testeaseInOutText0001] height value :" + obj.$attrs.height); + console.info("[testeaseInOutText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + console.info("[testeaseInOutText0001] animation value :" + obj.$attrs.animation); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfastOutSlowInText0001 + * @tc.desic acefastOutSlowInTextEtsTest0001 + */ + it('testfastOutSlowInText0001', 0, async function (done){ + console.info('fastOutSlowInText testfastOutSlowInText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('FastOutSlowInText') + console.info("[testfastOutSlowInText0001] component fastOutSlowInText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testfastOutSlowInText0001] width value :" + obj.$attrs.width); + console.info("[testfastOutSlowInText0001] height value :" + obj.$attrs.height); + console.info("[testfastOutSlowInText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + console.info("[testfastOutSlowInText0001] animation value :" + obj.$attrs.animation); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlinearOutSlowInText0001 + * @tc.desic acelinearOutSlowInTextEtsTest0001 + */ + it('testlinearOutSlowInText0001', 0, async function (done){ + console.info('linearOutSlowInText testlinearOutSlowInText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('LinearOutSlowInText') + console.info("[testlinearOutSlowInText0001] component linearOutSlowInText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testlinearOutSlowInText0001] width value :" + obj.$attrs.width); + console.info("[testlinearOutSlowInText0001] height value :" + obj.$attrs.height); + console.info("[testlinearOutSlowInText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + console.info("[testlinearOutSlowInText0001] animation value :" + obj.$attrs.animation); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfastOutLinearInText0001 + * @tc.desic acefastOutLinearInTextEtsTest0001 + */ + it('testfastOutLinearInText0001', 0, async function (done){ + console.info('fastOutLinearInText testfastOutLinearInText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('fastOutLinearInText') + console.info("[testfastOutLinearInText0001] component fastOutLinearInText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testfastOutLinearInText0001] width value :" + obj.$attrs.width); + console.info("[testfastOutLinearInText0001] height value :" + obj.$attrs.height); + console.info("[testfastOutLinearInText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testextremeDecelerationText0001 + * @tc.desic aceextremeDecelerationTextEtsTest0001 + */ + it('testextremeDecelerationText0001', 0, async function (done){ + console.info('extremeDecelerationText testextremeDecelerationText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('ExtremeDecelerationText') + console.info("[testextremeDecelerationText0001] component extremeDecelerationText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testextremeDecelerationText0001] width value :" + obj.$attrs.width); + console.info("[testextremeDecelerationText0001] height value :" + obj.$attrs.height); + console.info("[testextremeDecelerationText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + console.info("[testextremeDecelerationText0001] animation value :" + obj.$attrs.animation); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testsharpText0001 + * @tc.desic acesharpTextEtsTest0001 + */ + it('testsharpText0001', 0, async function (done){ + console.info('sharpText testsharpText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('SharpText') + console.info("[testSharpText0001] component sharpText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testsharpText0001] width value :" + obj.$attrs.width); + console.info("[testsharpText0001] height value :" + obj.$attrs.height); + console.info("[testsharpText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testrhythmText0001 + * @tc.desic acerhythmTextEtsTest0001 + */ + it('testrhythmText0001', 0, async function (done){ + console.info('rhythmText testrhythmText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('RhythmText'); + console.info("[testrhythmText0001] component rhythmText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testrhythmText0001] width value :" + obj.$attrs.width); + console.info("[testrhythmText0001] height value :" + obj.$attrs.height); + console.info("[testrhythmText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testsmoothText0001 + * @tc.desic acesmoothTextEtsTest0001 + */ + it('testsmoothText0001', 0, async function (done){ + console.info('smoothText testsmoothText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('SmoothText'); + console.info("[testsmoothText0001] component smoothText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testsmoothText0001] width value :" + obj.$attrs.width); + console.info("[testsmoothText0001] height value :" + obj.$attrs.height); + console.info("[testsmoothText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfrictionText0001 + * @tc.desic acefrictionTextEtsTest0001 + */ + it('testfrictionText0001', 0, async function (done){ + console.info('frictionText testfrictionText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('FrictionText'); + console.info("[testfrictionText0001] component frictionText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testfrictionText0001] width value :" + obj.$attrs.width); + console.info("[testfrictionText0001] height value :" + obj.$attrs.height); + console.info("[testfrictionText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/datePicker.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/datePicker.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9590348458738454ac8b6f2a050db998bc97019 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/datePicker.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function datePickerLunarJsunit() { + describe('datePickerLunarTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/datePicker', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get datePicker state success " + JSON.stringify(pages)); + if (!("datePicker" == pages.name)) { + console.info("get datePicker state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push datePicker page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push datePicker page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("datePickerLunar after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testdatePickerLunar001 + * @tc.desic acedatePickerLunarEtsTest001 + */ + it('testdatePickerLunar001', 0, async function (done) { + console.info('datePickerLunar testdatePickerLunar001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('DatePicker'); + console.info("[testdatePickerLunar001] component lunar strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('DatePicker'); + expect(obj.$attrs.lunar).assertEqual("true"); + console.info("[testdatePickerLunar001] lunar value :" + obj.$attrs.lunar); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/enums.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/enums.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..daf073cbe404c4a91de46129d1dd7321934e8fb5 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/enums.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function enumsCancelJsunit() { + describe('enumsCancelTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/enums', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get enums state success " + JSON.stringify(pages)); + if (!("enums" == pages.name)) { + console.info("get enums state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push enums page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push enums page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("enumsCancel after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testenumsCancel0001 + * @tc.desic aceenumsCancelEtsTest0001 + */ + it('testenumsCancel0001', 0, async function (done) { + console.info('enumsCancel testenumsCancel0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('HighlightText'); + console.info("[testenumsCancel0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.hoverEffect).assertEqual("HoverEffect.Highlight"); + console.info("[testenumsCancel0001] hoverEffect value :" + obj.$attrs.hoverEffect); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/fill_mode.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/fill_mode.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2985a5ce30a1079d35a7c71c8b47e76b1da37b8 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/fill_mode.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function fillModeForwardJsunit() { + describe('fillModeForwardTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/fill_mode', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get fill_mode state success " + JSON.stringify(pages)); + if (!("fill_mode" == pages.name)) { + console.info("get fill_mode state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push fill_mode page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push fill_mode page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("fillModeForward after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfillModeForward0001 + * @tc.desic acefillModeForwardEtsTest0001 + */ + it('testfillModeForward0001', 0, async function (done) { + console.info('fillModeForward testfillModeForward0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ImageAnimator'); + console.info("[testfillModeForward0001] component fillMode strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ImageAnimator'); + expect(obj.$attrs.fillMode).assertEqual("FillMode.Forwards"); + console.info("[testfillModeForward0001] fillMode value :" + obj.$attrs.fillMode); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gesture.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gesture.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5cc59adc00f72447ca340430514ba9e8261c5733 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gesture.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function gestureParallelJsunit() { + describe('gestureParallelTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gesture', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gesture state success " + JSON.stringify(pages)); + if (!("gesture" == pages.name)) { + console.info("get gesture state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gesture page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gesture page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gestureParallel after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgestureParallel0001 + * @tc.desic acegestureParallelEtsTest0001 + */ + it('testgestureParallel0001', 0, async function (done) { + console.info('gestureParallel testgestureParallel0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ParallelText'); + console.info("[testgestureParallel0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("320.00vp"); + console.info("[testgestureParallel0001] width value :" + obj.$attrs.width); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridCol.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridCol.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a63d57bea0867ba5315c2854502de291f43a3eb8 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridCol.test.ets @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function gridColXlJsunit() { + describe('gridColXlTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gridCol', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gridCol state success " + JSON.stringify(pages)); + if (!("gridCol" == pages.name)) { + console.info("get gridCol state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gridCol page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gridCol page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gridColXl after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgridColXl0001 + * @tc.desic acegridColXlEtsTest0001 + */ + it('testgridColXl0001', 0, async function (done) { + console.info('gridColXl testgridColXl0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridCol'); + console.info("[testgridColXl0001] component order strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('GridCol'); + expect(obj.$attrs.order).assertEqual("{xl: 10}"); + console.info("[testgridColXl0001] order value :" + obj.$attrs.order); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testgridColXl0002 + * @tc.desic acegridColXlEtsTest0002 + */ + it('testgridColXl0002', 0, async function (done) { + console.info('gridColXl testgridColXl0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridCol'); + console.info("[testgridColXl0002] component backgroundColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Color.Green'); + expect(obj.$attrs.backgroundColor).assertEqual("Color.Green"); + console.info("[testgridColXl0002] backgroundColor value :" + obj.$attrs.backgroundColor); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridRow.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridRow.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e330facb710d599a6ea91ade48fc93839a88d92b --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridRow.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function gridRowXlJsunit() { + describe('gridRowXlTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gridRow', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gridRow state success " + JSON.stringify(pages)); + if (!("gridRow" == pages.name)) { + console.info("get gridRow state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gridRow page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gridRow page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gridRowXl after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgridRowXl0001 + * @tc.desic acegridRowXlEtsTest0001 + */ + it('testgridRowXl0001', 0, async function (done) { + console.info('gridRowXl testgridRowXl0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridRowColumnOption——xl'); + console.info("[testgridRowXl0001] component backgroundColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('GridRow'); + expect(obj.$attrs.backgroundColor).assertEqual("Color.Red"); + console.info("[testgridRowXl0001] backgroundColor value :" + obj.$attrs.backgroundColor); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hoverEffect.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hoverEffect.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a321fdd96ce308060bc8ee0df322e497b563ec6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hoverEffect.test.ets @@ -0,0 +1,83 @@ +//@ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function hoverEffectJsunit() { + describe('hoverEffectTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/hoverEffect', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get hoverEffect state success " + JSON.stringify(pages)); + if (!("hoverEffect" == pages.name)) { + console.info("get hoverEffect state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push hoverEffect page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push hoverEffect page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("hoverEffect after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testhoverEffect0001 + * @tc.desic acehoverEffectEtsTest0001 + */ + it('testhoverEffect0001', 0, async function (done) { + console.info('hoverEffect testhoverEffect0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ScaleText'); + console.info("[testhoverEffect0001] component hoverEffect strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.hoverEffect).assertEqual(undefined); + console.info("[testhoverEffect0001] hoverEffect value :" + obj.$attrs.hoverEffect); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testhoverEffect0002 + * @tc.desic acehoverEffectEtsTest0002 + */ + it('testhoverEffect0002', 0, async function (done) { + console.info('hoverEffect testhoverEffect0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('HighlightText'); + console.info("[testhoverEffect0002] component hoverEffect strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.hoverEffect).assertEqual(undefined); + console.info("[testhoverEffect0002] hoverEffect value :" + obj.$attrs.hoverEffect); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/listtest.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/listtest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..adad4c0d01e48288ac5142c0964985e8086411c3 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/listtest.test.ets @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function listtestIdleJsunit() { + describe('listtestIdleTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/listtest', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get listtest state success " + JSON.stringify(pages)); + if (!("listtest" == pages.name)) { + console.info("get listtestI state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push listtest page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push listtest page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("listtestIdle after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlisttestIdle0001 + * @tc.desic acelisttestIdleEtsTest0001 + */ + it('testlisttestIdle0001', 0, async function (done) { + console.info('listtestIdle testlisttestIdle0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ScrollList'); + console.info("[testlisttestIdle0001] component controlButton strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('List'); + expect(obj.$attrs.editMode).assertEqual("true"); + console.info("[testlisttestIdle0001] editMode value :" + obj.$attrs.editMode); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/loadingProgress.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/loadingProgress.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cea401c98a70c43152148d0689481df78ec69a16 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/loadingProgress.test.ets @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function loadingProgressCircularJsunit() { + describe('loadingProgressCircularTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/loadingProgress', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get loadingProgress state success " + JSON.stringify(pages)); + if (!("loadingProgress" == pages.name)) { + console.info("get loadingProgress state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push loadingProgress page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push loadingProgress page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("loadingProgressCircular after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testloadingProgressCircular0011 + * @tc.desic aceloadingProgressCircularEtsTest0011 + */ + it('testloadingProgressCircular0011', 0, async function (done) { + console.info('loadingProgressCircular testloadingProgressCircular0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('CircularText'); + console.info("[testloadingProgressCircular0011] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.color).assertEqual(undefined); + expect(obj.$attrs.width).assertEqual('100.00vp'); + expect(obj.$attrs.margin).assertEqual('0.00px'); + console.info("[testloadingProgressCircular0011] color value :" + obj.$attrs.color); + console.info("[testloadingProgressCircular0011] width value :" + obj.$attrs.width); + console.info("[testloadingProgressCircular0011] margin value :" + obj.$attrs.margin); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testloadingProgressCircular0001 + * @tc.desic aceloadingProgressCircularEtsTest0011 + */ + it('testloadingProgressOrbital0001', 0, async function (done) { + console.info('loadingProgressOrbital testloadingProgressCircular0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('OrbitalText'); + console.info("[testloadingProgressOrbital0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.color).assertEqual(undefined); + expect(obj.$attrs.width).assertEqual('100.00vp'); + expect(obj.$attrs.margin).assertEqual('0.00px'); + console.info("[testloadingProgressOrbital0001] color value :" + obj.$attrs.color); + console.info("[testloadingProgressOrbital0001] width value :" + obj.$attrs.width); + console.info("[testloadingProgressOrbital0001] margin value :" + obj.$attrs.margin); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/pluginComponent.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/pluginComponent.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ab1af3997cd58b6e0fbe8149ca896883f49b7c8 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/pluginComponent.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function pluginComponentKVObjectJsunit() { + describe('pluginComponentKVObjectTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/pluginComponent', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get pluginComponent state success " + JSON.stringify(pages)); + if (!("pluginComponent" == pages.name)) { + console.info("get pluginComponent state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push pluginComponent page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push pluginComponent page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("pluginComponentKVObject after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpluginComponentKVObject0001 + * @tc.desic acepluginComponentKVObjectEtsTest0001 + */ + it('testpluginComponentKVObject0001', 0, async function (done) { + console.info('pluginComponentKVObject testpluginComponentKVObject0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('pluginComponent'); + console.info("[testpluginComponentKVObject0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('PluginComponent'); + expect(obj.$attrs.size.width).assertEqual('500.00vp'); + console.info("[testpluginComponentKVObject0001] size.width value :" + obj.$attrs.size.width); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/progress.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/progress.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed59e82d59b948d11600f1dec9eedefd735a1f59 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/progress.test.ets @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function progressScaleCountJsunit() { + describe('progressScaleCountTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/progress', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get progress state success " + JSON.stringify(pages)); + if (!("progress" == pages.name)) { + console.info("get progress state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push progress page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push progress page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("progressScaleCount after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testprogressScaleCount0001 + * @tc.desic aceprogressScaleCountEtsTest0001 + */ + it('testprogressScaleCount0001', 0, async function (done) { + console.info('progressScaleCount testprogressScaleCount0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('progressStyleOptions'); + console.info("[testprogressScaleCount0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.scaleCount).assertEqual("15"); + console.info("[testprogressScaleCount0001] style.scaleCount value :" + obj.$attrs.style.scaleCount); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testprogressScaleCount0002 + * @tc.desic aceprogressScaleCountEtsTest0002 + */ + it('testprogressScaleCount0002', 0, async function (done) { + console.info('progressScaleCount testprogressScaleCount0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('progressStyleOptions'); + console.info("[testprogressScaleCount0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.scaleWidth).assertEqual('5.00vp'); + console.info("[testprogressScaleCount0002] style.scaleWidth value :" + obj.$attrs.style.scaleWidth); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/radio.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/radio.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9413f4ab7156af3ee4ed00a15a840e91e860e907 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/radio.test.ets @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function radioGroupJsunit() { + describe('radioGroupTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/radio', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get radio state success " + JSON.stringify(pages)); + if (!("radio" == pages.name)) { + console.info("get radio state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push radio page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push radio page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("radioGroup after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testradioGroup001 + * @tc.desic aceradioGroupEtsTest001 + */ + it('testradioGroup001', 0, async function (done) { + console.info('radioGroup testradioGroup001 START'); + await Utils.sleep(2000); + try { + console.info("testradioGroup_0011 click result is: " + JSON.stringify(sendEventByKey('RadioTwo', 10, ""))); + let strJson = getInspectorByKey('RadioOne'); + console.info("[testradioGroup001] component checked strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Radio'); + expect(obj.$attrs.checked).assertEqual("true"); + console.info("[testradioGroup001] checked value :" + obj.$attrs.checked); + } catch (err) { + console.info("testradioGroup_0011 on click err : " + JSON.stringify(err)); + } + console.info('testradioGroup001 END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/refresh.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/refresh.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d8eeefd2e654496d3d55e3ad517df0eae3ac7dc1 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/refresh.test.ets @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function refreshDragJsunit() { + describe('refreshDragTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/refresh', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get refresh state success " + JSON.stringify(pages)); + if (!("refresh" == pages.name)) { + console.info("get refresh state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push refresh page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push refresh page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("refreshDrag after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testrefreshDrag0011 + * @tc.desic acerefreshDragEtsTest0011 + */ + it('testrefreshDrag0011', 0, async function (done) { + console.info('refreshDrag testrefreshDrag0011 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 60304, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testrefreshDrag0011 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(true); + done(); + } + console.info("testrefreshDrag0011 click result is: " + JSON.stringify(sendEventByKey('Refresh', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testrefreshDrag0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testrefreshDrag0011 END'); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0012 + * @tc.name testrefreshRefresh0001 + * @tc.desic acerefreshRefreshEtsTest0001 + */ + it('testrefreshRefresh0001', 0, async function (done) { + console.info('refreshDrag testrefreshRefresh0001 START'); + await Utils.sleep(2000); + try { + var eventTwo = { + eventId: 60305, + priority: events_emitter.EventPriority.LOW + } + var callbackTwo = (eventData) => { + console.info("testrefreshRefresh0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(true); + done(); + } + console.info("testrefreshRefresh0001 click result is: " + JSON.stringify(sendEventByKey('Refresh', 10, ""))); + events_emitter.on(eventTwo, callbackTwo); + } catch (err) { + console.info("testrefreshRefresh0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testrefreshRefresh0001 END'); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/remoteWindow.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/remoteWindow.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1dc2d8ac010da8423da0e17bc3d84aa260bdb07c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/remoteWindow.test.ets @@ -0,0 +1,220 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function remoteWindowJsunit() { + describe('remoteWindowTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/remoteWindow', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get remoteWindow state success " + JSON.stringify(pages)); + if (!("remoteWindow" == pages.name)) { + console.info("get RemoteWindow state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push remoteWindow page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push remoteWindow page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("remoteWindow after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testremoteWindow0001 + * @tc.desic acesremoteWindowEtsTest0001 + */ + it('testRemoteWindow0001', 0, async function (done) { + console.info('remoteWindow testRemoteWindow0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual('100.00vp'); + console.info("[testRemoteWindow0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testRemoteWindow0002 + * @tc.desic aceRemoteWindowEtsTest0002 + */ + it('testRemoteWindow0002', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual('70.00vp'); + console.info("[testRemoteWindow0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testRemoteWindow0003 + * @tc.desic aceRemoteWindowEtsTest0003 + */ + it('testRemoteWindow0003', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual('20.00fp'); + console.info("[testRemoteWindow0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testRemoteWindow0004 + * @tc.desic aceRemoteWindowEtsTest0004 + */ + it('testRemoteWindow0004', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testRemoteWindow0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testRemoteWindow0005 + * @tc.desic aceRemoteWindowEtsTest0005 + */ + it('testRemoteWindow0005', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual('Alignment.TopStart'); + console.info("[testRemoteWindow0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testRemoteWindow0006 + * @tc.desic aceRemoteWindowEtsTest0006 + */ + it('testRemoteWindow0006', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual('#FFCCCCCC'); + console.info("[testRemoteWindow0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testRemoteWindow0007 + * @tc.desic aceRemoteWindowEtsTest0007 + */ + it('testRemoteWindow0007', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual('25.00fp'); + console.info("[testRemoteWindow0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testRemoteWindow0009 + * @tc.desic aceRemoteWindowEtsTest0009 + */ + it('testRemoteWindow0009', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual('10.00vp'); + console.info("[testRemoteWindow0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testRemoteWindow0010 + * @tc.desic aceRemoteWindowEtsTest0010 + */ + it('testRemoteWindow0010', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Left'); + console.info("[testRemoteWindow0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testRemoteWindow0011 + * @tc.desic aceRemoteWindowEtsTest0011 + */ + it('testRemoteWindow0011', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0011] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.indicatorStyle).assertEqual({ mask: false }); + console.info("[testRemoteWindow0011] indicatorStyle value :" + obj.$attrs.indicatorStyle); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/responseType.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/responseType.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2722356a164cbc6591c499b29261365eeee29431 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/responseType.test.ets @@ -0,0 +1,83 @@ +//@ts-nocheck +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function responseTypeJsunit() { + describe('responseTypeTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/responseType', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get responseType state success " + JSON.stringify(pages)); + if (!("responseType" == pages.name)) { + console.info("get responseType state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push responseType page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push responseType page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("responseType after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testresponseType0002 + * @tc.desic acehoverEffectEtsTest0002 + */ + it('testresponseType0002', 0, async function (done) { + console.info('responseType testresponseType0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('RightClickText'); + console.info("[testresponseType0002] component bindContextMenu strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.bindContextMenu).assertEqual("ResponseType.LongPress"); + console.info("[testresponseType0002] bindContextMenu value :" + obj.$attrs.bindContextMenu); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testhoverEffect0003 + * @tc.desic acehoverEffectEtsTest0003 + */ + it('testresponseType0003', 0, async function (done) { + console.info('responseType testresponseType0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LongPressText'); + console.info("[testresponseType0003] component bindContextMenu strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.bindContextMenu).assertEqual("ResponseType.LongPress"); + console.info("[testresponseType0003] bindContextMenu value :" + obj.$attrs.bindContextMenu); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/router.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/router.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..955c82893abf8a7072b068da078a61accbc309fa --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/router.test.ets @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function routerStandardJsunit() { + describe('routerStandardTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/router', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get router state success " + JSON.stringify(pages)); + if (!("router" == pages.name)) { + console.info("get router state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push router page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push router page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("routerStandard after each called"); + }); + + it('testrouterStandard0011', 0, async function (done) { + console.info('routerStandard testrouterStandard0011 START'); + await Utils.sleep(2000); + try { + var standardEvent = { + eventId: 101, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testrouterStandard_0011 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.ArrayData).assertEqual("45"); + done(); + } + console.info("testrouterStandard_0011 click result1 is: " + JSON.stringify(sendEventByKey('StandardText', 10, ""))); + await Utils.sleep(2000); + console.info("testrouterStandard_0011 click result2 is: " + JSON.stringify(sendEventByKey('DataText', 10, ""))); + events_emitter.on(standardEvent, callback1); + } catch (err) { + console.info("testrouterStandard_0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testrouterStandard0011 END'); + }); + + it('testrouterSingle0001', 0, async function (done) { + console.info('routerSingle testrouterSingle0001 START'); + await Utils.sleep(2000); + try { + var singleEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + var callback2 = (eventData) => { + console.info("testrouterSingle_0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.ArrayData).assertEqual("46"); + done(); + } + console.info("testrouterSingle_0001 click result1 is: " + JSON.stringify(sendEventByKey('SingleText', 10, ""))); + await Utils.sleep(2000); + console.info("testrouterSingle_0001 click result2 is: " + JSON.stringify(sendEventByKey('SingleDataText', 10, ""))); + events_emitter.on(singleEvent, callback2); + } catch (err) { + console.info("testrouterSingle_0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testrouterSingle_0001 END'); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/scrollEdge.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/scrollEdge.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a14e5555ccc39e8abf3117674c1c3dfd35b9be0b --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/scrollEdge.test.ets @@ -0,0 +1,61 @@ +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function ScrollExampleJsunit() { + describe('ScrollExampleTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/scroll_edge', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get scroll_edge state success " + JSON.stringify(pages)); + if (!("ScrollExample" == pages.name)) { + console.info("get scroll_edge state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push scroll_edge page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push scroll_edge page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("ScrollExample after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testscrollEdgeMiddle0001 + * @tc.desic acescrollEdgeMiddleEtsTest0001 + */ + it('testscrollEdgeMiddle0001', 0, async function (done) { + console.info('scrollEdgeMiddle testscrollEdgeMiddle0001 START'); + + await Utils.sleep(2000); + try { + var innerEventOne = { + eventId: 60306, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testscrollEdgeMiddle0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('MiddleText', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testscrollEdgeMiddle0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testscrollEdgeMiddle0001 END'); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/sidebar.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/sidebar.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec91cfaa0fee9c4c337877753f9d038411407b49 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/sidebar.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function sidebarIconsJsunit() { + describe('sidebarIconsTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/sidebar', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get sidebar state success " + JSON.stringify(pages)); + if (!("sidebarIcons" == pages.name)) { + console.info("get sidebar state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push sidebar page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push sidebar page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("sidebarIcons after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testsidebarIcons0011 + * @tc.desic acesidebarIconsEtsTest0011 + */ + it('testsidebarIcons0011', 0, async function (done) { + console.info('sidebarIcons testsidebarIcons0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('SideBarContainer'); + console.info("[testsidebarIcons0011] component controlButton strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('SideBarContainer'); + expect(obj.$attrs.controlButton.icons).assertEqual(undefined); + console.info("[testsidebarIcons0011] controlButton value :" + obj.$attrs.controlButton); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/slider.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/slider.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4fc8e17b0ed3f2931133ea1981e175019869fe23 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/slider.test.ets @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function sliderMovingJsunit() { + describe('sliderMovingTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/slider', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get slider state success " + JSON.stringify(pages)); + if (!("sliderMoving" == pages.name)) { + console.info("get slider state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push slider page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push slider page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("sliderMoving after each called"); + }); + + it('testsliderMoving0011', 0, async function (done) { + console.info('sliderMoving testsliderMoving0011 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 60307, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testsliderMoving0011 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Mode).assertEqual(false); + done(); + } + console.info("testsliderMoving0011 click result is: " + JSON.stringify(sendEventByKey('Slider', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testsliderMoving0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testsliderMoving0011 END'); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stateManagement.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stateManagement.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3da471d3e8c5c608698e4c08f1223453e273629a --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stateManagement.test.ets @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function stateManagementDARKJsunit() { + describe('stateManagementDARKTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/stateManagement', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stateManagement state success " + JSON.stringify(pages)); + if (!("stateManagement" == pages.name)) { + console.info("get stateManagement state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push stateManagement page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stateManagement page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("stateManagementDARK after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name teststateManagementDARK001 + * @tc.desic acestateManagementDARKEtsTest001 + */ + it('teststateManagementDARK001', 0, async function (done) { + console.info('stateManagementDARK teststateManagementDARK001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('DARKText'); + console.info("[teststateManagementDARK001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.backgroundColor).assertEqual('#FF000001'); + console.info("[teststateManagementDARK001] backgroundColor value :" + obj.$attrs.backgroundColor); + done(); + }); + + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stepperItem.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stepperItem.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..806c0a2a25a5efddc88fde3eef843553585151ca --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stepperItem.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function stepperItemDisabledJsunit() { + describe('stepperItemDisabledTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/stepperItem', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stepperItem state success " + JSON.stringify(pages)); + if (!("stepperItem" == pages.name)) { + console.info("get stepperItem state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push stepperItem page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stepperItem page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("stepperItemDisabled after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name teststepperItemDisabled0001 + * @tc.desic acestepperItemDisabledEtsTest0001 + */ + it('teststepperItemDisabled0001', 0, async function (done) { + console.info('stepperItemDisabled teststepperItemDisabled0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('StepperItem'); + console.info("[teststepperItemDisabled0001] component status strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('StepperItem'); + expect(obj.$attrs.status).assertEqual("ItemState.Disabled"); + console.info("[teststepperItemDisabled0001] status value :" + obj.$attrs.status); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/swiper.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/swiper.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e1e908a5f4b3944f46d29c1e711824bd3a07910 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/swiper.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function swiperMaskJsunit() { + describe('swiperMaskTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/swiper', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get swiper state success " + JSON.stringify(pages)); + if (!("swiper" == pages.name)) { + console.info("get swiper state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push swiper page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push swiper page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("swiperMask after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testswiperMask001 + * @tc.desic aceswiperMaskEtsTest001 + */ + it('testswiperMask001', 0, async function (done) { + console.info('swiperMask testswiperMask001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('maskSwiper'); + console.info("[testswiperMask001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.indicatorStyle.mask).assertEqual(undefined); + console.info("[testswiperMask001] indicatorStyle value :" + obj.$attrs.indicatorStyle.mask); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/text_input.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/text_input.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..71523e4c4752cf6dd03c381b3e78d90a0beba174 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/text_input.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function text_inputPhoneNumberJsunit() { + describe('text_inputPhoneNumberTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/text_input', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get text_input state success " + JSON.stringify(pages)); + if (!("text_input" == pages.name)) { + console.info("get text_input state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push text_input page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push text_input page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("text_inputPhoneNumber after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtext_inputPhoneNumber0001 + * @tc.desic acetext_inputPhoneNumberEtsTest0001 + */ + it('testtext_inputPhoneNumber0001', 0, async function (done) { + console.info('text_inputPhoneNumber testtext_inputPhoneNumber0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('PhoneNumberText'); + console.info("[testtext_inputPhoneNumber0001] component type strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.type).assertEqual('InputType.Normal'); + console.info("[testtext_inputPhoneNumber0001] type value :" + obj.$attrs.type); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/uiAppearance.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/uiAppearance.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..444381d884a26b17041eb07164ff2845a2198602 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/uiAppearance.test.ets @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function uiAppearanceALWAYS_DARKJsunit() { + describe('uiAppearanceALWAYS_DARKTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/uiAppearance', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get uiAppearance state success " + JSON.stringify(pages)); + if (!("uiAppearance" == pages.name)) { + console.info("get uiAppearance state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push uiAppearance page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push uiAppearance page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("uiAppearanceALWAYS_DARK after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testuiAppearanceALWAYS_DARK0001 + * @tc.desic aceuiAppearanceALWAYS_DARKEtsTest0001 + */ + it('testuiAppearanceALWAYS_DARK0001', 0, async function (done) { + console.info('uiAppearanceALWAYS_DARK testuiAppearanceALWAYS_DARK0001 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 60308, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testuiAppearanceALWAYS_DARK0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Mode).assertEqual(0); + console.info('testuiAppearanceALWAYS_DARK0001 END'); + done(); + } + console.info("testuiAppearanceALWAYS_DARK0001 click result is: " + JSON.stringify(sendEventByKey('ALWAYS_DARKText', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testuiAppearanceALWAYS_DARK0001 on events_emitter err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testuiAppearanceALWAYS_LIGHT0001 + * @tc.desic aceuiAppearanceALWAYS_LIGHTEtsTest0001 + */ + it('testuiAppearanceALWAYS_LIGHT0001', 0, async function (done) { + console.info('uiAppearanceALWAYS_LIGHT testuiAppearanceALWAYS_LIGHT0001 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 60309, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testuiAppearanceALWAYS_LIGHT0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Mode).assertEqual(1); + console.info('testuiAppearanceALWAYS_LIGHT0001 END'); + done(); + } + console.info("testuiAppearanceALWAYS_LIGHT0001 click result is: " + JSON.stringify(sendEventByKey('ALWAYS_LIGHTText', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testuiAppearanceALWAYS_LIGHT0001 on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0520d73d0a4ae089cd2c10385bf5856442b84c6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' +import events_emitter from '@ohos.events.emitter'; + +export default function unitsModuleNameJsunit() { + describe('unitsModuleNameTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/units', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get units state success " + JSON.stringify(pages)); + if (!("units" == pages.name)) { + console.info("get units state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push units page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push units page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("unitsModuleName after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testunitsModuleName0001 + * @tc.desic aceunitsModuleNameEtsTest0001 + */ + it('testunitsModuleName0001', 0, async function (done) { + console.info('unitsModuleName testunitsModuleName0001 START'); + await Utils.sleep(2000); + try { + console.info("testunitsModuleName0001 click result is: " + JSON.stringify(sendEventByKey('moduleNameText', 10, ""))); + var innerEvent = { + eventId: 60310, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testunitsModuleName0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ModuleName).assertEqual(true); + } + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testunitsModuleName0001 on click err : " + JSON.stringify(err)); + } + console.info('testunitsModuleName0001 END'); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testunitsGlobalPosition0001 + * @tc.desic aceunitsGlobalPositionEtsTest0001 + */ + it('testunitsGlobalPosition0001', 0, async function (done) { + console.info('unitsModuleName testunitsGlobalPosition0001 START'); + await Utils.sleep(2000); + try { + console.info("testunitsGlobalPosition0001 click result is: " + JSON.stringify(sendEventByKey('globalPositionText', 10, ""))); + var innerEvent = { + eventId: 60311, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testunitsGlobalPosition0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(true); + } + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testunitsGlobalPosition0001 on click err : " + JSON.stringify(err)); + } + console.info('testunitsGlobalPosition0001 END'); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testunitsMinWidth0001 + * @tc.desic aceunitsMinWidthEtsTest0001 + */ + it('testunitsMinWidth0001', 0, async function (done) { + console.info('unitsModuleName testunitsMinWidth0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minWidthText'); + console.info("[testunitsMinWidth0001] component constraintSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.constraintSize).assertEqual('{"minWidth":"200.00vp","minHeight":"0.00vp","maxWidth":"119846208990821053862485980936868943386622755140025217957449185986963312195176500631099345318391471397553524277795258607297703698567960268420438325781003880454605934667138922450849236563878474354509650486846713237047577973081895276546573889957650195146049445629577007136228474373133005395361920118602782998528.00vp","maxHeight":"0.00vp"}'); + console.info("[testunitsMinWidth0001] constraintSize value :" + obj.$attrs.constraintSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testunitsMinWidth0002 + * @tc.desic aceunitsMinWidthEtsTest0002 + */ + it('testunitsMinWidth0002', 0, async function (done) { + console.info('unitsModuleName testunitsMinWidth0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minWidthText'); + console.info("[testunitsMinWidth0002] component constraintSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + let constraintSize = JSON.parse(obj.$attrs.constraintSize); + console.info("[testunitsMinWidth0002] constraintSize is : " + constraintSize); + expect(obj.$attrs.constraintSize.minWidth).assertEqual(undefined); + console.info("[testunitsMinWidth0002] constraintSize value :" + obj.$attrs.constraintSize); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/web.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/web.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c0517d018842420ec1b59b2ef0b0935e153519e --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/web.test.ets @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function webEditTextJsunit() { + describe('webEditTextTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/web', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get web state success " + JSON.stringify(pages)); + if (!("web" == pages.name)) { + console.info("get web state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push web page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push web page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("webEditText after each called"); + }); + + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/color.json b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..68f8331ba0fbe3404fe8ab5ede5ecb98a0a76d80 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/float.json b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..f26020ff03a653a81ecc6fa8fdef0d9a3b067f96 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fa13b27d700b87e261e43fda028695c25d7a25ec --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "MainAbility_label", + "value": "MainAbility_label" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + }, + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/media/icon.png b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg3.png b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg3.png new file mode 100644 index 0000000000000000000000000000000000000000..70224e6e8d74391b43b0fc9911900b5cbbeaabb5 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg3.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg4.png b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg4.png new file mode 100644 index 0000000000000000000000000000000000000000..f7f11a8f4f8296e2532f5a37bafd0d2f39bd2c17 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg4.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/test.png b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/test.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/test.png differ diff --git a/arkui/ace_ets_component_attrlack/signature/openharmony_sx.p7b b/arkui/ace_ets_component_attrlack/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/signature/openharmony_sx.p7b differ