diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/image.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/image.ets index 91dffbb172386a295ac84f2db6b19e56d4d85d14..815893bc2e24a0ff07f277b6ad3a6ed439333d76 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/image.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/image.ets @@ -29,6 +29,7 @@ struct ImageExample { .width(240).height(240) .colorFilter([1,2,3]) .overlay('colorFilter', { align: Alignment.Bottom, offset: { x: 0, y: -15 } }) + .draggable(false) }.border({ color: Color.Black, width: 2 }) }.width('100%') }.padding({ top: 20 }) diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets index 93928f3de584680222844189efe04b4c939b38dc..9b487c72356778a0157b7df27bbdeac5b8f4d119 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets @@ -136,6 +136,10 @@ struct ListLanes { .onScrollEnd(() => { console.info('Scroll Stop') }) + .onScrollStart(() => { + console.info('Scroll Start'); + }) + Button('scroll 100') diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/menuitem.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/menuitem.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b1b341e110df326b212044c85aa12502c1bc232 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/menuitem.ets @@ -0,0 +1,75 @@ + +/* + * Copyright (c) 2023 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. + */ +@Entry +@Component +struct Index { + @State select: boolean = true + @Builder + SubMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + } + + @Builder + MyMenu(){ + Menu() { + MenuItem({ startIcon: $r("app.media.icon"), content: "菜单选项" }) + MenuItem({ startIcon: $r("app.media.icon"), content: "菜单选项" }) + .enabled(false) + MenuItem({ + + content: "菜单选项", + + builder: this.SubMenu.bind(this) + }) + MenuItemGroup({ header: '小标题' , footer: '大标题'}) { + MenuItem({ content: "菜单选项" }) + .selectIcon(true) + .selected(this.select) + .onChange((selected) => { + console.info("menuItem select" + selected); + + }) + MenuItem({ + content: "菜单选项", + endIcon: $r("app.media.icon"), + builder: this.SubMenu.bind(this) + + }) + } + MenuItem({ + + content: "菜单选项", + + }) + } + } + + build() { + Row() { + Column() { + Text('click to show menu') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets index bbecbe823fc6a9b87af8c03ea9db6aba69453818..958c79f152087c4a633c5b0d7c7ce0ef09635554 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets @@ -75,8 +75,11 @@ struct ScrollOnScrollBegin { console.info('To the edge') }) .onScrollEnd(() => { - console.info('Scroll Stop') + console.info('Scroll Stop'); }) + .onScrollStart(() => { + console.info('Scroll Start'); + }) .key("Scroll") .width("100%") .height("100%") diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets index f71351f2c050766154c8c081c81115cf4ad44733..487260e61ce3e5c3150e26db8670a94ef3425eec 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets @@ -86,6 +86,12 @@ struct SwiperCurve { .onChange((index: number) => { console.info(index.toString()) }) + .onAnimationStart((index: number) => { + console.info("swiper nAnimationStart info index is " + index); + }) + .onAnimationEnd((index: number) => { + console.info("swiper onAnimationEnd info index is " + index); + }) Flex({ justifyContent: FlexAlign.SpaceAround }) { Button('next') 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 ead1df032237f27f1495b033b71e891db91813bf..08c9cd619b94186b0d1f262b3506a6e8ce42cdeb 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 @@ -59,6 +59,7 @@ import textPickerDefaultPickerItemHeightJsunit from './textPicker.test.ets'; import videoOnFullscreenChangeJsunit from './video.test.ets'; import webGetTitleJsunit from './web.test.ets'; import xcomponentGetXComponentContextJsunit from './xcomponent.test.ets'; +import routerJsunit from './router.test.ets'; export default function testsuite() { lazyForEachOnDataAddJsunit() @@ -104,4 +105,5 @@ export default function testsuite() { videoOnFullscreenChangeJsunit() webGetTitleJsunit() xcomponentGetXComponentContextJsunit() + routerJsunit() } \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common_ts_ets_api.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common_ts_ets_api.test.ets index 0f3b42d3c4370f5f178c8050f42f24dcfd57578c..5e9c548cf79fcff7581ec90588a74986afe382c3 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common_ts_ets_api.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common_ts_ets_api.test.ets @@ -17,6 +17,7 @@ import events_emitter from '@ohos.events.emitter'; import router from '@system.router'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import Utils from './Utils.ets' +import font from '@ohos.font' export default function common_ts_ets_apiStaticClearJsunit() { describe('common_ts_ets_apiStaticClearTest', function () { @@ -95,5 +96,29 @@ export default function common_ts_ets_apiStaticClearJsunit() { console.info("common_ts_ets_apiEnvProp0001 on events_emitter err : " + JSON.stringify(err)); } }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name test_font_registerFont_0001 + * @tc.desc Register a customized font in the FontManager + */ + it('test_font_registerFont_0001', 0, async function (done) { + console.info('test_font_registerFont_0001 Register a customized font in the FontManagerSTART'); + await Utils.sleep(2000); + let fontOptions = { + familyName: "Italy", + familySrc: "resource/base/Italy" + } + try { + let result = font.registerFont(fontOptions); + console.info("test_font_registerFont_0001 info is : " + JSON.stringify(result)); + expect().assertFail(); + done(); + } catch (err) { + console.info("test_font_registerFont_0001 err : " + JSON.stringify(err)); + expect(true).assertTrue(); + done(); + } + }); }) } diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/router.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/router.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fabb900a116cef788161c86cd3837e73851ad367 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/router.test.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 router from '@ohos.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function routerJsunit() { + describe('routerJsunit', function () { + beforeAll(async function (done) { + console.info("router beforeEach start"); + + try { + router.clear(); + let pages = router.getState(); + console.info("get router state success " + JSON.stringify(pages)); + if (!("circle" == pages.name)) { + console.info("get router state success " + JSON.stringify(pages.name)); + router.pushUrl({ + url: 'pages/circle', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + console.info("push circle page success " ); + }) + .catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + } + } catch (err) { + console.error("push circle page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("circleNew after each called"); + }); + + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_002 + * @tc.name tesRouter_001 + * @tc.desc testRouterAPi + */ + it('testRouter_001', 0, async function (done) { + await Utils.sleep(2000); + try { + router.showAlertBeforeBackPage({ + message: 'Message Info' + }); + expect(true).assertTrue(); + done(); + } catch(error) { + console.error(`showAlertBeforeBackPage failed, code is ${error.code}, message is ${error.message}`); + expect(error.code == 13004).assertTrue(); + done(); + } + + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_002 + * @tc.name tesRouter_002 + * @tc.desc testRouterAPi + */ + it('testRouter_001', 0, async function (done) { + await Utils.sleep(2000); + try { + router.hideAlertBeforeBackPage(); + expect(true).assertTrue(); + done(); + } catch(error) { + console.error(`hideAlertBeforeBackPage failed, code is ${error.code}, message is ${error.message}`); + expect(error.code == 13004).assertTrue(); + done(); + } + + }); + + + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stateManagement.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stateManagement.test.ets index ad3f342453523aea2e0fdc8ce774679d0072c473..eb8849397c5ad1709db599884ea830b14b392f0a 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stateManagement.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stateManagement.test.ets @@ -150,5 +150,68 @@ export default function stateManagementGetSharedJsunit() { } console.info('teststateManagementsetAndProp0001 END'); }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name test_setAndLink_0001 + * @tc.desc bind localStorage + */ + it('test_setAndLink_0001', 0, async function (done) { + console.info('test_setAndLink_0001 START'); + await Utils.sleep(2000); + try { + let storage = new LocalStorage() + storage.setAndLink('storageSimpleProp', '121'); + let size = storage.size() + expect(size == 1).assertTrue(); + done(); + } catch (err) { + console.info("test_font_registerFont_0001 err : " + JSON.stringify(err)); + expect().assertFail(); + done(); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name test_setAndLink_0001 + * @tc.desc bind localStorage + */ + it('test_setAndLink_0001', 0, async function (done) { + console.info('test_setAndLink_0001 START'); + await Utils.sleep(2000); + try { + let storage = new LocalStorage() + storage.setAndLink('storageSimpleProp', '121'); + let size = storage.size() + expect(size == 1).assertTrue(); + done(); + } catch (err) { + console.info("test_setAndLink_0001 err : " + JSON.stringify(err)); + expect().assertFail(); + done(); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0008 + * @tc.name test_setAndProp_0001 + * @tc.desc bind localStorage + */ + it('test_setAndProp_0001', 0, async function (done) { + console.info('test_setAndProp_0001 START'); + await Utils.sleep(2000); + try { + let storage = new LocalStorage() + storage.setAndProp("setAndProp",'12'); + let size = storage.size(); + expect(size == 1).assertTrue(); + done(); + } catch (err) { + console.info("test_setAndProp_0001 err : " + JSON.stringify(err)); + expect().assertFail(); + done(); + } + }); }) } diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gestureSetting.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gestureSetting.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e8b78d47bf18a061048c0418759f9a94276e98c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gestureSetting.ets @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct GestureSettingsExample { + @State priorityTestValue: string = '' + @State parallelTestValue: string = '' + result = postCardAction(null,null); + + build() { + Column() { + Column() { + Text('TapGesture:' + this.priorityTestValue).fontSize(28) + .gesture( + TapGesture() + .onAction(() => { + this.priorityTestValue += '\nText' + })) + } + .height(200) + .width(250) + .padding(20) + .margin(20) + .border({ width: 3 }) + // 设置为priorityGesture时,点击文本会忽略Text组件的TapGesture手势事件,优先识别父组件Column的TapGesture手势事件 + .priorityGesture( + TapGesture() + .onAction((event: GestureEvent) => { + this.priorityTestValue += '\nColumn' + console.info("Gesture pressure" + event.pressure); + console.info("Gesture tiltX" + event.tiltX); + console.info("Gesture tiltY" + event.tiltY); + console.info("Gesture sourceTool object" + event.sourceTool); + console.info("Gesture sourceTool enum value " + SourceTool.Finger); + console.info("Gesture sourceTool enum value " + SourceTool.Pen); + + }), GestureMask.IgnoreInternal) + + Column() { + Text('TapGesture:' + this.parallelTestValue).fontSize(28) + .gesture( + TapGesture() + .onAction(() => { + this.parallelTestValue += '\nText' + })) + } + .height(200) + .width(250) + .padding(20) + .margin(20) + .border({ width: 3 }) + .parallelGesture( + TapGesture() + .onAction((event: GestureEvent) => { + this.parallelTestValue += '\nColumn' + }), GestureMask.Normal) + } + } +} \ No newline at end of file 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 index 2dca5c993afa6b9decc1dc0db4699970d56234dd..0f0e284b68340626816cf9a3a63e41c76db4a480 100644 --- 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 @@ -17,6 +17,7 @@ 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'; +import measure from '@ohos.measure' export default function alertDialogCenterStartJsunit() { describe('alertDialogCenterStartTest', function () { @@ -71,5 +72,26 @@ export default function alertDialogCenterStartJsunit() { console.info("testalertDialogCenterStart0001 on events_emitter err : " + JSON.stringify(err)); } }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testMeasureText0001 + * @tc.desic test text width + */ + it('testMeasureText0001', 0, async function (done) { + console.info('testMeasureText0001 start'); + await Utils.sleep(2000); + try { + let measureOptions = {textContent : "alertDialog-CenterStart"}; + let width = measure.measureText(measureOptions); + console.info("testMeasureText0001 " + width.toString()); + expect(width > 0).assertTrue(); + done(); + } catch (err) { + console.info("testMeasureText0001 err : " + JSON.stringify(err)); + expect().assertFail(); + done(); + } + }); }) } diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/ohosrouter.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/ohosrouter.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d255021b12f859ca9e8dd9f02764f90a1f332bf --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/ohosrouter.test.ets @@ -0,0 +1,48 @@ +/** + * 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function ohosrouterJsunit() { + describe('ohosrouterJsunit', function () { + beforeAll(async function (done) { + console.info("ohosrouterJsunit beforeAll"); + done(); + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("ohosrouterJsunit aftereach"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name ohosrouterJsunit_001 + * @tc.desc test routermode + */ + it('ohosrouterJsunit_001', 0, async function (done) { + try { + expect(1).assertEqual(router.RouterMode.Single); + done(); + } catch (error) { + console.error(`ohosrouterJsunit_001 pushUrl args error code is ${error.code}, message is ${error.message}`) + expect().assertFail(); + }; + + }); + }) +}