From 8c9ce3d4704465b3ea74587f4747439ca46c40d0 Mon Sep 17 00:00:00 2001 From: chensi10 Date: Wed, 22 Mar 2023 15:10:15 +0800 Subject: [PATCH] badge part2 Signed-off-by: chensi10 --- .../src/main/ets/test/badge.ets | 372 +++++++++++++++++- 1 file changed, 371 insertions(+), 1 deletion(-) diff --git a/arkui/ace_ets_components_ux/ace_ets_component_badge/src/main/ets/test/badge.ets b/arkui/ace_ets_components_ux/ace_ets_component_badge/src/main/ets/test/badge.ets index 30ac05a8d..2683a273d 100644 --- a/arkui/ace_ets_components_ux/ace_ets_component_badge/src/main/ets/test/badge.ets +++ b/arkui/ace_ets_components_ux/ace_ets_component_badge/src/main/ets/test/badge.ets @@ -816,6 +816,376 @@ export default function badgeTest() { } }, 500) }); - + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0100 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Set the BorderWidth property argument to 5 + */ + it('ArkUX_Stage_Badge_BorderWidth_0100', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0100 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0100'); + console.info('ArkUX_Stage_Badge_BorderWidth_0100 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0100 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0100 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0100 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("5.00vp"); + console.info('ArkUX_Stage_Badge_BorderWidth_0100 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0100 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0200 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Set the BorderWidth property argument to "5" + */ + it('ArkUX_Stage_Badge_BorderWidth_0200', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0200 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0200'); + console.info('ArkUX_Stage_Badge_BorderWidth_0200 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0200 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0200 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0200 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("5.00px"); + console.info('ArkUX_Stage_Badge_BorderWidth_0200 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0200 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0300 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Set the BorderWidth property argument to $r("app.string.badge_Size_test") + */ + it('ArkUX_Stage_Badge_BorderWidth_0300', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0300 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0300'); + console.info('ArkUX_Stage_Badge_BorderWidth_0300 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0300 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0300 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0300 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("7.00vp"); + console.info('ArkUX_Stage_Badge_BorderWidth_0300 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0300 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0400 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Sets the BorderWidth property parameter to the exception value "" + */ + it('ArkUX_Stage_Badge_BorderWidth_0400', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0400 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0400'); + console.info('ArkUX_Stage_Badge_BorderWidth_0400 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0400 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0400 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0400 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("0.00vp"); + console.info('ArkUX_Stage_Badge_BorderWidth_0400 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0400 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0500 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Sets the BorderWidth property parameter to the exception value null + */ + it('ArkUX_Stage_Badge_BorderWidth_0500', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0500 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0500'); + console.info('ArkUX_Stage_Badge_BorderWidth_0500 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0500 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0500 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0500 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("1.00vp"); + console.info('ArkUX_Stage_Badge_BorderWidth_0500 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0500 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0600 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Sets the BorderWidth property parameter to the exception value undefined + */ + it('ArkUX_Stage_Badge_BorderWidth_0600', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0600 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0600'); + console.info('ArkUX_Stage_Badge_BorderWidth_0600 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0600 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0600 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0600 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("1.00vp"); + console.info('ArkUX_Stage_Badge_BorderWidth_0600 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0600 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0700 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Set the BorderWidth property parameter to 5, + * and set the BorderWidth property parameter to "7fp" again + */ + it('ArkUX_Stage_Badge_BorderWidth_0700', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0700 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0700'); + console.info('ArkUX_Stage_Badge_BorderWidth_0700 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0700 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0700 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0700 component style.borderWidth is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("7.00fp"); + console.info('ArkUX_Stage_Badge_BorderWidth_0700 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0700 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0800 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Set the BorderWidth property parameter to 5 + * and set the BorderWidth property parameter to undefined again + */ + it('ArkUX_Stage_Badge_BorderWidth_0800', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0800 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0800'); + console.info('ArkUX_Stage_Badge_BorderWidth_0800 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0800 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0800 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0800 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("1.00vp"); + console.info('ArkUX_Stage_Badge_BorderWidth_0800 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0800 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_0900 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Sets the BorderWidth property parameter to the exception value "asdf%^7" + */ + it('ArkUX_Stage_Badge_BorderWidth_0900', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_0900 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_0900'); + console.info('ArkUX_Stage_Badge_BorderWidth_0900 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_0900 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_0900 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_0900 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("0.00vp"); + console.info('ArkUX_Stage_Badge_BorderWidth_0900 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_0900 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_1000 + * @tc.name Tests the BorderWidth property of the badge component + * @tc.desc Set the BorderWidth property parameter to "5lpx" + * and the common property width property value to the outlier value 7 + */ + it('ArkUX_Stage_Badge_BorderWidth_1000', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_1000 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_1000'); + console.info('ArkUX_Stage_Badge_BorderWidth_1000 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_1000 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_1000 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_1000 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("5.00lpx"); + console.info('ArkUX_Stage_Badge_BorderWidth_1000 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_1000 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_1100 + * @tc.name Combined test all new attributes of the Badge component + * @tc.desc Set the BorderWidth property argument to 0 + */ + it('ArkUX_Stage_Badge_BorderWidth_1100', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_1000 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_1100'); + console.info('ArkUX_Stage_Badge_BorderWidth_1100 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_1100 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_1100 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_1100 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("0.00vp"); + console.info('ArkUX_Stage_Badge_BorderWidth_1100 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_1100 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_1200 + * @tc.name Combined test all new attributes of the Badge component + * @tc.desc Simultaneous setting BorderWidth(5) fontWeight(600) BorderColor(#FFFD0000) + */ + it('ArkUX_Stage_Badge_BorderWidth_1200', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_1200 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_1200'); + console.info('ArkUX_Stage_Badge_BorderWidth_1200 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_1200 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_1200 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_1200 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("5.00vp"); + expect(style.fontWeight).assertEqual("FontWeight.600"); + expect(style.borderColor).assertEqual("#FFFD0000"); + console.info('ArkUX_Stage_Badge_BorderWidth_1200 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_1200 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUX_Stage_Badge_BorderWidth_1300 + * @tc.name Combined test all new attributes of the Badge component + * @tc.desc Do not set new attributes + */ + it('ArkUX_Stage_Badge_BorderWidth_1300', 0, async function (done) { + console.info('ArkUX_Stage_Badge_BorderWidth_1300 START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Badge_BorderWidth_1300'); + console.info('ArkUX_Stage_Badge_BorderWidth_1300 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Stage_Badge_BorderWidth_1300 component obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Stage_Badge_BorderWidth_1300 component obj.$attrs is: " + JSON.stringify(obj.$attrs)); + console.info("ArkUX_Stage_Badge_BorderWidth_1300 component obj.$attrs.style is: " + + JSON.stringify(obj.$attrs.style)); + let style = JSON.parse(obj.$attrs.style); + expect(style.borderWidth).assertEqual("1.00vp"); + expect(style.fontWeight).assertEqual("FontWeight.Normal"); + expect(style.borderColor).assertEqual("#FFFA2A2D"); + console.info('ArkUX_Stage_Badge_BorderWidth_1300 END '); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Badge_BorderWidth_1300 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); }) } \ No newline at end of file -- GitLab