提交 0d46d940 编写于 作者: H hekun

add test case

Signed-off-by: Nhekun <hekun18@huawei.com>
上级 c1b71b11
......@@ -106,6 +106,7 @@
"pages/page_transition",
"pages/panel",
"pages/path",
"pages/grid_col_muli",
"pages/pluginComponent",
"pages/polygon",
"pages/polyLine",
......
/*
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct GridRowExample {
@State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]
@State currentBp: string = 'unknown'
build() {
Column() {
GridRow({
columns: 5,
gutter: { x: 5, y: 10 },
breakpoints: { value: ["400vp", "600vp", "800vp"],
reference: BreakpointsReference.WindowSize },
direction: GridRowDirection.Row
}) {
ForEach(this.bgColors, (color,index) => {
GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 }}) {
Row().width("100%").height("20vp")
}.borderColor(color).borderWidth(2).gridColOffset(3).key(index + "")
})
}.width("100%").height("100%")
.onBreakpointChange((breakpoint) => {
this.currentBp = breakpoint
})
}.width('80%').margin({ left: 10, top: 5, bottom: 5 }).height(200)
.border({ color: '#880606', width: 2 })
}
}
\ No newline at end of file
......@@ -62,6 +62,7 @@ import xcomponentGetXComponentContextJsunit from './xcomponent.test.ets';
import routerJsunit from './router.test.ets';
export default function testsuite() {
grid_colSpanJsunit();
lazyForEachOnDataAddJsunit()
alphabetIndexerOnSelectJsunit()
checkBoxGroupSelectAllJsunit()
......
......@@ -61,5 +61,31 @@ export default function grid_colSpanJsunit() {
console.info("[testgrid_colSpan0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testgrid_col_refactor_name002
* @tc.desc acegrid_gridColRefactorName0002
*/
it('testgrid_col_refactor_name002', 0, async function (done) {
console.info('testgrid_col_refactor_name002 START');
await Utils.sleep(2000);
let options = {
uri: 'pages/grid_col_muli',
}
try {
await router.push(options);
await Utils.sleep(2000);
let strJson = getInspectorByKey('2');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('GridCol');
console.info("[testgrid_col_refactor_name002] component height strJson:" + JSON.stringify(obj.$attrs));
expect(obj.$attrs.gridColOffset).assertEqual("3");
} catch (err) {
console.error("push grid_col page error: " + err);
}
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册