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

!7573 test:Add Grid_GridTemplatesAllSet_One xts_acts test

Merge pull request !7573 from 王倩/Grid_one
...@@ -23,6 +23,7 @@ group("arkui") { ...@@ -23,6 +23,7 @@ group("arkui") {
"ace_ets_component_two:ActsAceEtsComponentTwoTest", "ace_ets_component_two:ActsAceEtsComponentTwoTest",
"ace_ets_component_ui:ActsAceEtsComponentUITest", "ace_ets_component_ui:ActsAceEtsComponentUITest",
"ace_ets_dev:ActsAceDevTest", "ace_ets_dev:ActsAceDevTest",
"ace_ets_layout_test:ArkUIActsLayoutTest",
"ace_ets_standard:ActsAceEtsStTest", "ace_ets_standard:ActsAceEtsStTest",
"ace_ets_test:ActsAceEtsTest", "ace_ets_test:ActsAceEtsTest",
"ace_ets_third_test:ActsAceEtsThirdTest", "ace_ets_third_test:ActsAceEtsThirdTest",
......
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../../common/MessageManager';
@Entry
@Component
struct Grid_RowCol_Gap{
@State addColumnGap: number = 5;
@State addRowGap: number = 0;
messageManager:MessageManager = new MessageManager()
private content: string = "Grid_RowCol_Gap Page"
onPageShow() {
console.info('Grid_RowCol_Gap page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'addColumnGap') {
this.addColumnGap = message.value;
}
if (message.name == 'addRowGap') {
this.addRowGap = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Grid_RowCol_Gap page build done called');
}
build() {
Column() {
Grid() {
GridItem() {
Text('1').fontSize(16).backgroundColor(0xF9CF93).width('100%').height('100%')
}.key('Grid_RowCol_Gap_011')
GridItem() {
Text('2').fontSize(16).backgroundColor(0xF5DEB3).width('100%').height('100%')
}.key('Grid_RowCol_Gap_012')
GridItem() {
Text('3').fontSize(16).backgroundColor(0xD2B48C).width('100%').height('100%')
}.key('Grid_RowCol_Gap_013')
GridItem() {
Text('4').fontSize(16).backgroundColor(0xffa500).width('100%').height('100%')
}.key('Grid_RowCol_Gap_014')
}
.columnsTemplate("1fr 1fr")
.rowsTemplate("1fr 1fr")
.width(300)
.height(300)
.backgroundColor(0xFAEEE0)
.key('Grid_RowCol_Gap_01')
.columnsGap(this.addColumnGap)
.rowsGap(this.addRowGap)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../../common/MessageManager';
@Entry
@Component
struct Grid_RowCol_GridSize {
@State changeHeight: number = 200;
messageManager:MessageManager = new MessageManager()
private content: string = "Grid_RowCol_GridSize Page"
onPageShow() {
console.info('Grid_RowCol_GridSize page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'changeHeight') {
this.changeHeight = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Grid_RowCol_GridSize page build done called');
}
build() {
Column() {
Grid() {
GridItem() {
Text('1').fontSize(16).backgroundColor(0xF9CF93).width('100%').height('100%')
}.key('Grid_RowCol_GridSize_011')
GridItem() {
Text('2').fontSize(16).backgroundColor(0xF5DEB3).width('100%').height('100%')
}.key('Grid_RowCol_GridSize_012')
GridItem() {
Text('3').fontSize(16).backgroundColor(0xD2B48C).width('100%').height('100%')
}.key('Grid_RowCol_GridSize_013')
GridItem() {
Text('4').fontSize(16).backgroundColor(0xffa500).width('100%').height('100%')
}.key('Grid_RowCol_GridSize_014')
}
.columnsTemplate("1fr 1fr")
.rowsTemplate("1fr 1fr")
.width(200)
.height(this.changeHeight)
.backgroundColor(0xFAEEE0).key('Grid_RowCol_GridSize_01')
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../../common/MessageManager';
@Entry
@Component
struct Grid_RowCol_LayoutDirection {
@State addLayoutDirection: number = GridDirection.RowReverse;
messageManager:MessageManager = new MessageManager()
private content: string = "Grid_RowCol_LayoutDirection Page"
onPageShow() {
console.info('Grid_RowCol_LayoutDirection page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'addLayoutDirection') {
this.addLayoutDirection = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Grid_RowCol_LayoutDirection page build done called');
}
build() {
Column() {
Grid() {
GridItem() {
Text('1').fontSize(16).backgroundColor(0xF9CF93).width('100%').height('100%')
}.key('Grid_RowCol_LayoutDirection_011')
GridItem() {
Text('2').fontSize(16).backgroundColor(0xF5DEB3).width('100%').height('100%')
}.key('Grid_RowCol_LayoutDirection_012')
GridItem() {
Text('3').fontSize(16).backgroundColor(0xD2B48C).width('100%').height('100%')
}.key('Grid_RowCol_LayoutDirection_013')
GridItem() {
Text('4').fontSize(16).backgroundColor(0xffa500).width('100%').height('100%')
}.key('Grid_RowCol_LayoutDirection_014')
}
.columnsTemplate('1fr 1fr')
.rowsTemplate('1fr 1fr')
.width(300)
.height(300)
.backgroundColor(0xFAEEE0)
.key('Grid_RowCol_LayoutDirection_01')
.layoutDirection(this.addLayoutDirection)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../../common/MessageManager';
@Entry
@Component
struct Grid_RowCol_PadMar {
@State addPadding: number = 10
@State addMargin: number = 0
messageManager:MessageManager = new MessageManager()
private content: string = "Grid_RowCol_PadMar Page"
onPageShow() {
console.info('Grid_RowCol_PadMar page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'addPadding') {
this.addPadding = message.value;
}
if (message.name == 'addMargin') {
this.addMargin = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Grid_RowCol_PadMar page build done called');
}
build() {
Column() {
Grid() {
GridItem() {
Text('1').fontSize(16).backgroundColor(0xF9CF93).width('100%').height('100%')
}.key('Grid_RowCol_PadMar_011')
GridItem() {
Text('2').fontSize(16).backgroundColor(0xF5DEB3).width('100%').height('100%')
}.key('Grid_RowCol_PadMar_012')
GridItem() {
Text('3').fontSize(16).backgroundColor(0xD2B48C).width('100%').height('100%')
}.key('Grid_RowCol_PadMar_013')
GridItem() {
Text('4').fontSize(16).backgroundColor(0xffa500).width('100%').height('100%')
}.key('Grid_RowCol_PadMar_014')
}
.columnsTemplate("1fr 1fr")
.rowsTemplate("1fr 1fr")
.width(300)
.height(300)
.backgroundColor(0xFAEEE0)
.key('Grid_RowCol_PadMar_01')
.padding(this.addPadding)
.margin(this.addMargin)
}
.width(320)
.height(320)
.key('Grid_RowCol_PadMar_Box_01')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../../common/MessageManager';
@Entry
@Component
struct Grid_RowCol_cellLength {
@State addCellLength: number = 50;
messageManager:MessageManager = new MessageManager()
private content: string = "Grid_RowCol_cellLength Page"
onPageShow() {
console.info('Grid_RowCol_cellLength page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'addCellLength') {
this.addCellLength = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Grid_RowCol_cellLength page build done called');
}
build() {
Column() {
Grid() {
GridItem() {
Text('1').fontSize(16).backgroundColor(0xF9CF93).width('100%').height('100%')
}.key('Grid_RowCol_cellLength_011')
GridItem() {
Text('2').fontSize(16).backgroundColor(0xF5DEB3).width('100%').height('100%')
}.key('Grid_RowCol_cellLength_012')
GridItem() {
Text('3').fontSize(16).backgroundColor(0xD2B48C).width('100%').height('100%')
}.key('Grid_RowCol_cellLength_013')
GridItem() {
Text('4').fontSize(16).backgroundColor(0xffa500).width('100%').height('100%')
}.key('Grid_RowCol_cellLength_014')
}
.columnsTemplate('1fr 1fr')
.rowsTemplate('1fr 1fr')
.width(300)
.height(300)
.backgroundColor(0xFAEEE0).key('Grid_RowCol_cellLength_01')
.cellLength(this.addCellLength)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../../common/MessageManager';
@Entry
@Component
struct Grid_RowCol_maxCount {
@State addMaxCount: number = 1;
messageManager:MessageManager = new MessageManager()
private content: string = "Grid_RowCol_maxCount Page"
onPageShow() {
console.info('Grid_RowCol_maxCount page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'addMaxCount') {
this.addMaxCount = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Grid_RowCol_maxCount page build done called');
}
build() {
Column() {
Grid() {
GridItem() {
Text('1').fontSize(16).backgroundColor(0xF9CF93).width('100%').height('100%')
}.key('Grid_RowCol_maxCount_011')
GridItem() {
Text('2').fontSize(16).backgroundColor(0xF5DEB3).width('100%').height('100%')
}.key('Grid_RowCol_maxCount_012')
GridItem() {
Text('3').fontSize(16).backgroundColor(0xD2B48C).width('100%').height('100%')
}.key('Grid_RowCol_maxCount_013')
GridItem() {
Text('4').fontSize(16).backgroundColor(0xffa500).width('100%').height('100%')
}.key('Grid_RowCol_maxCount_014')
}
.columnsTemplate('1fr 1fr')
.rowsTemplate('1fr 1fr')
.width(300)
.height(300)
.backgroundColor(0xFAEEE0)
.key('Grid_RowCol_maxCount_01')
.maxCount(this.addMaxCount)
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../../common/MessageManager';
@Entry
@Component
struct Grid_RowCol_TemplateChange {
@State testColumnsTemplate: string = '1fr 1fr'
@State testRowsTemplate: string = '1fr 1fr'
messageManager:MessageManager = new MessageManager()
private content: string = "Grid_RowCol_TemplateChange Page"
onPageShow() {
console.info('Grid_RowCol_TemplateChange page show called');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'testColumnsTemplate') {
this.testColumnsTemplate = message.value;
}
if (message.name == 'testRowsTemplate') {
this.testRowsTemplate = message.value;
}
}
this.messageManager.registerCallback(callback);
}
onBuildDone() {
console.info('Grid_RowCol_TemplateChange page build done called');
}
build() {
Column() {
Grid() {
GridItem() {
Text('1').fontSize(16).backgroundColor(0xF9CF93).width('100%').height('100%')
}.key('GridTemplateChange_Grid_011')
GridItem() {
Text('2').fontSize(16).backgroundColor(0xF5DEB3).width('100%').height('100%')
}.key('GridTemplateChange_Grid_012')
GridItem() {
Text('3').fontSize(16).backgroundColor(0xD2B48C).width('100%').height('100%')
}.key('GridTemplateChange_Grid_013')
GridItem() {
Text('4').fontSize(16).backgroundColor(0xffa500).width('100%').height('100%')
}.key('GridTemplateChange_Grid_014')
}
.columnsTemplate(this.testColumnsTemplate)
.rowsTemplate(this.testRowsTemplate)
.width(300)
.height(300)
.backgroundColor(0xFAEEE0).key('GridTemplateChange_Grid_01')
}.width('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager';
export default function Grid_RowCol_Gap() {
describe('Grid_RowCol_GapTest', function () {
beforeEach(async function (done) {
console.info("Grid_RowCol_Gap beforeEach start");
let options = {
url: "MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_Gap",
}
try {
router.clear();
let pages = router.getState();
console.info("get Grid_RowCol_Gap state pages:" + JSON.stringify(pages));
if (!("Grid_RowCol_Gap" == pages.name)) {
console.info("get Grid_RowCol_Gap pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Grid_RowCol_Gap page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Grid_RowCol_Gap page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Grid_RowCol_Gap after each called")
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0600
* @tc.name Grid_RowCol_Gap
* @tc.desc Add columnGap,Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0600', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0600] START');
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_Gap_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_Gap_011 = CommonFunc.getComponentRect('Grid_RowCol_Gap_011');
let Grid_RowCol_Gap_012 = CommonFunc.getComponentRect('Grid_RowCol_Gap_012');
let Grid_RowCol_Gap_013 = CommonFunc.getComponentRect('Grid_RowCol_Gap_013');
let Grid_RowCol_Gap_014 = CommonFunc.getComponentRect('Grid_RowCol_Gap_014');
let Grid_RowCol_Gap_01 = CommonFunc.getComponentRect('Grid_RowCol_Gap_01');
expect(Grid_RowCol_Gap_011.left).assertEqual(Grid_RowCol_Gap_01.left);
expect(Grid_RowCol_Gap_013.left).assertEqual(Grid_RowCol_Gap_01.left);
expect(Grid_RowCol_Gap_012.left - Grid_RowCol_Gap_011.right).assertEqual(vp2px(5));
expect(Grid_RowCol_Gap_014.left - Grid_RowCol_Gap_013.right).assertEqual(vp2px(5));
expect(Grid_RowCol_Gap_012.right).assertEqual(Grid_RowCol_Gap_01.right);
expect(Grid_RowCol_Gap_014.right).assertEqual(Grid_RowCol_Gap_01.right);
expect(Grid_RowCol_Gap_011.top).assertEqual(Grid_RowCol_Gap_01.top);
expect(Grid_RowCol_Gap_012.top).assertEqual(Grid_RowCol_Gap_01.top);
expect(Grid_RowCol_Gap_011.bottom).assertEqual(Grid_RowCol_Gap_013.top);
expect(Grid_RowCol_Gap_012.bottom).assertEqual(Grid_RowCol_Gap_014.top);
expect(Grid_RowCol_Gap_013.bottom).assertEqual(Grid_RowCol_Gap_01.bottom);
expect(Grid_RowCol_Gap_014.bottom).assertEqual(Grid_RowCol_Gap_01.bottom);
expect(Grid_RowCol_Gap_011.right).assertEqual(Grid_RowCol_Gap_013.right);
expect(Grid_RowCol_Gap_012.left).assertEqual(Grid_RowCol_Gap_014.left);
expect(Grid_RowCol_Gap_011.right - Grid_RowCol_Gap_011.left).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_012.right - Grid_RowCol_Gap_012.left).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_013.right - Grid_RowCol_Gap_013.left).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_014.right - Grid_RowCol_Gap_014.left).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_011.bottom - Grid_RowCol_Gap_011.top).assertEqual(vp2px(150));
expect(Grid_RowCol_Gap_012.bottom - Grid_RowCol_Gap_012.top).assertEqual(vp2px(150));
expect(Grid_RowCol_Gap_013.bottom - Grid_RowCol_Gap_013.top).assertEqual(vp2px(150));
expect(Grid_RowCol_Gap_014.bottom - Grid_RowCol_Gap_014.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0600] END');
done();
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0700
* @tc.name Grid_RowCol_Gap
* @tc.desc Add rowGap,Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0700', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0700] START');
globalThis.value.message.notify({name:'addColumnGap', value:0});
globalThis.value.message.notify({name:'addRowGap', value:5});
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_Gap_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_Gap_011 = CommonFunc.getComponentRect('Grid_RowCol_Gap_011');
let Grid_RowCol_Gap_012 = CommonFunc.getComponentRect('Grid_RowCol_Gap_012');
let Grid_RowCol_Gap_013 = CommonFunc.getComponentRect('Grid_RowCol_Gap_013');
let Grid_RowCol_Gap_014 = CommonFunc.getComponentRect('Grid_RowCol_Gap_014');
let Grid_RowCol_Gap_01 = CommonFunc.getComponentRect('Grid_RowCol_Gap_01');
expect(Grid_RowCol_Gap_011.left).assertEqual(Grid_RowCol_Gap_01.left);
expect(Grid_RowCol_Gap_013.left).assertEqual(Grid_RowCol_Gap_01.left);
expect(Grid_RowCol_Gap_011.right).assertEqual(Grid_RowCol_Gap_012.left);
expect(Grid_RowCol_Gap_013.right).assertEqual(Grid_RowCol_Gap_014.left);
expect(Grid_RowCol_Gap_012.right).assertEqual(Grid_RowCol_Gap_014.right);
expect(Grid_RowCol_Gap_012.right).assertEqual(Grid_RowCol_Gap_01.right);
expect(Grid_RowCol_Gap_011.top).assertEqual(Grid_RowCol_Gap_01.top);
expect(Grid_RowCol_Gap_011.top).assertEqual(Grid_RowCol_Gap_012.top);
expect(Grid_RowCol_Gap_013.bottom).assertEqual(Grid_RowCol_Gap_01.bottom);
expect(Grid_RowCol_Gap_014.bottom).assertEqual(Grid_RowCol_Gap_01.bottom);
expect(Grid_RowCol_Gap_013.top).assertEqual(Grid_RowCol_Gap_014.top);
expect(Grid_RowCol_Gap_011.bottom).assertEqual(Grid_RowCol_Gap_012.bottom);
expect(Grid_RowCol_Gap_013.top - Grid_RowCol_Gap_011.bottom).assertEqual(vp2px(5));
expect(Grid_RowCol_Gap_014.top - Grid_RowCol_Gap_012.bottom).assertEqual(vp2px(5));
expect(Grid_RowCol_Gap_011.right - Grid_RowCol_Gap_011.left).assertEqual(vp2px(150));
expect(Grid_RowCol_Gap_012.right - Grid_RowCol_Gap_012.left).assertEqual(vp2px(150));
expect(Grid_RowCol_Gap_013.right - Grid_RowCol_Gap_013.left).assertEqual(vp2px(150));
expect(Grid_RowCol_Gap_014.right - Grid_RowCol_Gap_014.left).assertEqual(vp2px(150));
expect(Grid_RowCol_Gap_011.bottom - Grid_RowCol_Gap_011.top).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_012.bottom - Grid_RowCol_Gap_012.top).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_013.bottom - Grid_RowCol_Gap_013.top).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_014.bottom - Grid_RowCol_Gap_014.top).assertEqual(vp2px(147.5));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0700] END');
done();
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0800
* @tc.name Grid_RowCol_Gap
* @tc.desc Add columnGap and rowGap,Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0800', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0800] START');
globalThis.value.message.notify({name:'addColumnGap', value:5});
globalThis.value.message.notify({name:'addRowGap', value:5});
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_Gap_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_Gap_011 = CommonFunc.getComponentRect('Grid_RowCol_Gap_011');
let Grid_RowCol_Gap_012 = CommonFunc.getComponentRect('Grid_RowCol_Gap_012');
let Grid_RowCol_Gap_013 = CommonFunc.getComponentRect('Grid_RowCol_Gap_013');
let Grid_RowCol_Gap_014 = CommonFunc.getComponentRect('Grid_RowCol_Gap_014');
let Grid_RowCol_Gap_01 = CommonFunc.getComponentRect('Grid_RowCol_Gap_01');
expect(Grid_RowCol_Gap_011.left).assertEqual(Grid_RowCol_Gap_01.left);
expect(Grid_RowCol_Gap_013.left).assertEqual(Grid_RowCol_Gap_01.left);
expect(Grid_RowCol_Gap_012.right).assertEqual(Grid_RowCol_Gap_014.right);
expect(Grid_RowCol_Gap_012.right).assertEqual(Grid_RowCol_Gap_01.right);
expect(Grid_RowCol_Gap_011.top).assertEqual(Grid_RowCol_Gap_01.top);
expect(Grid_RowCol_Gap_011.top).assertEqual(Grid_RowCol_Gap_012.top);
expect(Grid_RowCol_Gap_013.bottom).assertEqual(Grid_RowCol_Gap_01.bottom);
expect(Grid_RowCol_Gap_014.bottom).assertEqual(Grid_RowCol_Gap_01.bottom);
expect(Grid_RowCol_Gap_013.top).assertEqual(Grid_RowCol_Gap_014.top);
expect(Grid_RowCol_Gap_011.bottom).assertEqual(Grid_RowCol_Gap_012.bottom);
expect(Grid_RowCol_Gap_013.top - Grid_RowCol_Gap_011.bottom).assertEqual(vp2px(5));
expect(Grid_RowCol_Gap_014.top - Grid_RowCol_Gap_012.bottom).assertEqual(vp2px(5));
expect(Grid_RowCol_Gap_012.left - Grid_RowCol_Gap_011.right).assertEqual(vp2px(5));
expect(Grid_RowCol_Gap_014.left - Grid_RowCol_Gap_013.right).assertEqual(vp2px(5));
expect(Grid_RowCol_Gap_011.right - Grid_RowCol_Gap_011.left).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_012.right - Grid_RowCol_Gap_012.left).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_013.right - Grid_RowCol_Gap_013.left).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_014.right - Grid_RowCol_Gap_014.left).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_011.bottom - Grid_RowCol_Gap_011.top).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_012.bottom - Grid_RowCol_Gap_012.top).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_013.bottom - Grid_RowCol_Gap_013.top).assertEqual(vp2px(147.5));
expect(Grid_RowCol_Gap_014.bottom - Grid_RowCol_Gap_014.top).assertEqual(vp2px(147.5));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0800] END');
done();
});
})
}
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager';
export default function Grid_RowCol_GridSize() {
describe('Grid_RowCol_GridSizeTest', function () {
beforeEach(async function (done) {
console.info("Grid_RowCol_GridSize beforeEach start");
let options = {
url: "MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_GridSize",
}
try {
router.clear();
let pages = router.getState();
console.info("get Grid_RowCol_GridSize state pages:" + JSON.stringify(pages));
if (!("Grid_RowCol_GridSize" == pages.name)) {
console.info("get Grid_RowCol_GridSize pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Grid_RowCol_GridSize page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Grid_RowCol_GridSize page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Grid_RowCol_GridSize after each called")
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0100
* @tc.name Grid_RowCol_GridSize
* @tc.desc The Width 200 height 200,Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0100', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0100] START');
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_GridSize_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_GridSize_011 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_011');
let Grid_RowCol_GridSize_012 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_012');
let Grid_RowCol_GridSize_013 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_013');
let Grid_RowCol_GridSize_014 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_014');
let Grid_RowCol_GridSize_01 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_01');
expect(Grid_RowCol_GridSize_011.left).assertEqual(Grid_RowCol_GridSize_01.left);
expect(Grid_RowCol_GridSize_013.left).assertEqual(Grid_RowCol_GridSize_01.left);
expect(Grid_RowCol_GridSize_011.right).assertEqual(Grid_RowCol_GridSize_012.left);
expect(Grid_RowCol_GridSize_013.right).assertEqual(Grid_RowCol_GridSize_014.left);
expect(Grid_RowCol_GridSize_012.right).assertEqual(Grid_RowCol_GridSize_01.right);
expect(Grid_RowCol_GridSize_014.right).assertEqual(Grid_RowCol_GridSize_01.right);
expect(Grid_RowCol_GridSize_011.top).assertEqual(Grid_RowCol_GridSize_01.top);
expect(Grid_RowCol_GridSize_012.top).assertEqual(Grid_RowCol_GridSize_01.top);
expect(Grid_RowCol_GridSize_011.bottom).assertEqual(Grid_RowCol_GridSize_013.top);
expect(Grid_RowCol_GridSize_012.bottom).assertEqual(Grid_RowCol_GridSize_014.top);
expect(Grid_RowCol_GridSize_013.bottom).assertEqual(Grid_RowCol_GridSize_01.bottom);
expect(Grid_RowCol_GridSize_014.bottom).assertEqual(Grid_RowCol_GridSize_01.bottom);
expect(Grid_RowCol_GridSize_011.right - Grid_RowCol_GridSize_011.left).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_012.right - Grid_RowCol_GridSize_012.left).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_013.right - Grid_RowCol_GridSize_013.left).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_014.right - Grid_RowCol_GridSize_014.left).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_011.bottom - Grid_RowCol_GridSize_011.top).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_012.bottom - Grid_RowCol_GridSize_012.top).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_013.bottom - Grid_RowCol_GridSize_013.top).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_014.bottom - Grid_RowCol_GridSize_014.top).assertEqual(vp2px(100));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0100] END');
done();
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0200
* @tc.name Grid_RowCol_GridSize
* @tc.desc The Width 200 height 300,Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0200', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0200] START');
globalThis.value.message.notify({name:'changeHeight', value:300});
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_GridSize_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_GridSize_011 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_011');
let Grid_RowCol_GridSize_012 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_012');
let Grid_RowCol_GridSize_013 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_013');
let Grid_RowCol_GridSize_014 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_014');
let Grid_RowCol_GridSize_01 = CommonFunc.getComponentRect('Grid_RowCol_GridSize_01');
expect(Grid_RowCol_GridSize_011.left).assertEqual(Grid_RowCol_GridSize_01.left);
expect(Grid_RowCol_GridSize_013.left).assertEqual(Grid_RowCol_GridSize_01.left);
expect(Grid_RowCol_GridSize_011.right).assertEqual(Grid_RowCol_GridSize_012.left);
expect(Grid_RowCol_GridSize_013.right).assertEqual(Grid_RowCol_GridSize_014.left);
expect(Grid_RowCol_GridSize_012.right).assertEqual(Grid_RowCol_GridSize_01.right);
expect(Grid_RowCol_GridSize_014.right).assertEqual(Grid_RowCol_GridSize_01.right);
expect(Grid_RowCol_GridSize_011.top).assertEqual(Grid_RowCol_GridSize_01.top);
expect(Grid_RowCol_GridSize_012.top).assertEqual(Grid_RowCol_GridSize_01.top);
expect(Grid_RowCol_GridSize_011.bottom).assertEqual(Grid_RowCol_GridSize_013.top);
expect(Grid_RowCol_GridSize_012.bottom).assertEqual(Grid_RowCol_GridSize_014.top);
expect(Grid_RowCol_GridSize_013.bottom).assertEqual(Grid_RowCol_GridSize_01.bottom);
expect(Grid_RowCol_GridSize_014.bottom).assertEqual(Grid_RowCol_GridSize_01.bottom);
expect(Grid_RowCol_GridSize_011.right - Grid_RowCol_GridSize_011.left).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_012.right - Grid_RowCol_GridSize_012.left).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_013.right - Grid_RowCol_GridSize_013.left).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_014.right - Grid_RowCol_GridSize_014.left).assertEqual(vp2px(100));
expect(Grid_RowCol_GridSize_011.bottom - Grid_RowCol_GridSize_011.top).assertEqual(vp2px(150));
expect(Grid_RowCol_GridSize_012.bottom - Grid_RowCol_GridSize_012.top).assertEqual(vp2px(150));
expect(Grid_RowCol_GridSize_013.bottom - Grid_RowCol_GridSize_013.top).assertEqual(vp2px(150));
expect(Grid_RowCol_GridSize_014.bottom - Grid_RowCol_GridSize_014.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0200] END');
done();
});
})
}
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager';
export default function Grid_RowCol_LayoutDirection() {
describe('Grid_RowCol_LayoutDirectionTest', function () {
beforeEach(async function (done) {
console.info("Grid_RowCol_LayoutDirection beforeEach start");
let options = {
url: "MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_LayoutDirection",
}
try {
router.clear();
let pages = router.getState();
console.info("get Grid_RowCol_LayoutDirection state pages:" + JSON.stringify(pages));
if (!("Grid_RowCol_LayoutDirection" == pages.name)) {
console.info("get Grid_RowCol_LayoutDirection pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Grid_RowCol_LayoutDirection page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Grid_RowCol_LayoutDirection page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Grid_RowCol_LayoutDirection after each called")
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0900
* @tc.name Grid_RowCol_LayoutDirection
* @tc.desc The Grid layout layoutDirection property does not take effect
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0900', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0900] START');
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_LayoutDirection_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_LayoutDirection_011 = CommonFunc.getComponentRect('Grid_RowCol_LayoutDirection_011');
let Grid_RowCol_LayoutDirection_012 = CommonFunc.getComponentRect('Grid_RowCol_LayoutDirection_012');
let Grid_RowCol_LayoutDirection_013 = CommonFunc.getComponentRect('Grid_RowCol_LayoutDirection_013');
let Grid_RowCol_LayoutDirection_014 = CommonFunc.getComponentRect('Grid_RowCol_LayoutDirection_014');
let Grid_RowCol_LayoutDirection_01 = CommonFunc.getComponentRect('Grid_RowCol_LayoutDirection_01');
expect(Grid_RowCol_LayoutDirection_011.left).assertEqual(Grid_RowCol_LayoutDirection_01.left);
expect(Grid_RowCol_LayoutDirection_013.left).assertEqual(Grid_RowCol_LayoutDirection_01.left);
expect(Grid_RowCol_LayoutDirection_011.right).assertEqual(Grid_RowCol_LayoutDirection_012.left);
expect(Grid_RowCol_LayoutDirection_013.right).assertEqual(Grid_RowCol_LayoutDirection_014.left);
expect(Grid_RowCol_LayoutDirection_012.right).assertEqual(Grid_RowCol_LayoutDirection_01.right);
expect(Grid_RowCol_LayoutDirection_014.right).assertEqual(Grid_RowCol_LayoutDirection_01.right);
expect(Grid_RowCol_LayoutDirection_011.top).assertEqual(Grid_RowCol_LayoutDirection_01.top);
expect(Grid_RowCol_LayoutDirection_012.top).assertEqual(Grid_RowCol_LayoutDirection_01.top);
expect(Grid_RowCol_LayoutDirection_011.bottom).assertEqual(Grid_RowCol_LayoutDirection_013.top);
expect(Grid_RowCol_LayoutDirection_012.bottom).assertEqual(Grid_RowCol_LayoutDirection_014.top);
expect(Grid_RowCol_LayoutDirection_013.bottom).assertEqual(Grid_RowCol_LayoutDirection_01.bottom);
expect(Grid_RowCol_LayoutDirection_014.bottom).assertEqual(Grid_RowCol_LayoutDirection_01.bottom);
expect(Grid_RowCol_LayoutDirection_011.right - Grid_RowCol_LayoutDirection_011.left).assertEqual(vp2px(150));
expect(Grid_RowCol_LayoutDirection_012.right - Grid_RowCol_LayoutDirection_012.left).assertEqual(vp2px(150));
expect(Grid_RowCol_LayoutDirection_013.right - Grid_RowCol_LayoutDirection_013.left).assertEqual(vp2px(150));
expect(Grid_RowCol_LayoutDirection_014.right - Grid_RowCol_LayoutDirection_014.left).assertEqual(vp2px(150));
expect(Grid_RowCol_LayoutDirection_011.bottom - Grid_RowCol_LayoutDirection_011.top).assertEqual(vp2px(150));
expect(Grid_RowCol_LayoutDirection_012.bottom - Grid_RowCol_LayoutDirection_012.top).assertEqual(vp2px(150));
expect(Grid_RowCol_LayoutDirection_013.bottom - Grid_RowCol_LayoutDirection_013.top).assertEqual(vp2px(150));
expect(Grid_RowCol_LayoutDirection_014.bottom - Grid_RowCol_LayoutDirection_014.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0900] END');
done();
});
})
}
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager';
export default function Grid_RowCol_PadMar() {
describe('Grid_RowCol_PadMarTest', function () {
beforeEach(async function (done) {
console.info("Grid_RowCol_PadMar beforeEach start");
let options = {
url: "MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_PadMar",
}
try {
router.clear();
let pages = router.getState();
console.info("get Grid_RowCol_PadMar state pages:" + JSON.stringify(pages));
if (!("Grid_RowCol_PadMar" == pages.name)) {
console.info("get Grid_RowCol_PadMar pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Grid_RowCol_PadMar page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Grid_RowCol_PadMar page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Grid_RowCol_PadMar after each called")
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0300
* @tc.name Grid_RowCol_PadMar
* @tc.desc Add padding,Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0300', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0300] START');
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_PadMar_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_PadMar_011 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_011');
let Grid_RowCol_PadMar_012 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_012');
let Grid_RowCol_PadMar_013 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_013');
let Grid_RowCol_PadMar_014 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_014');
let Grid_RowCol_PadMar_01 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_01');
expect(Grid_RowCol_PadMar_011.left - Grid_RowCol_PadMar_01.left).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_013.left).assertEqual(Grid_RowCol_PadMar_011.left);
expect(Grid_RowCol_PadMar_011.right).assertEqual(Grid_RowCol_PadMar_012.left);
expect(Grid_RowCol_PadMar_013.right).assertEqual(Grid_RowCol_PadMar_014.left);
expect(Grid_RowCol_PadMar_01.right - Grid_RowCol_PadMar_012.right).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_014.right).assertEqual(Grid_RowCol_PadMar_012.right);
expect(Grid_RowCol_PadMar_011.top - Grid_RowCol_PadMar_01.top).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_012.top).assertEqual(Grid_RowCol_PadMar_011.top);
expect(Grid_RowCol_PadMar_011.bottom).assertEqual(Grid_RowCol_PadMar_013.top);
expect(Grid_RowCol_PadMar_012.bottom).assertEqual(Grid_RowCol_PadMar_014.top);
expect(Grid_RowCol_PadMar_01.bottom - Grid_RowCol_PadMar_013.bottom).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_013.bottom).assertEqual(Grid_RowCol_PadMar_014.bottom);
expect(Grid_RowCol_PadMar_011.right - Grid_RowCol_PadMar_011.left).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_012.right - Grid_RowCol_PadMar_012.left).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_013.right - Grid_RowCol_PadMar_013.left).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_014.right - Grid_RowCol_PadMar_014.left).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_011.bottom - Grid_RowCol_PadMar_011.top).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_012.bottom - Grid_RowCol_PadMar_012.top).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_013.bottom - Grid_RowCol_PadMar_013.top).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_014.bottom - Grid_RowCol_PadMar_014.top).assertEqual(vp2px(140));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0300] END');
done();
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0400
* @tc.name Grid_RowCol_PadMar
* @tc.desc Add margin,Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0400', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0400] START');
globalThis.value.message.notify({name:'addPadding', value:0});
globalThis.value.message.notify({name:'addMargin', value:10});
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_PadMar_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_PadMar_011 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_011');
let Grid_RowCol_PadMar_012 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_012');
let Grid_RowCol_PadMar_013 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_013');
let Grid_RowCol_PadMar_014 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_014');
let Grid_RowCol_PadMar_01 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_01');
let Grid_RowCol_PadMar_Box_01 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_Box_01');
expect(Grid_RowCol_PadMar_011.left).assertEqual(Grid_RowCol_PadMar_01.left);
expect(Grid_RowCol_PadMar_013.left).assertEqual(Grid_RowCol_PadMar_01.left);
expect(Grid_RowCol_PadMar_011.right).assertEqual(Grid_RowCol_PadMar_012.left);
expect(Grid_RowCol_PadMar_013.right).assertEqual(Grid_RowCol_PadMar_014.left);
expect(Grid_RowCol_PadMar_01.right).assertEqual(Grid_RowCol_PadMar_012.right);
expect(Grid_RowCol_PadMar_014.right).assertEqual(Grid_RowCol_PadMar_012.right);
expect(Grid_RowCol_PadMar_011.top).assertEqual(Grid_RowCol_PadMar_01.top);
expect(Grid_RowCol_PadMar_012.top).assertEqual(Grid_RowCol_PadMar_011.top);
expect(Grid_RowCol_PadMar_011.bottom).assertEqual(Grid_RowCol_PadMar_013.top);
expect(Grid_RowCol_PadMar_012.bottom).assertEqual(Grid_RowCol_PadMar_014.top);
expect(Grid_RowCol_PadMar_01.bottom).assertEqual(Grid_RowCol_PadMar_013.bottom);
expect(Grid_RowCol_PadMar_013.bottom).assertEqual(Grid_RowCol_PadMar_014.bottom);
expect(Grid_RowCol_PadMar_01.left - Grid_RowCol_PadMar_Box_01.left).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_01.top - Grid_RowCol_PadMar_Box_01.top).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_Box_01.right - Grid_RowCol_PadMar_01.right).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_Box_01.bottom - Grid_RowCol_PadMar_01.bottom).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_011.right - Grid_RowCol_PadMar_011.left).assertEqual(vp2px(150));
expect(Grid_RowCol_PadMar_012.right - Grid_RowCol_PadMar_012.left).assertEqual(vp2px(150));
expect(Grid_RowCol_PadMar_013.right - Grid_RowCol_PadMar_013.left).assertEqual(vp2px(150));
expect(Grid_RowCol_PadMar_014.right - Grid_RowCol_PadMar_014.left).assertEqual(vp2px(150));
expect(Grid_RowCol_PadMar_011.bottom - Grid_RowCol_PadMar_011.top).assertEqual(vp2px(150));
expect(Grid_RowCol_PadMar_012.bottom - Grid_RowCol_PadMar_012.top).assertEqual(vp2px(150));
expect(Grid_RowCol_PadMar_013.bottom - Grid_RowCol_PadMar_013.top).assertEqual(vp2px(150));
expect(Grid_RowCol_PadMar_014.bottom - Grid_RowCol_PadMar_014.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0400] END');
done();
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0500
* @tc.name Grid_RowCol_PadMar
* @tc.desc Add padding and margin,Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0500', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0500] START');
globalThis.value.message.notify({name:'addPadding', value:10});
globalThis.value.message.notify({name:'addMargin', value:10});
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_PadMar_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_PadMar_011 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_011');
let Grid_RowCol_PadMar_012 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_012');
let Grid_RowCol_PadMar_013 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_013');
let Grid_RowCol_PadMar_014 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_014');
let Grid_RowCol_PadMar_01 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_01');
let Grid_RowCol_PadMar_Box_01 = CommonFunc.getComponentRect('Grid_RowCol_PadMar_Box_01');
expect(Grid_RowCol_PadMar_011.left - Grid_RowCol_PadMar_01.left).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_013.left).assertEqual(Grid_RowCol_PadMar_011.left);
expect(Grid_RowCol_PadMar_011.right).assertEqual(Grid_RowCol_PadMar_012.left);
expect(Grid_RowCol_PadMar_013.right).assertEqual(Grid_RowCol_PadMar_014.left);
expect(Grid_RowCol_PadMar_01.right - Grid_RowCol_PadMar_012.right).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_014.right).assertEqual(Grid_RowCol_PadMar_012.right);
expect(Grid_RowCol_PadMar_011.top - Grid_RowCol_PadMar_01.top).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_012.top).assertEqual(Grid_RowCol_PadMar_011.top);
expect(Grid_RowCol_PadMar_011.bottom).assertEqual(Grid_RowCol_PadMar_013.top);
expect(Grid_RowCol_PadMar_012.bottom).assertEqual(Grid_RowCol_PadMar_014.top);
expect(Grid_RowCol_PadMar_01.bottom - Grid_RowCol_PadMar_013.bottom).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_013.bottom).assertEqual(Grid_RowCol_PadMar_014.bottom);
expect(Grid_RowCol_PadMar_01.left - Grid_RowCol_PadMar_Box_01.left).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_01.top - Grid_RowCol_PadMar_Box_01.top).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_Box_01.right - Grid_RowCol_PadMar_01.right).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_Box_01.bottom - Grid_RowCol_PadMar_01.bottom).assertEqual(vp2px(10));
expect(Grid_RowCol_PadMar_011.right - Grid_RowCol_PadMar_011.left).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_012.right - Grid_RowCol_PadMar_012.left).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_013.right - Grid_RowCol_PadMar_013.left).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_014.right - Grid_RowCol_PadMar_014.left).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_011.bottom - Grid_RowCol_PadMar_011.top).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_012.bottom - Grid_RowCol_PadMar_012.top).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_013.bottom - Grid_RowCol_PadMar_013.top).assertEqual(vp2px(140));
expect(Grid_RowCol_PadMar_014.bottom - Grid_RowCol_PadMar_014.top).assertEqual(vp2px(140));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_0500] END');
done();
});
})
}
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager';
export default function Grid_RowCol_cellLength() {
describe('Grid_RowCol_cellLengthTest', function () {
beforeEach(async function (done) {
console.info("Grid_RowCol_cellLength beforeEach start");
let options = {
url: "MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_cellLength",
}
try {
router.clear();
let pages = router.getState();
console.info("get Grid_RowCol_cellLength state pages:" + JSON.stringify(pages));
if (!("Grid_RowCol_cellLength" == pages.name)) {
console.info("get Grid_RowCol_cellLength pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Grid_RowCol_cellLength page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Grid_RowCol_cellLength page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Grid_RowCol_cellLength after each called")
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_1100
* @tc.name Grid_RowCol_cellLength
* @tc.desc The Grid layout cellLength property does not take effect
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_1100', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_1100] START');
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_cellLength_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_cellLength_011 = CommonFunc.getComponentRect('Grid_RowCol_cellLength_011');
let Grid_RowCol_cellLength_012 = CommonFunc.getComponentRect('Grid_RowCol_cellLength_012');
let Grid_RowCol_cellLength_013 = CommonFunc.getComponentRect('Grid_RowCol_cellLength_013');
let Grid_RowCol_cellLength_014 = CommonFunc.getComponentRect('Grid_RowCol_cellLength_014');
let Grid_RowCol_cellLength_01 = CommonFunc.getComponentRect('Grid_RowCol_cellLength_01');
expect(Grid_RowCol_cellLength_011.left).assertEqual(Grid_RowCol_cellLength_01.left);
expect(Grid_RowCol_cellLength_013.left).assertEqual(Grid_RowCol_cellLength_01.left);
expect(Grid_RowCol_cellLength_011.right).assertEqual(Grid_RowCol_cellLength_012.left);
expect(Grid_RowCol_cellLength_013.right).assertEqual(Grid_RowCol_cellLength_014.left);
expect(Grid_RowCol_cellLength_012.right).assertEqual(Grid_RowCol_cellLength_01.right);
expect(Grid_RowCol_cellLength_014.right).assertEqual(Grid_RowCol_cellLength_01.right);
expect(Grid_RowCol_cellLength_011.top).assertEqual(Grid_RowCol_cellLength_01.top);
expect(Grid_RowCol_cellLength_012.top).assertEqual(Grid_RowCol_cellLength_01.top);
expect(Grid_RowCol_cellLength_011.bottom).assertEqual(Grid_RowCol_cellLength_013.top);
expect(Grid_RowCol_cellLength_012.bottom).assertEqual(Grid_RowCol_cellLength_014.top);
expect(Grid_RowCol_cellLength_013.bottom).assertEqual(Grid_RowCol_cellLength_01.bottom);
expect(Grid_RowCol_cellLength_014.bottom).assertEqual(Grid_RowCol_cellLength_01.bottom);
expect(Grid_RowCol_cellLength_011.right - Grid_RowCol_cellLength_011.left).assertEqual(vp2px(150));
expect(Grid_RowCol_cellLength_012.right - Grid_RowCol_cellLength_012.left).assertEqual(vp2px(150));
expect(Grid_RowCol_cellLength_013.right - Grid_RowCol_cellLength_013.left).assertEqual(vp2px(150));
expect(Grid_RowCol_cellLength_014.right - Grid_RowCol_cellLength_014.left).assertEqual(vp2px(150));
expect(Grid_RowCol_cellLength_011.bottom - Grid_RowCol_cellLength_011.top).assertEqual(vp2px(150));
expect(Grid_RowCol_cellLength_012.bottom - Grid_RowCol_cellLength_012.top).assertEqual(vp2px(150));
expect(Grid_RowCol_cellLength_013.bottom - Grid_RowCol_cellLength_013.top).assertEqual(vp2px(150));
expect(Grid_RowCol_cellLength_014.bottom - Grid_RowCol_cellLength_014.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_1100] END');
done();
});
})
}
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager';
export default function Grid_RowCol_maxCount() {
describe('Grid_RowCol_maxCountTest', function () {
beforeEach(async function (done) {
console.info("Grid_RowCol_maxCount beforeEach start");
let options = {
url: "MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_maxCount",
}
try {
router.clear();
let pages = router.getState();
console.info("get Grid_RowCol_maxCount state pages:" + JSON.stringify(pages));
if (!("Grid_RowCol_maxCount" == pages.name)) {
console.info("get Grid_RowCol_maxCount pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Grid_RowCol_maxCount page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Grid_RowCol_maxCount page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Grid_RowCol_maxCount after each called")
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_1000
* @tc.name Grid_RowCol_maxCount
* @tc.desc The Grid layout maxCount property does not take effect
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_1000', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_1000] START');
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('Grid_RowCol_maxCount_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let Grid_RowCol_maxCount_011 = CommonFunc.getComponentRect('Grid_RowCol_maxCount_011');
let Grid_RowCol_maxCount_012 = CommonFunc.getComponentRect('Grid_RowCol_maxCount_012');
let Grid_RowCol_maxCount_013 = CommonFunc.getComponentRect('Grid_RowCol_maxCount_013');
let Grid_RowCol_maxCount_014 = CommonFunc.getComponentRect('Grid_RowCol_maxCount_014');
let Grid_RowCol_maxCount_01 = CommonFunc.getComponentRect('Grid_RowCol_maxCount_01');
expect(Grid_RowCol_maxCount_011.left).assertEqual(Grid_RowCol_maxCount_01.left);
expect(Grid_RowCol_maxCount_013.left).assertEqual(Grid_RowCol_maxCount_01.left);
expect(Grid_RowCol_maxCount_011.right).assertEqual(Grid_RowCol_maxCount_012.left);
expect(Grid_RowCol_maxCount_013.right).assertEqual(Grid_RowCol_maxCount_014.left);
expect(Grid_RowCol_maxCount_012.right).assertEqual(Grid_RowCol_maxCount_01.right);
expect(Grid_RowCol_maxCount_014.right).assertEqual(Grid_RowCol_maxCount_01.right);
expect(Grid_RowCol_maxCount_011.top).assertEqual(Grid_RowCol_maxCount_01.top);
expect(Grid_RowCol_maxCount_012.top).assertEqual(Grid_RowCol_maxCount_01.top);
expect(Grid_RowCol_maxCount_011.bottom).assertEqual(Grid_RowCol_maxCount_013.top);
expect(Grid_RowCol_maxCount_012.bottom).assertEqual(Grid_RowCol_maxCount_014.top);
expect(Grid_RowCol_maxCount_013.bottom).assertEqual(Grid_RowCol_maxCount_01.bottom);
expect(Grid_RowCol_maxCount_014.bottom).assertEqual(Grid_RowCol_maxCount_01.bottom);
expect(Grid_RowCol_maxCount_011.right - Grid_RowCol_maxCount_011.left).assertEqual(vp2px(150));
expect(Grid_RowCol_maxCount_012.right - Grid_RowCol_maxCount_012.left).assertEqual(vp2px(150));
expect(Grid_RowCol_maxCount_013.right - Grid_RowCol_maxCount_013.left).assertEqual(vp2px(150));
expect(Grid_RowCol_maxCount_014.right - Grid_RowCol_maxCount_014.left).assertEqual(vp2px(150));
expect(Grid_RowCol_maxCount_011.bottom - Grid_RowCol_maxCount_011.top).assertEqual(vp2px(150));
expect(Grid_RowCol_maxCount_012.bottom - Grid_RowCol_maxCount_012.top).assertEqual(vp2px(150));
expect(Grid_RowCol_maxCount_013.bottom - Grid_RowCol_maxCount_013.top).assertEqual(vp2px(150));
expect(Grid_RowCol_maxCount_014.bottom - Grid_RowCol_maxCount_014.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDCHANGE_1000] END');
done();
});
})
}
/**
* Copyright (c) 2023-2030 iSoftStone Information Technology (Group) 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 '@ohos.router';
import CommonFunc from '../../../../MainAbility/common/Common';
import {MessageManager,Callback} from '../../../../MainAbility/common/MessageManager';
export default function Grid_RowCol_TemplateChange() {
describe('Grid_RowCol_TemplateChangeTest', function () {
beforeEach(async function (done) {
console.info("Grid_RowCol_TemplateChange beforeEach start");
let options = {
url: "MainAbility/pages/Grid/GridTemplatesAllSet/GridTemplateChange/Grid_RowCol_TemplateChange",
}
try {
router.clear();
let pages = router.getState();
console.info("get Grid_RowCol_TemplateChange state pages:" + JSON.stringify(pages));
if (!("Grid_RowCol_TemplateChange" == pages.name)) {
console.info("get Grid_RowCol_TemplateChange pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push Grid_RowCol_TemplateChange page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push Grid_RowCol_TemplateChange page error " + JSON.stringify(err));
expect().assertFail();
}
done();
});
afterEach(async function () {
await CommonFunc.sleep(2000);
console.info("Grid_RowCol_TemplateChange after each called")
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDTEMPLATECHANGE_0100
* @tc.name Grid_RowCol_TemplateChange
* @tc.desc Grid is divided into 4 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDTEMPLATECHANGE_0100', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDTEMPLATECHANGE_0100] START');
await CommonFunc.sleep(1000);
let gridContainerStrJson = getInspectorByKey('GridTemplateChange_Grid_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let GridTemplateChange_Grid_011 = CommonFunc.getComponentRect('GridTemplateChange_Grid_011');
let GridTemplateChange_Grid_012 = CommonFunc.getComponentRect('GridTemplateChange_Grid_012');
let GridTemplateChange_Grid_013 = CommonFunc.getComponentRect('GridTemplateChange_Grid_013');
let GridTemplateChange_Grid_014 = CommonFunc.getComponentRect('GridTemplateChange_Grid_014');
let GridTemplateChange_Grid_01 = CommonFunc.getComponentRect('GridTemplateChange_Grid_01');
expect(GridTemplateChange_Grid_011.left).assertEqual(GridTemplateChange_Grid_01.left);
expect(GridTemplateChange_Grid_013.left).assertEqual(GridTemplateChange_Grid_01.left);
expect(GridTemplateChange_Grid_011.right).assertEqual(GridTemplateChange_Grid_012.left);
expect(GridTemplateChange_Grid_013.right).assertEqual(GridTemplateChange_Grid_014.left);
expect(GridTemplateChange_Grid_012.right).assertEqual(GridTemplateChange_Grid_01.right);
expect(GridTemplateChange_Grid_014.right).assertEqual(GridTemplateChange_Grid_01.right);
expect(GridTemplateChange_Grid_011.top).assertEqual(GridTemplateChange_Grid_01.top);
expect(GridTemplateChange_Grid_012.top).assertEqual(GridTemplateChange_Grid_01.top);
expect(GridTemplateChange_Grid_011.bottom).assertEqual(GridTemplateChange_Grid_013.top);
expect(GridTemplateChange_Grid_012.bottom).assertEqual(GridTemplateChange_Grid_014.top);
expect(GridTemplateChange_Grid_013.bottom).assertEqual(GridTemplateChange_Grid_01.bottom);
expect(GridTemplateChange_Grid_014.bottom).assertEqual(GridTemplateChange_Grid_01.bottom);
expect(GridTemplateChange_Grid_011.right - GridTemplateChange_Grid_011.left).assertEqual(vp2px(150));
expect(GridTemplateChange_Grid_012.right - GridTemplateChange_Grid_012.left).assertEqual(vp2px(150));
expect(GridTemplateChange_Grid_013.right - GridTemplateChange_Grid_013.left).assertEqual(vp2px(150));
expect(GridTemplateChange_Grid_014.right - GridTemplateChange_Grid_014.left).assertEqual(vp2px(150));
expect(GridTemplateChange_Grid_011.bottom - GridTemplateChange_Grid_011.top).assertEqual(vp2px(150));
expect(GridTemplateChange_Grid_012.bottom - GridTemplateChange_Grid_012.top).assertEqual(vp2px(150));
expect(GridTemplateChange_Grid_013.bottom - GridTemplateChange_Grid_013.top).assertEqual(vp2px(150));
expect(GridTemplateChange_Grid_014.bottom - GridTemplateChange_Grid_014.top).assertEqual(vp2px(150));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDTEMPLATECHANGE_0100] END');
done();
});
/**
* @tc.number SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDTEMPLATECHANGE_0200
* @tc.name Grid_RowCol_TemplateChange
* @tc.desc Grid is divided into 9 equal parts, 4 components
*/
it('SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDTEMPLATECHANGE_0200', 0, async function (done) {
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDTEMPLATECHANGE_0200] START');
globalThis.value.message.notify({name:'testColumnsTemplate', value:"1fr 1fr 1fr"});
globalThis.value.message.notify({name:'testRowsTemplate', value:"1fr 1fr 1fr"});
await CommonFunc.sleep(3000);
let gridContainerStrJson = getInspectorByKey('GridTemplateChange_Grid_01');
let gridContainerObj = JSON.parse(gridContainerStrJson);
expect(gridContainerObj.$type).assertEqual('Grid');
let GridTemplateChange_Grid_011 = CommonFunc.getComponentRect('GridTemplateChange_Grid_011');
let GridTemplateChange_Grid_012 = CommonFunc.getComponentRect('GridTemplateChange_Grid_012');
let GridTemplateChange_Grid_013 = CommonFunc.getComponentRect('GridTemplateChange_Grid_013');
let GridTemplateChange_Grid_014 = CommonFunc.getComponentRect('GridTemplateChange_Grid_014');
let GridTemplateChange_Grid_01 = CommonFunc.getComponentRect('GridTemplateChange_Grid_01');
expect(GridTemplateChange_Grid_011.left).assertEqual(GridTemplateChange_Grid_01.left);
expect(GridTemplateChange_Grid_014.left).assertEqual(GridTemplateChange_Grid_01.left);
expect(GridTemplateChange_Grid_011.right).assertEqual(GridTemplateChange_Grid_014.right);
expect(GridTemplateChange_Grid_011.right).assertEqual(GridTemplateChange_Grid_012.left);
expect(GridTemplateChange_Grid_012.right).assertEqual(GridTemplateChange_Grid_013.left);
expect(GridTemplateChange_Grid_013.right).assertEqual(GridTemplateChange_Grid_01.right);
expect(GridTemplateChange_Grid_011.top).assertEqual(GridTemplateChange_Grid_01.top);
expect(GridTemplateChange_Grid_011.top).assertEqual(GridTemplateChange_Grid_012.top);
expect(GridTemplateChange_Grid_011.top).assertEqual(GridTemplateChange_Grid_013.top);
expect(GridTemplateChange_Grid_011.bottom).assertEqual(GridTemplateChange_Grid_014.top);
expect(GridTemplateChange_Grid_011.bottom).assertEqual(GridTemplateChange_Grid_012.bottom);
expect(GridTemplateChange_Grid_011.bottom).assertEqual(GridTemplateChange_Grid_013.bottom);
expect(GridTemplateChange_Grid_011.right - GridTemplateChange_Grid_011.left).assertEqual(vp2px(100));
expect(GridTemplateChange_Grid_012.right - GridTemplateChange_Grid_012.left).assertEqual(vp2px(100));
expect(GridTemplateChange_Grid_013.right - GridTemplateChange_Grid_013.left).assertEqual(vp2px(100));
expect(GridTemplateChange_Grid_014.right - GridTemplateChange_Grid_014.left).assertEqual(vp2px(100));
expect(GridTemplateChange_Grid_011.bottom - GridTemplateChange_Grid_011.top).assertEqual(vp2px(100));
expect(GridTemplateChange_Grid_012.bottom - GridTemplateChange_Grid_012.top).assertEqual(vp2px(100));
expect(GridTemplateChange_Grid_013.bottom - GridTemplateChange_Grid_013.top).assertEqual(vp2px(100));
expect(GridTemplateChange_Grid_014.bottom - GridTemplateChange_Grid_014.top).assertEqual(vp2px(100));
console.info('[SUB_ACE_GRID_GRIDTEMPLATESALLSET_GRIDTEMPLATECHANGE_0200] END');
done();
});
})
}
...@@ -21,7 +21,15 @@ ...@@ -21,7 +21,15 @@
import flexVisibility_AutoJsunit from './Flex/alignItems/ItemAlign_Auto/FlexVisibilityJsunit.test.ets'; import flexVisibility_AutoJsunit from './Flex/alignItems/ItemAlign_Auto/FlexVisibilityJsunit.test.ets';
import flexAlignSelf_AutoJsunit from './Flex/alignItems/ItemAlign_Auto/FlexAlignSelfJsunit.test.ets'; import flexAlignSelf_AutoJsunit from './Flex/alignItems/ItemAlign_Auto/FlexAlignSelfJsunit.test.ets';
import flexTextMargin_AutoJsunit from './Flex/alignItems/ItemAlign_Auto/FlexTextMarginJsunit.test.ets'; import flexTextMargin_AutoJsunit from './Flex/alignItems/ItemAlign_Auto/FlexTextMarginJsunit.test.ets';
import Row_Space from './Row/spaceChanged/Row_Space.test.ets';
import Column_Space from './Column/spaceChanged/Column_Space.test.ets';
import Grid_RowCol_TemplateChange from './Grid/GridTemplatesAllSet/GridTemplateChange/Grid_RowCol_TemplateChange.test.ets';
import Grid_RowCol_GridSize from './Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_GridSize.test.ets';
import Grid_RowCol_PadMar from './Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_PadMar.test.ets';
import Grid_RowCol_Gap from './Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_Gap.test.ets';
import Grid_RowCol_LayoutDirection from './Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_LayoutDirection.test.ets';
import Grid_RowCol_maxCount from './Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_maxCount.test.ets';
import Grid_RowCol_cellLength from './Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_cellLength.test.ets';
export default function testsuite() { export default function testsuite() {
flexBase_AutoJsunit() flexBase_AutoJsunit()
flexPadding_AutoJsunit() flexPadding_AutoJsunit()
...@@ -32,4 +40,13 @@ export default function testsuite() { ...@@ -32,4 +40,13 @@ export default function testsuite() {
flexVisibility_AutoJsunit() flexVisibility_AutoJsunit()
flexAlignSelf_AutoJsunit() flexAlignSelf_AutoJsunit()
flexTextMargin_AutoJsunit() flexTextMargin_AutoJsunit()
Row_Space()
Column_Space()
Grid_RowCol_TemplateChange()
Grid_RowCol_GridSize()
Grid_RowCol_PadMar()
Grid_RowCol_Gap()
Grid_RowCol_LayoutDirection()
Grid_RowCol_maxCount()
Grid_RowCol_cellLength()
} }
\ No newline at end of file
...@@ -9,6 +9,15 @@ ...@@ -9,6 +9,15 @@
"MainAbility/pages/Flex/alignItems/ItemAlign_Auto/FlexOffset", "MainAbility/pages/Flex/alignItems/ItemAlign_Auto/FlexOffset",
"MainAbility/pages/Flex/alignItems/ItemAlign_Auto/FlexVisibility", "MainAbility/pages/Flex/alignItems/ItemAlign_Auto/FlexVisibility",
"MainAbility/pages/Flex/alignItems/ItemAlign_Auto/FlexAlignSelf", "MainAbility/pages/Flex/alignItems/ItemAlign_Auto/FlexAlignSelf",
"MainAbility/pages/Flex/alignItems/ItemAlign_Auto/FlexTextMargin" "MainAbility/pages/Flex/alignItems/ItemAlign_Auto/FlexTextMargin",
"MainAbility/pages/Row/spaceChanged/Row_Space",
"MainAbility/pages/Column/spaceChanged/Column_Space",
"MainAbility/pages/Grid/GridTemplatesAllSet/GridTemplateChange/Grid_RowCol_TemplateChange",
"MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_GridSize",
"MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_PadMar",
"MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_Gap",
"MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_LayoutDirection",
"MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_maxCount",
"MainAbility/pages/Grid/GridTemplatesAllSet/GridChange/Grid_RowCol_cellLength"
] ]
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册