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

!9436 getcomponent xts delete

Merge pull request !9436 from huangdong/getcomponentdelete
/*
* Copyright (c) 2023 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 getcomponent {
private scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
@State Number: String[] = ['0', '1', '2', '3', '4']
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.key('ArkUX_Get_component_0010')
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
Checkbox({name: 'checkbox1', group: 'checkboxGroup'})
.select(true)
.selectedColor(0xed6f21)
.key('ArkUX_Get_component_0020')
Image($r('app.media.icon'))
.width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed)
.overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
.key('ArkUX_Get_component_0030')
Text('Radio1')
Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true)
.height(50)
.width(50)
.key('ArkUX_Get_component_0040')
Scroll(this.scroller) {
Flex({ direction: FlexDirection.Column }) {
ForEach(this.arr, (item) => {
Row() {
Text(item.toString())
.width('80%')
.height(60)
.backgroundColor('#3366CC')
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 5 })
}
}, item => item)
}.margin({ right: 15 })
}
.width('90%')
.scrollBar(BarState.Off)
.scrollable(ScrollDirection.Vertical)
ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) {
Text()
.width(20)
.height(100)
.borderRadius(10)
.backgroundColor('#C0C0C0')
}.width(20).backgroundColor('#ededed')
.key('ArkUX_Get_component_0050')
Select([{value:'aaa'},{value:'bbb'},{value:'ccc'}])
.selected(2)
.value('TTTTT')
.font({ size: 16, weight: 500 })
.fontColor('#182431')
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.key('ArkUX_Get_component_0060')
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.key('ArkUX_Get_component_0070')
Grid() {
ForEach(this.Number, (day: string) => {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
.backgroundColor(0xF9CF93)
.width('100%')
.height('100%')
.textAlign(TextAlign.Center)
}
}, day => day)
}, day => day)
}
.columnsTemplate('1fr 1fr 1fr 1fr 1fr')
.rowsTemplate('1fr 1fr 1fr 1fr 1fr')
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
.height(300)
.key('ArkUX_Get_component_0080')
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%').height(100).fontSize(16)
.textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF)
}
}, item => item)
}
.key('ArkUX_Get_component_0090')
.listDirection(Axis.Vertical)
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 })
.edgeEffect(EdgeEffect.Spring)
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.width('90%')
TextInput({ placeholder: 'input your password...' })
.width(400)
.height(40)
.margin(20)
.type(InputType.Password)
.maxLength(9)
.showPasswordIcon(true)
.key('ArkUX_Get_component_0100')
}.width('100%')
}.height('100%')
}
}
\ No newline at end of file
......@@ -38,7 +38,6 @@ import assemblyCallbackTest from './assemblyCallback.test';
import ActsGridTest from './Grid.test';
import ActsListTest from './Listitem.test';
import ActsSwiperTest from './Swiper.test';
import ActsgetcomponentTest from './getcomponent.test';
export default function testsuite() {
......@@ -67,5 +66,4 @@ export default function testsuite() {
ActsGridTest()
ActsListTest()
ActsSwiperTest()
ActsgetcomponentTest()
}
\ No newline at end of file
/*
* Copyright (c) 2023 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.
*/
import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import Utils from './common/Utils'
import router from '@system.router';
export default function ActsgetcomponentTest() {
describe('ActsgetcomponentTest', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/getcomponent',
}
try {
router.clear();
let pages = router.getState();
console.info("get getcomponent state success " + JSON.stringify(pages));
if (!("getcomponent" == pages.name)) {
console.info("get getcomponent state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push getcomponent page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push getcomponent page error: " + err);
}
done()
});
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('ArkUX_Get_component_0010', 0, async function (done) {
console.info('ArkUX_Get_component_0010 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0010');
expect(parseInt(strJson.width)).assertEqual(252);
expect(parseInt(strJson.height)).assertEqual(56);
expect(parseInt(strJson.localOffsetX)).assertEqual(234);
expect(parseInt(strJson.localOffsetY)).assertEqual(30);
expect(parseInt(strJson.windowOffsetX)).assertEqual(234);
expect(parseInt(strJson.windowOffsetY)).assertEqual(102);
expect(parseInt(strJson.screenOffsetX)).assertEqual(234);
expect(parseInt(strJson.screenOffsetY)).assertEqual(234);
console.info('ArkUX_Get_component_0010 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0010 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0020', 0, async function (done) {
console.info('ArkUX_Get_component_0020 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0020');
expect(parseInt(strJson.width)).assertEqual(30);
expect(parseInt(strJson.height)).assertEqual(30);
expect(parseInt(strJson.localOffsetX)).assertEqual(345);
expect(parseInt(strJson.localOffsetY)).assertEqual(100);
expect(parseInt(strJson.windowOffsetX)).assertEqual(345);
expect(parseInt(strJson.windowOffsetY)).assertEqual(172);
expect(parseInt(strJson.screenOffsetX)).assertEqual(345);
expect(parseInt(strJson.screenOffsetY)).assertEqual(345);
console.info('ArkUX_Get_component_0020 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0020 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0030', 0, async function (done) {
console.info('ArkUX_Get_component_0030 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0030');
expect(parseInt(strJson.width)).assertEqual(165);
expect(parseInt(strJson.height)).assertEqual(165);
expect(parseInt(strJson.localOffsetX)).assertEqual(277);
expect(parseInt(strJson.localOffsetY)).assertEqual(144);
expect(parseInt(strJson.windowOffsetX)).assertEqual(277);
expect(parseInt(strJson.windowOffsetY)).assertEqual(216);
expect(parseInt(strJson.screenOffsetX)).assertEqual(277);
expect(parseInt(strJson.screenOffsetY)).assertEqual(277);
console.info('ArkUX_Get_component_0030 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0030 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0040', 0, async function (done) {
console.info('ArkUX_Get_component_0040 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0040');
expect(parseInt(strJson.width)).assertEqual(75);
expect(parseInt(strJson.height)).assertEqual(75);
expect(parseInt(strJson.localOffsetX)).assertEqual(322);
expect(parseInt(strJson.localOffsetY)).assertEqual(351);
expect(parseInt(strJson.windowOffsetX)).assertEqual(322);
expect(parseInt(strJson.windowOffsetY)).assertEqual(423);
expect(parseInt(strJson.screenOffsetX)).assertEqual(322);
expect(parseInt(strJson.screenOffsetY)).assertEqual(322);
console.info('ArkUX_Get_component_0040 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0040 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0050', 0, async function (done) {
console.info('ArkUX_Get_component_0050 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0050');
expect(parseInt(strJson.width)).assertEqual(30);
expect(parseInt(strJson.height)).assertEqual(1136);
expect(parseInt(strJson.localOffsetX)).assertEqual(345);
expect(parseInt(strJson.localOffsetY)).assertEqual(1576);
expect(parseInt(strJson.windowOffsetX)).assertEqual(345);
expect(parseInt(strJson.windowOffsetY)).assertEqual(1648);
expect(parseInt(strJson.screenOffsetX)).assertEqual(345);
expect(parseInt(strJson.screenOffsetY)).assertEqual(345);
console.info('ArkUX_Get_component_0050 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0050 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0060', 0, async function (done) {
console.info('ArkUX_Get_component_0060 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0060');
expect(parseInt(strJson.width)).assertEqual(126);
expect(parseInt(strJson.height)).assertEqual(60);
expect(parseInt(strJson.localOffsetX)).assertEqual(297);
expect(parseInt(strJson.localOffsetY)).assertEqual(2712);
expect(parseInt(strJson.windowOffsetX)).assertEqual(297);
expect(parseInt(strJson.windowOffsetY)).assertEqual(2784);
expect(parseInt(strJson.screenOffsetX)).assertEqual(297);
expect(parseInt(strJson.screenOffsetY)).assertEqual(297);
console.info('ArkUX_Get_component_0060 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0060 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0070', 0, async function (done) {
console.info('ArkUX_Get_component_0070 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0070');
expect(parseInt(strJson.width)).assertEqual(421);
expect(parseInt(strJson.height)).assertEqual(88);
expect(parseInt(strJson.localOffsetX)).assertEqual(149);
expect(parseInt(strJson.localOffsetY)).assertEqual(2772);
expect(parseInt(strJson.windowOffsetX)).assertEqual(149);
expect(parseInt(strJson.windowOffsetY)).assertEqual(2844);
expect(parseInt(strJson.screenOffsetX)).assertEqual(149);
expect(parseInt(strJson.screenOffsetY)).assertEqual(149);
console.info('ArkUX_Get_component_0070 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0070 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0080', 0, async function (done) {
console.info('ArkUX_Get_component_0080 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0080');
expect(parseInt(strJson.width)).assertEqual(648);
expect(parseInt(strJson.height)).assertEqual(450);
expect(parseInt(strJson.localOffsetX)).assertEqual(36);
expect(parseInt(strJson.localOffsetY)).assertEqual(2860);
expect(parseInt(strJson.windowOffsetX)).assertEqual(36);
expect(parseInt(strJson.windowOffsetY)).assertEqual(2932);
expect(parseInt(strJson.screenOffsetX)).assertEqual(36);
expect(parseInt(strJson.screenOffsetY)).assertEqual(36);
console.info('ArkUX_Get_component_0080 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0080 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0090', 0, async function (done) {
console.info('ArkUX_Get_component_0090 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0090');
expect(parseInt(strJson.width)).assertEqual(648);
expect(parseInt(strJson.height)).assertEqual(1136);
expect(parseInt(strJson.localOffsetX)).assertEqual(36);
expect(parseInt(strJson.localOffsetY)).assertEqual(3310);
expect(parseInt(strJson.windowOffsetX)).assertEqual(36);
expect(parseInt(strJson.windowOffsetY)).assertEqual(3382);
expect(parseInt(strJson.screenOffsetX)).assertEqual(36);
expect(parseInt(strJson.screenOffsetY)).assertEqual(36);
console.info('ArkUX_Get_component_0090 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0090 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Get_component_0100', 0, async function (done) {
console.info('ArkUX_Get_component_0100 START');
setTimeout(()=>{
try{
let strJson = Utils.getComponentRect('ArkUX_Get_component_0100');
expect(parseInt(strJson.width)).assertEqual(600);
expect(parseInt(strJson.height)).assertEqual(60);
expect(parseInt(strJson.localOffsetX)).assertEqual(60);
expect(parseInt(strJson.localOffsetY)).assertEqual(4476);
expect(parseInt(strJson.windowOffsetX)).assertEqual(60);
expect(parseInt(strJson.windowOffsetY)).assertEqual(4548);
expect(parseInt(strJson.screenOffsetX)).assertEqual(60);
expect(parseInt(strJson.screenOffsetY)).assertEqual(60);
console.info('ArkUX_Get_component_0100 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Get_component_0100 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
......@@ -26,7 +26,6 @@
"TestAbility/pages/assemblyCallback",
"TestAbility/pages/list",
"TestAbility/pages/grid",
"TestAbility/pages/swiper",
"TestAbility/pages/getcomponent"
"TestAbility/pages/swiper"
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册