提交 90c6440f 编写于 作者: B bayanxing

ets api覆盖 用例补齐

Signed-off-by: Nbayanxing <bayanxing@kaihong.com>
上级 9f8c84be
...@@ -71,12 +71,11 @@ ...@@ -71,12 +71,11 @@
"type": "pageAbility" "type": "pageAbility"
}, },
"pages": [ "pages": [
"pages/index",
"pages/alphabetIndexer", "pages/alphabetIndexer",
"pages/attr_animate",
"pages/bindContextMenu",
"pages/checkBoxGroup", "pages/checkBoxGroup",
"pages/circle", "pages/circle",
"pages/index" "pages/ellipse"
], ],
"name": ".MainAbility", "name": ".MainAbility",
"window": { "window": {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import Log from '../common/Log.ets'; import Log from '../common/Log.ets';
import prompt from '@ohos.prompt' import prompt from '@ohos.prompt'
import events_emitter from '@ohos.events.emitter';
const TAG = 'ets_apiLack_add'; const TAG = 'ets_apiLack_add';
@Entry @Entry
...@@ -23,6 +24,8 @@ export default ...@@ -23,6 +24,8 @@ export default
struct AlphabetIndexerOnSelect { struct AlphabetIndexerOnSelect {
private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'] private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N']
private content: string = "AlphabetIndexer Page" private content: string = "AlphabetIndexer Page"
@State onSelectStatus: boolean = false;
@State onRequestPopupDataStatus: boolean = false;
aboutToAppear() { aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear AlphabetIndexerOnSelect start`) Log.showInfo(TAG, `aboutToAppear AlphabetIndexerOnSelect start`)
} }
...@@ -40,63 +43,6 @@ struct AlphabetIndexerOnSelect { ...@@ -40,63 +43,6 @@ struct AlphabetIndexerOnSelect {
build(){ build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("alphabetIndexer-OnSelect")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onSelectText")
Text("alphabetIndexer-OnRequestPopupData")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onRequestPopupDataText")
Text("alphabetIndexer-OnPopupSelect")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onPopupSelectText")
Text("alphabetIndexer-PopupPosition")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("popupPositionText")
Text(`${this.content}`) Text(`${this.content}`)
.fontSize(20) .fontSize(20)
.align(Alignment.Center) .align(Alignment.Center)
...@@ -112,22 +58,56 @@ struct AlphabetIndexerOnSelect { ...@@ -112,22 +58,56 @@ struct AlphabetIndexerOnSelect {
.selectedFont({ size: 16, weight: FontWeight.Regular }) .selectedFont({ size: 16, weight: FontWeight.Regular })
.popupFont({ size: 30, weight: FontWeight.Bolder, style: FontStyle.Normal }) .popupFont({ size: 30, weight: FontWeight.Bolder, style: FontStyle.Normal })
.itemSize(28) .itemSize(28)
.width(100)
.height(300)
.alignStyle(IndexerAlign.Left) .alignStyle(IndexerAlign.Left)
.onSelect((index: number) => { .onSelect((index: number) => {
console.info(this.value[index] + 'on onSelect') console.info(this.value[index] + 'on onSelect')
this.showToast("onSelect() " + index); this.showToast("onSelect() " + index)
this.onSelectStatus = true;
try {
var backData = {
data: {
"STATUS": this.onSelectStatus
}
}
let backEvent = {
eventId: 10201,
priority: events_emitter.EventPriority.LOW
}
console.info("onSelect start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onSelect emit action state err: " + JSON.stringify(err.message))
}
}) })
.onPopupSelect((index: number) => { .onPopupSelect((index: number) => {
console.info(this.value[index] + 'on onPopupSelect') console.info(this.value[index] + 'on onPopupSelect')
this.showToast("onPopupSelect() " + index); this.showToast("onPopupSelect() " + index)
}) })
.onRequestPopupData((index: number) => { .onRequestPopupData((index: number) => {
console.info(this.value[index] + 'on onRequestPopupData') console.info(this.value[index] + 'on onRequestPopupData')
this.showToast("onRequestPopupData() " + index); this.showToast("onRequestPopupData() " + index)
return ['1','2','3','4','5']; this.onRequestPopupDataStatus = true
try {
var backData = {
data: {
"STATUS": this.onRequestPopupDataStatus
}
}
let backEvent = {
eventId: 10202,
priority: events_emitter.EventPriority.LOW
}
console.info("onRequestPopupData start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onRequestPopupData emit action state err: " + JSON.stringify(err.message))
}
return ['1', '2', '3', '4', '5']
}) })
// 这个地方发生crash Error message: is not callable // .popupPosition({ x:100, y:200})
// .popupPosition({ x:100, y:200})
}.width("100%").height("100%") }.width("100%").height("100%")
} }
} }
......
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 AttrAnimationExample {
scroller: Scroller = new Scroller()
@State widthSize: number = 200
@State heightSize: number = 80
@State flag: boolean = true
@State widthSizeEaseOut: number = 200
@State heightSizeEaseOut: number = 80
@State flagEaseOut: boolean = true
@State widthSizeFastOutSlowIn: number = 200
@State heightSizeFastOutSlowIn: number = 80
@State flagFastOutSlowIn: boolean = true
@State widthSizeLinearOutSlowIn: number = 200
@State heightSizeLinearOutSlowIn: number = 80
@State flagLinearOutSlowIn: boolean = true
@State widthSizeFastOutLinearIn: number = 200
@State heightSizeFastOutLinearIn: number = 80
@State flagFastOutLinearIn: boolean = true
@State widthSizeExtremeDeceleration: number = 200
@State heightSizeExtremeDeceleration: number = 80
@State flagExtremeDeceleration: boolean = true
@State widthSizeSharp: number = 200
@State heightSizeSharp: number = 80
@State flagSharp: boolean = true
@State widthSizeRhythm: number = 200
@State heightSizeRhythm: number = 80
@State flagRhythm: boolean = true
@State widthSizeSmooth: number = 200
@State heightSizeSmooth: number = 80
@State flagSmooth: boolean = true
@State widthSizeFriction: number = 200
@State heightSizeFriction: number = 80
@State flagFriction: boolean = true
build() {
Column() {
Scroll(this.scroller) {
Column() {
Button('Curve.EaseInOut')
.onClick((event: ClickEvent) => {
if (this.flag) {
this.widthSize = 100
this.heightSize = 50
} else {
this.widthSize = 200
this.heightSize = 80
}
this.flag = !this.flag
})
.width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff)
.animation({
duration: 2000, // 动画时长
curve: Curve.EaseInOut, // 动画曲线
delay: 500, // 动画延迟
iterations: 1, // 播放次数
playMode: PlayMode.Normal // 动画模式
})
Button('Curve.EaseOut')
.onClick((event: ClickEvent) => {
if (this.flagEaseOut) {
this.widthSizeEaseOut = 100
this.heightSizeEaseOut = 50
} else {
this.widthSizeEaseOut = 200
this.heightSizeEaseOut = 80
}
this.flagEaseOut = !this.flagEaseOut
})
.width(this.widthSizeEaseOut).height(this.heightSizeEaseOut).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.EaseOut,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Button('Curve.FastOutSlowIn')
.onClick((event: ClickEvent) => {
if (this.flagFastOutSlowIn) {
this.widthSizeFastOutSlowIn = 100
this.heightSizeFastOutSlowIn = 50
} else {
this.widthSizeFastOutSlowIn = 200
this.heightSizeFastOutSlowIn = 80
}
this.flagFastOutSlowIn = !this.flagFastOutSlowIn
})
.width(this.widthSizeFastOutSlowIn).height(this.heightSizeFastOutSlowIn).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.FastOutSlowIn,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Button('Curve.LinearOutSlowIn')
.onClick((event: ClickEvent) => {
if (this.flagLinearOutSlowIn) {
this.widthSizeLinearOutSlowIn = 100
this.heightSizeLinearOutSlowIn = 50
} else {
this.widthSizeLinearOutSlowIn = 200
this.heightSizeLinearOutSlowIn = 80
}
this.flagLinearOutSlowIn = !this.flagLinearOutSlowIn
})
.width(this.widthSizeLinearOutSlowIn).height(this.heightSizeLinearOutSlowIn).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.LinearOutSlowIn,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Button('Curve.FastOutLinearIn')
.onClick((event: ClickEvent) => {
if (this.flagFastOutLinearIn) {
this.widthSizeFastOutLinearIn = 100
this.heightSizeFastOutLinearIn = 50
} else {
this.widthSizeFastOutLinearIn = 200
this.heightSizeFastOutLinearIn = 80
}
this.flagFastOutLinearIn = !this.flagFastOutLinearIn
})
.width(this.widthSizeFastOutLinearIn).height(this.heightSizeFastOutLinearIn).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.FastOutLinearIn,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Button('Curve.ExtremeDeceleration')
.onClick((event: ClickEvent) => {
if (this.flagExtremeDeceleration) {
this.widthSizeExtremeDeceleration = 100
this.heightSizeExtremeDeceleration = 50
} else {
this.widthSizeExtremeDeceleration = 200
this.heightSizeExtremeDeceleration = 80
}
this.flagExtremeDeceleration = !this.flagExtremeDeceleration
})
.width(this.widthSizeExtremeDeceleration).height(this.heightSizeExtremeDeceleration).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.ExtremeDeceleration,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Button('Curve.Sharp')
.onClick((event: ClickEvent) => {
if (this.flagSharp) {
this.widthSizeSharp = 100
this.heightSizeSharp = 50
} else {
this.widthSizeSharp = 200
this.heightSizeSharp = 80
}
this.flagSharp = !this.flagSharp
})
.width(this.widthSizeSharp).height(this.heightSizeSharp).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.Sharp,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Button('Curve.Rhythm')
.onClick((event: ClickEvent) => {
if (this.flagRhythm) {
this.widthSizeRhythm = 100
this.heightSizeRhythm = 50
} else {
this.widthSizeRhythm = 200
this.heightSizeRhythm = 80
}
this.flagRhythm = !this.flagRhythm
})
.width(this.widthSizeRhythm).height(this.heightSizeRhythm).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.Rhythm,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Button('Curve.Smooth')
.onClick((event: ClickEvent) => {
if (this.flagSmooth) {
this.widthSizeSmooth = 100
this.heightSizeSmooth = 50
} else {
this.widthSizeSmooth = 200
this.heightSizeSmooth = 80
}
this.flagSmooth = !this.flagSmooth
})
.width(this.widthSizeSmooth).height(this.heightSizeSmooth).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.Smooth,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Button('Curve.Friction')
.onClick((event: ClickEvent) => {
if (this.flagFriction) {
this.widthSizeFriction = 100
this.heightSizeFriction = 50
} else {
this.widthSizeFriction = 200
this.heightSizeFriction = 80
}
this.flagFriction = !this.flagFriction
})
.width(this.widthSizeFriction).height(this.heightSizeFriction).backgroundColor(0x317aff)
.animation({
duration: 2000,
curve: Curve.Friction,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
}.width('100%')
}
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.On)
.scrollBarColor(Color.Gray)
.scrollBarWidth(30)
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
})
.onScrollEdge((side: Edge) => {
console.info('To the edge')
})
.onScrollEnd(() => {
console.info('Scroll Stop')
})
}.width('100%').margin({ top: 5 })
}
}
\ No newline at end of file
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import prompt from '@ohos.prompt' import prompt from '@ohos.prompt'
import events_emitter from '@ohos.events.emitter';
import Log from '../common/Log.ets'; import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add'; const TAG = 'ets_apiLack_add';
...@@ -23,6 +23,26 @@ const TAG = 'ets_apiLack_add'; ...@@ -23,6 +23,26 @@ const TAG = 'ets_apiLack_add';
@Component @Component
export default export default
struct CheckBoxGroupSelectAll { struct CheckBoxGroupSelectAll {
@State isSelect: boolean = true;
onPageShow() {
console.info('[CheckBoxGroup] page show called');
var stateChangeEvent = {
eventId: 908,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[CheckBoxGroup] page stateChangCallBack");
if (eventData != null) {
console.info("[CheckBoxGroup] page state change called:" + JSON.stringify(eventData));
if (eventData.data.isSelect != null) {
this.isSelect = eventData.data.isSelect;
}
}
}
aboutToAppear() { aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CheckBoxGroupSelectAll start`) Log.showInfo(TAG, `aboutToAppear CheckBoxGroupSelectAll start`)
...@@ -57,33 +77,33 @@ struct CheckBoxGroupSelectAll { ...@@ -57,33 +77,33 @@ struct CheckBoxGroupSelectAll {
.key("selectAllText") .key("selectAllText")
Scroll() { Scroll() {
Column() { Column() {
CheckboxGroup({group : 'checkboxGroup'}) CheckboxGroup({group : 'checkboxGroup'})
.selectedColor(0xed6f21) .selectedColor(0xed6f21)
.key('CheckboxGroup') .key('CheckboxGroup')
.selectAll(true) .selectAll(this.isSelect)
.onChange((itemName:CheckboxGroupResult) => { .onChange((itemName:CheckboxGroupResult) => {
console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) console.info("TextPicker::dialogResult is" + JSON.stringify(itemName))
this.showToast(itemName.status.valueOf() == 0 ? "selectAll true" : "selectAll false"); this.showToast(itemName.status.valueOf() == 0 ? "selectAll true" : "selectAll false");
}) })
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
.selectedColor(0x39a2db) .selectedColor(0x39a2db)
.onChange((value: boolean) => { .onChange((value: boolean) => {
console.info('Checkbox1 change is' + value) console.info('Checkbox1 change is' + value)
}) })
Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) Checkbox({ name: 'checkbox2', group: 'checkboxGroup' })
.selectedColor(0x39a2db) .selectedColor(0x39a2db)
.onChange((value: boolean) => { .onChange((value: boolean) => {
console.info('Checkbox2 change is' + value) console.info('Checkbox2 change is' + value)
}) })
Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) Checkbox({ name: 'checkbox3', group: 'checkboxGroup' })
.selectedColor(0x39a2db) .selectedColor(0x39a2db)
.onChange((value: boolean) => { .onChange((value: boolean) => {
console.info('Checkbox3 change is' + value) console.info('Checkbox3 change is' + value)
}) })
}
} }
}
}.width("100%").height("100%") }.width("100%").height("100%")
} }
} }
......
...@@ -21,7 +21,7 @@ const TAG = 'ets_apiLack_add'; ...@@ -21,7 +21,7 @@ const TAG = 'ets_apiLack_add';
export default export default
struct CircleNe { struct CircleNe {
@State w: string = "100px"; @State w: string = "100px";
@State h: string = "200px"; @State h: string = "100px";
aboutToAppear() { aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CircleNew start`) Log.showInfo(TAG, `aboutToAppear CircleNew start`)
} }
...@@ -33,7 +33,7 @@ struct CircleNe { ...@@ -33,7 +33,7 @@ struct CircleNe {
build(){ build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("circle-Ne") Text("circle-New")
.width(100) .width(100)
.height(70) .height(70)
.fontSize(20) .fontSize(20)
...@@ -46,9 +46,6 @@ struct CircleNe { ...@@ -46,9 +46,6 @@ struct CircleNe {
.textAlign(TextAlign.Center) .textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None }) .textOverflow({ overflow: TextOverflow.None })
.key("neText") .key("neText")
// .onSelect((index: number) => {
// console.info(this.value[index] + 'on onSelect')
// })
Circle() Circle()
.width(`${this.w}`) .width(`${this.w}`)
......
...@@ -14,31 +14,40 @@ ...@@ -14,31 +14,40 @@
*/ */
import Log from '../common/Log.ets'; import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add'; const TAG = 'ets_apiLack_add';
@Entry @Entry
@Component @Component
struct MenuExample { export default
// @State responseType: ResponseType = RightClick; struct EllipseNe {
@State w: string = "300.00px";
@State h: string = "300.00px";
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear EllipseNe start`)
}
@Builder ContextMenuBuilder() { aboutToDisappear(){
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Log.showInfo(TAG, `aboutToDisAppear EllipseNe end`)
Text('text3')
.fontSize(20)
.width(100)
.height(50)
.textAlign(TextAlign.Center)
Divider().height(10)
}
} }
build() { build(){
Column() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text('click for menu')
} Text("ellipse-Ne")
.width('100%') .width(100)
.margin({ top: 5 }) .height(70)
//.bindContextMenu(this.ContextMenuBuilder(),this.responseType) .fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("neText")
Ellipse().width(`${this.w}`).height(`${this.h}`).key('ellipse')
}.width('100%').height('100%')
} }
} }
...@@ -15,10 +15,12 @@ ...@@ -15,10 +15,12 @@
import alphabetIndexerOnSelectJsunit from './alphabetIndexer.test.ets'; import alphabetIndexerOnSelectJsunit from './alphabetIndexer.test.ets';
import checkBoxGroupSelectAllJsunit from './checkBoxGroup.test.ets'; import checkBoxGroupSelectAllJsunit from './checkBoxGroup.test.ets';
import circleNeJsunit from './circle.test.ets'; import circleNewJsunit from './circle.test.ets';
import ellipseNeJsunit from './ellipse.test.ets';
export default function testsuite() { export default function testsuite() {
alphabetIndexerOnSelectJsunit() alphabetIndexerOnSelectJsunit()
checkBoxGroupSelectAllJsunit() checkBoxGroupSelectAllJsunit()
circleNeJsunit() circleNewJsunit()
ellipseNeJsunit()
} }
\ No newline at end of file
...@@ -14,191 +14,250 @@ ...@@ -14,191 +14,250 @@
*/ */
import router from '@system.router'; import router from '@system.router';
import events_emitter from '@ohos.events.emitter';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets' import Utils from './Utils.ets'
export default function alphabetIndexerOnSelectJsunit() { export default function alphabetIndexerOnSelectJsunit() {
describe('alphabetIndexerOnSelectTest', function () { describe('alphabetIndexerOnSelectTest', function () {
/**
* run before testcase
*/
beforeAll(async function (done) { beforeAll(async function (done) {
console.info('[alphabetIndexerOnSelectTest] before each called') console.info("flex beforeEach start");
let result;
let options = { let options = {
uri: 'pages/alphabetIndexer' uri: 'pages/alphabetIndexer',
} }
try { try {
result = router.push(options) router.clear();
console.info("push alphabetIndexerOnSelectTest page success " + JSON.stringify(result)); let pages = router.getState();
console.info("get alphabetIndexer state success " + JSON.stringify(pages));
if (!("alphabetIndexer" == pages.name)) {
console.info("get alphabetIndexer state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push alphabetIndexer page success " + JSON.stringify(result));
}
} catch (err) { } catch (err) {
console.error("push alphabetIndexerOnSelectTest page error " + JSON.stringify(result)); console.error("push alphabetIndexer page error: " + err);
} }
await Utils.sleep(4000)
done() done()
}); });
/** afterEach(async function () {
* run after testcase await Utils.sleep(1000);
*/ console.info("alphabetIndexerOnSelect after each called");
afterAll(async function () {
console.info('[alphabetIndexerOnSelectTest] after each called')
await Utils.sleep(1000)
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0001 * @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testalphabetIndexerOnSelect0001 * @tc.name testalphabetIndexer0001
* @tc.desic acealphabetIndexerOnSelectEtsTest0001 * @tc.desic acealphabetIndexerEtsTest0001
*/ */
it('testalphabetIndexerOnSelect0001', 0, async function (done) { it('testalphabetIndexerWidth0001', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0001 START'); console.info('alphabetIndexerWidth testalphabetIndexerWidth0001 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0001] component width strJson:" + strJson); console.info("[testalphabetIndexerWidth0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.width).assertEqual("100.00vp"); expect(obj.$attrs.width).assertEqual("100.00vp");
console.info("[testalphabetIndexerOnSelect0001] width value :" + obj.$attrs.width); console.info("[testalphabetIndexerWidth0001] width value :" + obj.$attrs.width);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0002 * @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testalphabetIndexerOnSelect0002 * @tc.name testalphabetIndexer0002
* @tc.desic acealphabetIndexerOnSelectEtsTest0002 * @tc.desic acealphabetIndexerEtsTest0002
*/ */
it('testalphabetIndexerOnSelect0002', 0, async function (done) { it('testalphabetIndexerHeight0002', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0002 START'); console.info('alphabetIndexerHeight testalphabetIndexerHeight0002 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0002] component height strJson:" + strJson); console.info("[testalphabetIndexerHeight0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.height).assertEqual("70.00vp"); expect(obj.$attrs.height).assertEqual("300.00vp");
console.info("[testalphabetIndexerOnSelect0002] height value :" + obj.$attrs.height); console.info("[testalphabetIndexerHeight0002] height value :" + obj.$attrs.height);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0003 * @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testalphabetIndexerOnSelect0003 * @tc.name testalphabetIndexer0003
* @tc.desic acealphabetIndexerOnSelectEtsTest0003 * @tc.desic acealphabetIndexerEtsTest0003
*/ */
it('testalphabetIndexerOnSelect0003', 0, async function (done) { it('testalphabetIndexerColor0003', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0003 START'); console.info('alphabetIndexerColor testalphabetIndexerColor0003 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0003] component fontSize strJson:" + strJson); console.info("[testalphabetIndexerColor0003] component fontSize strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.fontSize).assertEqual("20.00fp"); expect(obj.$attrs.color).assertEqual(undefined);
console.info("[testalphabetIndexerOnSelect0003] fontSize value :" + obj.$attrs.fontSize); console.info("[testalphabetIndexerColor0003] color value :" + obj.$attrs.color);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0004 * @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testalphabetIndexerOnSelect0004 * @tc.name testalphabetIndexer0004
* @tc.desic acealphabetIndexerOnSelectEtsTest0004 * @tc.desic acealphabetIndexerEtsTest0004
*/ */
it('testalphabetIndexerOnSelect0004', 0, async function (done) { it('testalphabetIndexerSelectedColor0004', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0004 START'); console.info('alphabetIndexerSelectedColor testalphabetIndexerSelectedColor0004 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0004] component opacity strJson:" + strJson); console.info("[testalphabetIndexerOnSelect0004] component opacity strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.opacity).assertEqual(1); expect(obj.$attrs.selectedColor).assertEqual("#FFFFFFFF");
console.info("[testalphabetIndexerOnSelect0004] opacity value :" + obj.$attrs.opacity); console.info("[testalphabetIndexerSelectedColor0004] selectedColor value :" + obj.$attrs.selectedColor);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0005 * @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testalphabetIndexerOnSelect0005 * @tc.name testalphabetIndexer0005
* @tc.desic acealphabetIndexerOnSelectEtsTest0005 * @tc.desic acealphabetIndexerEtsTest0005
*/ */
it('testalphabetIndexerOnSelect0005', 0, async function (done) { it('testalphabetIndexerPopupColor0005', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0005 START'); console.info('alphabetIndexerPopupColor testalphabetIndexerPopupColor0005 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0005] component align strJson:" + strJson); console.info("[testalphabetIndexerPopupColor0005] component align strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); expect(obj.$attrs.popupColor).assertEqual("#FF48D1CC");
console.info("[testalphabetIndexerOnSelect0005] align value :" + obj.$attrs.align); console.info("[testalphabetIndexerPopupColor0005] popupColor value :" + obj.$attrs.popupColor);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0006 * @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testalphabetIndexerOnSelect0006 * @tc.name testalphabetIndexer0006
* @tc.desic acealphabetIndexerOnSelectEtsTest0006 * @tc.desic acealphabetIndexerEtsTest0006
*/ */
it('testalphabetIndexerOnSelect0006', 0, async function (done) { it('testalphabetIndexerSelectedBackgroundColor0006', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0006 START'); console.info('alphabetIndexerSelectedBackgroundColor testalphabetIndexerSelectedBackgroundColor0006 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0006] component fontColor strJson:" + strJson); console.info("[testalphabetIndexerSelectedBackgroundColor0006] component fontColor strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); expect(obj.$attrs.selectedBackgroundColor).assertEqual("#FF0000E6");
console.info("[testalphabetIndexerOnSelect0006] fontColor value :" + obj.$attrs.fontColor); console.info("[testalphabetIndexerSelectedBackgroundColor0006] selectedBackgroundColor value :" + obj.$attrs.selectedBackgroundColor);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0007 * @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testalphabetIndexerOnSelect0007 * @tc.name testalphabetIndexer0007
* @tc.desic acealphabetIndexerOnSelectEtsTest0007 * @tc.desic acealphabetIndexerEtsTest0007
*/ */
it('testalphabetIndexerOnSelect0007', 0, async function (done) { it('testalphabetIndexerPopupBackground0007', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0007 START'); console.info('alphabetIndexerPopupBackground testalphabetIndexerPopupBackground0007 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0007] component lineHeight strJson:" + strJson); console.info("[testalphabetIndexerPopupBackground0007] component lineHeight strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); expect(obj.$attrs.popupBackground).assertEqual("#E500DDDD");
console.info("[testalphabetIndexerOnSelect0007] lineHeight value :" + obj.$attrs.lineHeight); console.info("[testalphabetIndexerPopupBackground0007] popupBackground value :" + obj.$attrs.popupBackground);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0009 * @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testalphabetIndexerOnSelect0009 * @tc.name testalphabetIndexer0009
* @tc.desic acealphabetIndexerOnSelectEtsTest0009 * @tc.desic acealphabetIndexerEtsTest0009
*/
it('testalphabetIndexerUsingPopup0009', 0, async function (done) {
console.info('alphabetIndexerUsingPopup testalphabetIndexerUsingPopup009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerUsingPopup0009] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.usingPopup).assertEqual(true);
console.info("[testalphabetIndexerUsingPopup0009] usingPopup value :" + obj.$attrs.usingPopup);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testalphabetIndexer0010
* @tc.desic acealphabetIndexerEtsTest0010
*/ */
it('testalphabetIndexerOnSelect0009', 0, async function (done) { it('testalphabetIndexerItemSize0010', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect009 START'); console.info('alphabetIndexerItemSize testalphabetIndexerItemSize0010 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0009] component padding strJson:" + strJson); console.info("[testalphabetIndexerItemSize0010] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.padding).assertEqual("10.00vp"); expect(obj.$attrs.itemSize).assertEqual("28.000000");
console.info("[testalphabetIndexerOnSelect0009] padding value :" + obj.$attrs.padding); console.info("[testalphabetIndexerItemSize0010] itemSize value :" + obj.$attrs.itemSize);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0010 * @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testalphabetIndexerOnSelect0010 * @tc.name testalphabetIndexer0011
* @tc.desic acealphabetIndexerOnSelectEtsTest0010 * @tc.desic acealphabetIndexerEtsTest0011
*/ */
it('testalphabetIndexerOnSelect0010', 0, async function (done) { it('testalphabetIndexerAlignStyle0011', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0010 START'); console.info('alphabetIndexerAlignStyle testalphabetIndexerAlignStyle0011 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('onSelectText'); let strJson = getInspectorByKey('alphabetIndexer');
console.info("[testalphabetIndexerOnSelect0010] component textAlign strJson:" + strJson); console.info("[testalphabetIndexerAlignStyle0011] component strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('AlphabetIndexer');
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); expect(obj.$attrs.alignStyle).assertEqual("AlignStyle.Left");
console.info("[testalphabetIndexerOnSelect0010] textAlign value :" + obj.$attrs.textAlign); console.info("[testalphabetIndexerItemSize0010] alignStyle value :" + obj.$attrs.alignStyle);
done(); done();
}); });
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0012
* @tc.name testalphabetIndexerOnSelect0012
* @tc.desic acealphabetIndexerOnSelectEtsTest0012
*/
it('testalphabetIndexerOnSelect0012', 0, async function (done) {
console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0011 START');
await Utils.sleep(2000);
try{
let callback = (indexEvent) => {
console.info("onSelect_0012 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.STATUS).assertEqual(true);
}
let indexEvent = {
eventId: 10201,
priority: events_emitter.EventPriority.LOW
}
sendEventByKey('alphabetIndexer', 10, "")
events_emitter.on(indexEvent, callback);
}catch(err){
console.info("onSelect_0012 on events_emitter err : " + JSON.stringify(err));
}
await Utils.sleep(2000);
try {
var innerEventOne = {
eventId: 10202,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("onRequestPopupData_0012 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(true);
}
sendEventByKey('alphabetIndexer', 10, "")
console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('alphabetIndexer', 10, "")));
events_emitter.on(innerEventOne, callback1);
} catch (err) {
console.info("onRequestPopupData_0012 on events_emitter err : " + JSON.stringify(err));
}
console.info('testalphabetIndexerOnSelect0012 END');
done();
});
}) })
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import events_emitter from '@ohos.events.emitter';
import router from '@system.router'; import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets' import Utils from './Utils.ets'
...@@ -53,12 +54,12 @@ export default function checkBoxGroupSelectAllJsunit() { ...@@ -53,12 +54,12 @@ export default function checkBoxGroupSelectAllJsunit() {
it('testcheckBoxGroupSelectAll0001', 0, async function (done) { it('testcheckBoxGroupSelectAll0001', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0001 START'); console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0001 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText'); let strJson = getInspectorByKey('CheckboxGroup');
console.info("[testcheckBoxGroupSelectAll0001] component width strJson:" + strJson); console.info("[testcheckBoxGroupSelectAll0001] component selectedColor strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('CheckboxGroup');
expect(obj.$attrs.width).assertEqual("100.00vp"); expect(obj.$attrs.selectedColor).assertEqual("#FFED6F21");
console.info("[testcheckBoxGroupSelectAll0001] width value :" + obj.$attrs.width); console.info("[testcheckBoxGroupSelectAll0001] selectedColor value :" + obj.$attrs.selectedColor);
done(); done();
}); });
...@@ -69,132 +70,28 @@ export default function checkBoxGroupSelectAllJsunit() { ...@@ -69,132 +70,28 @@ export default function checkBoxGroupSelectAllJsunit() {
*/ */
it('testcheckBoxGroupSelectAll0002', 0, async function (done) { it('testcheckBoxGroupSelectAll0002', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0002 START'); console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0002 START');
try {
var eventData = {
data: {
"isSelect": false
}
}
var innerEvent = {
eventId: 908,
priority: events_emitter.EventPriority.LOW
}
console.info("[testcheckBoxGroupSelectAll0002] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testcheckBoxGroupSelectAll0002] change component data error: " + err.message);
}
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText');
console.info("[testcheckBoxGroupSelectAll0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.height).assertEqual("70.00vp");
console.info("[testcheckBoxGroupSelectAll0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testcheckBoxGroupSelectAll0003
* @tc.desic acecheckBoxGroupSelectAllEtsTest0003
*/
it('testcheckBoxGroupSelectAll0003', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText');
console.info("[testcheckBoxGroupSelectAll0003] component fontSize strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontSize).assertEqual("20.00fp");
console.info("[testcheckBoxGroupSelectAll0003] fontSize value :" + obj.$attrs.fontSize);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testcheckBoxGroupSelectAll0004
* @tc.desic acecheckBoxGroupSelectAllEtsTest0004
*/
it('testcheckBoxGroupSelectAll0004', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText');
console.info("[testcheckBoxGroupSelectAll0004] component opacity strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.opacity).assertEqual(1);
console.info("[testcheckBoxGroupSelectAll0004] opacity value :" + obj.$attrs.opacity);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testcheckBoxGroupSelectAll0005
* @tc.desic acecheckBoxGroupSelectAllEtsTest0005
*/
it('testcheckBoxGroupSelectAll0005', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText');
console.info("[testcheckBoxGroupSelectAll0005] component align strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.align).assertEqual("Alignment.TopStart");
console.info("[testcheckBoxGroupSelectAll0005] align value :" + obj.$attrs.align);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testcheckBoxGroupSelectAll0006
* @tc.desic acecheckBoxGroupSelectAllEtsTest0006
*/
it('testcheckBoxGroupSelectAll0006', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText');
console.info("[testcheckBoxGroupSelectAll0006] component fontColor strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC");
console.info("[testcheckBoxGroupSelectAll0006] fontColor value :" + obj.$attrs.fontColor);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testcheckBoxGroupSelectAll0007
* @tc.desic acecheckBoxGroupSelectAllEtsTest0007
*/
it('testcheckBoxGroupSelectAll0007', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0007 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText');
console.info("[testcheckBoxGroupSelectAll0007] component lineHeight strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.lineHeight).assertEqual("25.00fp");
console.info("[testcheckBoxGroupSelectAll0007] lineHeight value :" + obj.$attrs.lineHeight);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testcheckBoxGroupSelectAll0009
* @tc.desic acecheckBoxGroupSelectAllEtsTest0009
*/
it('testcheckBoxGroupSelectAll0009', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText');
console.info("[testcheckBoxGroupSelectAll0009] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.padding).assertEqual("10.00vp");
console.info("[testcheckBoxGroupSelectAll0009] padding value :" + obj.$attrs.padding);
done();
});
/* let strJson = getInspectorByKey('CheckboxGroup');
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testcheckBoxGroupSelectAll0010
* @tc.desic acecheckBoxGroupSelectAllEtsTest0010
*/
it('testcheckBoxGroupSelectAll0010', 0, async function (done) {
console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0010 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('selectAllText');
console.info("[testcheckBoxGroupSelectAll0010] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); console.info("[testcheckBoxGroupSelectAll0002] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); expect(obj.$attrs.selectAll).assertEqual('false');
console.info("[testcheckBoxGroupSelectAll0010] textAlign value :" + obj.$attrs.textAlign); console.info('testcheckBoxGroupSelectAll0002 END');
done(); done();
}); });
}) })
......
...@@ -17,10 +17,10 @@ import router from '@system.router'; ...@@ -17,10 +17,10 @@ import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets' import Utils from './Utils.ets'
export default function circleNeJsunit() { export default function circleNewJsunit() {
describe('circleNeTest', function () { describe('circleNewTest', function () {
beforeAll(async function (done) { beforeAll(async function (done) {
console.info("flex beforeEach start"); console.info("circle beforeEach start");
let options = { let options = {
uri: 'pages/circle', uri: 'pages/circle',
} }
...@@ -42,176 +42,40 @@ export default function circleNeJsunit() { ...@@ -42,176 +42,40 @@ export default function circleNeJsunit() {
afterEach(async function () { afterEach(async function () {
await Utils.sleep(1000); await Utils.sleep(1000);
console.info("circleNe after each called"); console.info("circleNew after each called");
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0001 * @tc.number SUB_ACE_BASIC_ETS_API_001
* @tc.name testcircleNe0001 * @tc.name testcircleNew001
* @tc.desic acecircleNeEtsTest0001 * @tc.desic acecircleNewEtsTest001
*/ */
it('testcircleNe0001', 0, async function (done) { it('testcircleNew001', 0, async function (done) {
console.info('circleNe testcircleNe0001 START'); console.info('circleNew testcircleNew0011 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('neText'); let strJson = getInspectorByKey('circle');
console.info("[testcircleNe0001] component width strJson:" + strJson); console.info("[testcircleNew001] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.width).assertEqual("100.00vp");
console.info("[testcircleNe0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testcircleNe0002
* @tc.desic acecircleNeEtsTest0002
*/
it('testcircleNe0002', 0, async function (done) {
console.info('circleNe testcircleNe0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('neText');
console.info("[testcircleNe0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.height).assertEqual("70.00vp");
console.info("[testcircleNe0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testcircleNe0003
* @tc.desic acecircleNeEtsTest0003
*/
it('testcircleNe0003', 0, async function (done) {
console.info('circleNe testcircleNe0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('neText');
console.info("[testcircleNe0003] component fontSize strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontSize).assertEqual("20.00fp");
console.info("[testcircleNe0003] fontSize value :" + obj.$attrs.fontSize);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testcircleNe0004
* @tc.desic acecircleNeEtsTest0004
*/
it('testcircleNe0004', 0, async function (done) {
console.info('circleNe testcircleNe0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('neText');
console.info("[testcircleNe0004] component opacity strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.opacity).assertEqual(1);
console.info("[testcircleNe0004] opacity value :" + obj.$attrs.opacity);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testcircleNe0005
* @tc.desic acecircleNeEtsTest0005
*/
it('testcircleNe0005', 0, async function (done) {
console.info('circleNe testcircleNe0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('neText');
console.info("[testcircleNe0005] component align strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.align).assertEqual("Alignment.TopStart");
console.info("[testcircleNe0005] align value :" + obj.$attrs.align);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testcircleNe0006
* @tc.desic acecircleNeEtsTest0006
*/
it('testcircleNe0006', 0, async function (done) {
console.info('circleNe testcircleNe0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('neText');
console.info("[testcircleNe0006] component fontColor strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC");
console.info("[testcircleNe0006] fontColor value :" + obj.$attrs.fontColor);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testcircleNe0007
* @tc.desic acecircleNeEtsTest0007
*/
it('testcircleNe0007', 0, async function (done) {
console.info('circleNe testcircleNe0007 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('neText');
console.info("[testcircleNe0007] component lineHeight strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.lineHeight).assertEqual("25.00fp");
console.info("[testcircleNe0007] lineHeight value :" + obj.$attrs.lineHeight);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testcircleNe0009
* @tc.desic acecircleNeEtsTest0009
*/
it('testcircleNe0009', 0, async function (done) {
console.info('circleNe testcircleNe009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('neText');
console.info("[testcircleNe0009] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.padding).assertEqual("10.00vp");
console.info("[testcircleNe0009] padding value :" + obj.$attrs.padding);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testcircleNe0010
* @tc.desic acecircleNeEtsTest0010
*/
it('testcircleNe0010', 0, async function (done) {
console.info('circleNe testcircleNe0010 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('neText');
console.info("[testcircleNe0010] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('Shape');
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); expect(obj.$attrs.width).assertEqual("100.00px");
console.info("[testcircleNe0010] textAlign value :" + obj.$attrs.textAlign); console.info("[testcircleNew001] width value :" + obj.$attrs.width);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0011 * @tc.number SUB_ACE_BASIC_ETS_API_002
* @tc.name testcircleNe0011 * @tc.name testcircleNew002
* @tc.desic acecircleNeEtsTest0011 * @tc.desic acecircleNewEtsTest002
*/ */
it('testcircleNe0011', 0, async function (done) { it('testcircleNew002', 0, async function (done) {
console.info('circleNe testcircleNe0011 START'); console.info('circleNew testcircleNew002 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('circle'); let strJson = getInspectorByKey('circle');
console.info("[testcircleNe0011] component textAlign strJson:" + strJson); console.info("[testcircleNew002] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape'); expect(obj.$type).assertEqual('Shape');
expect(obj.$attrs.width).assertEqual("100.00px"); expect(obj.$attrs.height).assertEqual("100.00px");
console.info("[testcircleNe0011] width value :" + obj.$attrs.width); console.info("[testcircleNew002] width value :" + obj.$attrs.width);
done(); done();
}); });
}) })
......
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function ellipseNeJsunit() {
describe('ellipseNeTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/ellipse',
}
try {
router.clear();
let pages = router.getState();
console.info("get ellipse state success " + JSON.stringify(pages));
if (!("ellipse" == pages.name)) {
console.info("get ellipse state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push ellipse page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push ellipse page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("ellipseNe after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testellipseNe0001
* @tc.desic aceellipseNeEtsTest0001
*/
it('testellipseNe0001', 0, async function (done) {
console.info('ellipseNe testellipseNe0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('ellipse');
console.info("[testellipseNe0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape');
expect(obj.$attrs.width).assertEqual("300.00px");
console.info("[testellipseNe0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testellipseNe0002
* @tc.desic aceellipseNeEtsTest0002
*/
it('testellipseNe0002', 0, async function (done) {
console.info('ellipseNe testellipseNe0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('ellipse');
console.info("[testellipseNe0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape');
expect(obj.$attrs.height).assertEqual("300.00px");
console.info("[testellipseNe0002] height value :" + obj.$attrs.height);
done();
});
})
}
# This file is automatically generated by DevEco Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# For customization when using a Version Control System, please read the header note.
sdk.dir=D:/beta3Sdk
nodejs.dir=D:/software/DevEco Studio 3.0.0.900/tools/nodejs
npm.dir=D:/software/DevEco Studio 3.0.0.900/tools/nodejs
\ No newline at end of file
{
"lockfileVersion": 1
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册