From 9d79d9d6389ea5356f429b18261828cb5935e69f Mon Sep 17 00:00:00 2001 From: sunjiakun Date: Mon, 3 Jul 2023 23:07:27 +0800 Subject: [PATCH] =?UTF-8?q?swiper=20xts=E5=A2=9E=E8=A1=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sunjiakun --- .../src/main/ets/TestAbility/pages/Index.ets | 56 +++++++++ .../src/main/ets/test/swiper.ets | 118 ++++++++++++++++++ 2 files changed, 174 insertions(+) diff --git a/arkui/ace_ets_components_ux/ace_ets_component_swiper/src/main/ets/TestAbility/pages/Index.ets b/arkui/ace_ets_components_ux/ace_ets_component_swiper/src/main/ets/TestAbility/pages/Index.ets index fbf823a52..1043732f5 100644 --- a/arkui/ace_ets_components_ux/ace_ets_component_swiper/src/main/ets/TestAbility/pages/Index.ets +++ b/arkui/ace_ets_components_ux/ace_ets_component_swiper/src/main/ets/TestAbility/pages/Index.ets @@ -1932,6 +1932,62 @@ struct SwiperTest { console.info(index.toString()) }) } + ListItem() { + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item) + .width('90%') + .height(160) + .backgroundColor(0xAFEEEE) + .textAlign(TextAlign.Center) + .fontSize(30) + }, item => item) + } + .key("ArkUX_Stage_Swiper_Indicator_0100") + .indicator(Indicator.digit().top(1)) + } + ListItem() { + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item) + .width('90%') + .height(160) + .backgroundColor(0xAFEEEE) + .textAlign(TextAlign.Center) + .fontSize(30) + }, item => item) + } + .key("ArkUX_Stage_Swiper_Indicator_0200") + .indicator(Indicator.digit().bottom(1)) + } + ListItem() { + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item) + .width('90%') + .height(160) + .backgroundColor(0xAFEEEE) + .textAlign(TextAlign.Center) + .fontSize(30) + }, item => item) + } + .key("ArkUX_Stage_Swiper_Indicator_0300") + .indicator(Indicator.digit().left(1)) + } + ListItem() { + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item) + .width('90%') + .height(160) + .backgroundColor(0xAFEEEE) + .textAlign(TextAlign.Center) + .fontSize(30) + }, item => item) + } + .key("ArkUX_Stage_Swiper_Indicator_0400") + .indicator(Indicator.digit().right(1)) + } } } .width('100%') diff --git a/arkui/ace_ets_components_ux/ace_ets_component_swiper/src/main/ets/test/swiper.ets b/arkui/ace_ets_components_ux/ace_ets_component_swiper/src/main/ets/test/swiper.ets index d8b427949..8c9db6bd4 100644 --- a/arkui/ace_ets_components_ux/ace_ets_component_swiper/src/main/ets/test/swiper.ets +++ b/arkui/ace_ets_components_ux/ace_ets_component_swiper/src/main/ets/test/swiper.ets @@ -2336,5 +2336,123 @@ export default function swiperTest() { } }, 500) }); + + /** + * @tc.number ArkUX_Stage_Swiper_Indicator_0100 + * @tc.name Tests the digitFont property of the swiper component + * @tc.desc Set the Indicator property parameter to top(1) + */ + it('ArkUX_Stage_Swiper_Indicator_0100', 0, async function (done) { + console.info('ArkUX_Stage_Swiper_Indicator_0100 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Swiper_Indicator_0100'); + console.info('ArkUX_Stage_Swiper_Indicator_0100 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Swiper_Indicator_0100 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Swiper_Indicator_0100 component obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let obj2 = JSON.parse(obj.$attrs.indicator); + console.info("ArkUX_Stage_Swiper_Indicator_0100 component obj2 is: " + JSON.stringify(obj2)); + expect(parseFloat(obj2.top)).assertEqual(1); + console.info("ArkUX_Stage_Swiper_Indicator_0100 component obj2.indicator.top is: " + + JSON.stringify(obj2.top)); + expect(obj2.top.substr(obj2.top.length-2, 2)).assertEqual("vp"); + console.info('ArkUX_Stage_Swiper_Indicator_0100 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Swiper_Indicator_0100 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Swiper_Indicator_0200 + * @tc.name Tests the digitFont property of the swiper component + * @tc.desc Set the Indicator property parameter to bottom(1) + */ + it('ArkUX_Stage_Swiper_Indicator_0200', 0, async function (done) { + console.info('ArkUX_Stage_Swiper_Indicator_0200 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Swiper_Indicator_0200'); + console.info('ArkUX_Stage_Swiper_Indicator_0200 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Swiper_Indicator_0200 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Swiper_Indicator_0200 component obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let obj2 = JSON.parse(obj.$attrs.indicator); + console.info("ArkUX_Stage_Swiper_Indicator_0200 component obj2 is: " + JSON.stringify(obj2)); + expect(parseFloat(obj2.bottom)).assertEqual(1); + expect(obj2.bottom.substr(obj2.bottom.length-2, 2)).assertEqual("vp"); + console.info('ArkUX_Stage_Swiper_Indicator_0200 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Swiper_Indicator_0200 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Swiper_Indicator_0300 + * @tc.name Tests the digitFont property of the swiper component + * @tc.desc Set the Indicator property parameter to left(1) + */ + it('ArkUX_Stage_Swiper_Indicator_0300', 0, async function (done) { + console.info('ArkUX_Stage_Swiper_Indicator_0300 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Swiper_Indicator_0300'); + console.info('ArkUX_Stage_Swiper_Indicator_0300 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Swiper_Indicator_0300 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Swiper_Indicator_0300 component obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let obj2 = JSON.parse(obj.$attrs.indicator); + console.info("ArkUX_Stage_Swiper_Indicator_0300 component obj2 is: " + JSON.stringify(obj2)); + expect(parseFloat(obj2.left)).assertEqual(1); + expect(obj2.left.substr(obj2.left.length-2, 2)).assertEqual("vp"); + console.info('ArkUX_Stage_Swiper_Indicator_0300 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Swiper_Indicator_0300 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Swiper_Indicator_0400 + * @tc.name Tests the digitFont property of the swiper component + * @tc.desc Set the Indicator property parameter to right(1) + */ + it('ArkUX_Stage_Swiper_Indicator_0400', 0, async function (done) { + console.info('ArkUX_Stage_Swiper_Indicator_0400 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Swiper_Indicator_0400'); + console.info('ArkUX_Stage_Swiper_Indicator_0400 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Swiper_Indicator_0400 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Swiper_Indicator_0400 component obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let obj2 = JSON.parse(obj.$attrs.indicator); + console.info("ArkUX_Stage_Swiper_Indicator_0400 component obj2 is: " + JSON.stringify(obj2)); + expect(parseFloat(obj2.right)).assertEqual(1); + expect(obj2.right.substr(obj2.right.length-2, 2)).assertEqual("vp"); + console.info('ArkUX_Stage_Swiper_Indicator_0400 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Swiper_Indicator_0400 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); }) } \ No newline at end of file -- GitLab