未验证 提交 46d15cbe 编写于 作者: O openharmony_ci 提交者: Gitee

!8544 修改Slider组件blockSize属性获取 相关XTS

Merge pull request !8544 from chensi10/sliderTest
...@@ -767,7 +767,7 @@ struct SliderTest { ...@@ -767,7 +767,7 @@ struct SliderTest {
style: SliderStyle.InSet style: SliderStyle.InSet
}) })
.key('ArkUX_Stage_Slider_blockSize_1800') .key('ArkUX_Stage_Slider_blockSize_1800')
.blockSize({ width: "20lsp", height: "20lsp" }) .blockSize({ width: "20lpx", height: "20lpx" })
} }
ListItem() { ListItem() {
Slider({ Slider({
......
...@@ -32,11 +32,11 @@ function sleep(time) { ...@@ -32,11 +32,11 @@ function sleep(time) {
export default function sliderTest() { export default function sliderTest() {
describe('ActsAbilityTest', function () { describe('ActsAbilityTest', function () {
/* /**
* @tc.number ArkUX_Stage_Slider_blockBorderColor_0100 * @tc.number ArkUX_Stage_Slider_blockBorderColor_0100
* @tc.name Test the blockBorderColor property of the Slider component * @tc.name Test the blockBorderColor property of the Slider component
* @tc.desc Set the blockBorderColor attribute to 0xffa500 * @tc.desc Set the blockBorderColor attribute to 0xffa500
*/ */
it('ArkUX_Stage_Slider_blockBorderColor_0100', 0, async function (done) { it('ArkUX_Stage_Slider_blockBorderColor_0100', 0, async function (done) {
console.info('[ArkUX_Stage_Slider_blockBorderColor_0100] START'); console.info('[ArkUX_Stage_Slider_blockBorderColor_0100] START');
setTimeout(() => { setTimeout(() => {
...@@ -55,10 +55,10 @@ export default function sliderTest() { ...@@ -55,10 +55,10 @@ export default function sliderTest() {
}) })
/** /**
* @tc.number ArkUX_Stage_Slider_blockBorderColor_0200 * @tc.number ArkUX_Stage_Slider_blockBorderColor_0200
* @tc.name Test the blockBorderColor property of the Slider component * @tc.name Test the blockBorderColor property of the Slider component
* @tc.desc Set the blockBorderColor attribute to "ffc709e9" * @tc.desc Set the blockBorderColor attribute to "ffc709e9"
*/ */
it('ArkUX_Stage_Slider_blockBorderColor_0200', 0, async function (done) { it('ArkUX_Stage_Slider_blockBorderColor_0200', 0, async function (done) {
console.info('[ArkUX_Stage_Slider_blockBorderColor_0200] START'); console.info('[ArkUX_Stage_Slider_blockBorderColor_0200] START');
setTimeout(() => { setTimeout(() => {
...@@ -1210,10 +1210,13 @@ export default function sliderTest() { ...@@ -1210,10 +1210,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0100'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0100');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0100 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0100 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0100 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1234,10 +1237,13 @@ export default function sliderTest() { ...@@ -1234,10 +1237,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0200'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0200');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0200 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0200 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0200 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("7.500000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("7.500000"); expect(parseFloat(width)).assertEqual(5);
expect(parseFloat(height)).assertEqual(5);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1258,10 +1264,13 @@ export default function sliderTest() { ...@@ -1258,10 +1264,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0300'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0300');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0300 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0300 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0300 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("22.500000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("30.000000"); expect(parseFloat(width)).assertEqual(15);
expect(parseFloat(height)).assertEqual(20);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1282,10 +1291,13 @@ export default function sliderTest() { ...@@ -1282,10 +1291,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0400'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0400');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0400 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0400 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0400 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1306,10 +1318,13 @@ export default function sliderTest() { ...@@ -1306,10 +1318,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0500'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0500');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0500 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0500 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0500 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("20.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("20.000000"); expect(parseFloat(width)).assertEqual(20);
expect(parseFloat(height)).assertEqual(20);
expect(width.substr(width.length-2, 2)).assertEqual("px");
expect(height.substr(height.length-2, 2)).assertEqual("px");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1330,10 +1345,13 @@ export default function sliderTest() { ...@@ -1330,10 +1345,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0600'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0600');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0600 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0600 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0600 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(120);
expect(parseFloat(height)).assertEqual(120);
expect(width.substr(width.length-1, 1)).assertEqual("%");
expect(height.substr(height.length-1, 1)).assertEqual("%");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1355,10 +1373,13 @@ export default function sliderTest() { ...@@ -1355,10 +1373,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0700'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0700');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0700 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0700 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0700 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("75.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("75.000000"); expect(parseFloat(width)).assertEqual(50);
expect(parseFloat(height)).assertEqual(50);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1379,10 +1400,13 @@ export default function sliderTest() { ...@@ -1379,10 +1400,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0800'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0800');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0800 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0800 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0800 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1403,10 +1427,13 @@ export default function sliderTest() { ...@@ -1403,10 +1427,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0900'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_0900');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_0900 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_0900 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_0900 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1427,10 +1454,13 @@ export default function sliderTest() { ...@@ -1427,10 +1454,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1000'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1000');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1000 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1000 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1000 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1451,10 +1481,13 @@ export default function sliderTest() { ...@@ -1451,10 +1481,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1100'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1100');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1100 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1100 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1100 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1475,10 +1508,13 @@ export default function sliderTest() { ...@@ -1475,10 +1508,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1200'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1200');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1200 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1200 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1200 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("22.500000"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(15);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1499,10 +1535,13 @@ export default function sliderTest() { ...@@ -1499,10 +1535,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1300'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1300');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1300 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1300 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1300 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("22.500000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(15);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1523,10 +1562,13 @@ export default function sliderTest() { ...@@ -1523,10 +1562,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1400'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1400');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1400 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1400 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1400 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("12.00vp"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("12.00vp"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1548,10 +1590,13 @@ export default function sliderTest() { ...@@ -1548,10 +1590,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1500'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1500');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1500 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1500 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1500 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("30.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("37.500000"); expect(parseFloat(width)).assertEqual(20);
expect(parseFloat(height)).assertEqual(25);
expect(width.substr(width.length-2, 2)).assertEqual("fp");
expect(height.substr(height.length-2, 2)).assertEqual("fp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1573,10 +1618,13 @@ export default function sliderTest() { ...@@ -1573,10 +1618,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1600'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1600');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1600 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1600 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1600 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("22.500000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("30.000000"); expect(parseFloat(width)).assertEqual(15);
expect(parseFloat(height)).assertEqual(20);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1597,10 +1645,13 @@ export default function sliderTest() { ...@@ -1597,10 +1645,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1700'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1700');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1700 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1700 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1700 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("18.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("18.000000"); expect(parseFloat(width)).assertEqual(12);
expect(parseFloat(height)).assertEqual(12);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -1613,7 +1664,7 @@ export default function sliderTest() { ...@@ -1613,7 +1664,7 @@ export default function sliderTest() {
/** /**
* @tc.number ArkUX_Stage_Slider_blockSize_1800 * @tc.number ArkUX_Stage_Slider_blockSize_1800
* @tc.name Test the blockSize property of the Slider component * @tc.name Test the blockSize property of the Slider component
* @tc.desc Set the width attribute to "20lsp" ,height attribute to "20lsp" in the blockSize * @tc.desc Set the width attribute to "20lpx" ,height attribute to "20lpx" in the blockSize
*/ */
it('ArkUX_Stage_Slider_blockSize_1800', 0, async function (done) { it('ArkUX_Stage_Slider_blockSize_1800', 0, async function (done) {
console.info('[ArkUX_Stage_Slider_blockSize_1800] START'); console.info('[ArkUX_Stage_Slider_blockSize_1800] START');
...@@ -1621,10 +1672,13 @@ export default function sliderTest() { ...@@ -1621,10 +1672,13 @@ export default function sliderTest() {
try { try {
let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1800'); let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockSize_1800');
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("----ArkUX_Stage_Slider_blockSizeWidth_1800 is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_blockSize_1800 is " + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_blockSizeHeight_1800 is" + JSON.stringify(obj.$attrs.blockSizeHeight)); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeWidth).assertEqual("30.000000"); let height = obj.$attrs.blockSize.height ;
expect(obj.$attrs.blockSizeHeight).assertEqual("30.000000"); expect(parseFloat(width)).assertEqual(20);
expect(parseFloat(height)).assertEqual(20);
expect(width.substr(width.length-3, 3)).assertEqual("lpx");
expect(height.substr(height.length-3, 3)).assertEqual("lpx");
done(); done();
} catch (err) { } catch (err) {
expect().assertFail(); expect().assertFail();
...@@ -2269,15 +2323,18 @@ export default function sliderTest() { ...@@ -2269,15 +2323,18 @@ export default function sliderTest() {
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
console.info("-->ArkUX_Stage_Slider_Test_0100 component obj is: " + JSON.stringify(obj)); console.info("-->ArkUX_Stage_Slider_Test_0100 component obj is: " + JSON.stringify(obj));
console.info("-->ArkUX_Stage_Slider_Test_0100 obj.$attrs is: " + JSON.stringify(obj.$attrs)); console.info("-->ArkUX_Stage_Slider_Test_0100 obj.$attrs is: " + JSON.stringify(obj.$attrs));
console.info("----ArkUX_Stage_Slider_Test_0100 blockSizeWidth is" + JSON.stringify(obj.$attrs.blockSizeWidth)); console.info("----ArkUX_Stage_Slider_Test_0100 blockSize is" + JSON.stringify(obj.$attrs.blockSize));
console.info("----ArkUX_Stage_Slider_Test_0100 blockSizeHeight is" + JSON.stringify(obj.$attrs.blockSizeHeight));
console.info("----ArkUX_Stage_Slider_Test_0100 blockBorderColor is" + JSON.stringify(obj.$attrs.blockBorderColor)); console.info("----ArkUX_Stage_Slider_Test_0100 blockBorderColor is" + JSON.stringify(obj.$attrs.blockBorderColor));
console.info("----ArkUX_Stage_Slider_Test_0100 blockBorderWidth is" + JSON.stringify(obj.$attrs.blockBorderWidth)); console.info("----ArkUX_Stage_Slider_Test_0100 blockBorderWidth is" + JSON.stringify(obj.$attrs.blockBorderWidth));
console.info("----ArkUX_Stage_Slider_Test_0100 stepColor is" + JSON.stringify(obj.$attrs.stepColor)); console.info("----ArkUX_Stage_Slider_Test_0100 stepColor is" + JSON.stringify(obj.$attrs.stepColor));
console.info("----ArkUX_Stage_Slider_Test_0100 trackBorderRadius is" + JSON.stringify(obj.$attrs.trackBorderRadius)); console.info("----ArkUX_Stage_Slider_Test_0100 trackBorderRadius is" + JSON.stringify(obj.$attrs.trackBorderRadius));
console.info("----ArkUX_Stage_Slider_Test_0100 stepSize is" + JSON.stringify(obj.$attrs.stepSize)); console.info("----ArkUX_Stage_Slider_Test_0100 stepSize is" + JSON.stringify(obj.$attrs.stepSize));
expect(obj.$attrs.blockSizeWidth).assertEqual("15.000000"); let width = obj.$attrs.blockSize.width ;
expect(obj.$attrs.blockSizeHeight).assertEqual("15.000000"); let height = obj.$attrs.blockSize.height ;
expect(parseFloat(width)).assertEqual(10);
expect(parseFloat(height)).assertEqual(10);
expect(width.substr(width.length-2, 2)).assertEqual("vp");
expect(height.substr(height.length-2, 2)).assertEqual("vp");
expect(obj.$attrs.blockBorderWidth).assertEqual("10.00vp") expect(obj.$attrs.blockBorderWidth).assertEqual("10.00vp")
expect(obj.$attrs.blockBorderColor).assertEqual("#FFC709E9") expect(obj.$attrs.blockBorderColor).assertEqual("#FFC709E9")
expect(obj.$attrs.stepColor).assertEqual("#FFF10202") expect(obj.$attrs.stepColor).assertEqual("#FFF10202")
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
{ {
"name":"block_size_height_test", "name":"block_size_height_test",
"value":"50vp" "value":"50vp"
}, }
] ]
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册