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

!4535 3.1release用例上库

Merge pull request !4535 from lihao345/OpenHarmony-3.1-Release
......@@ -41,9 +41,18 @@ struct MouseEventExample {
if (event.button === MouseButton.Back) {
this.eventButton = 'Back'
}
if (event.button === MouseButton.Middle) {
this.eventButton = 'Middle'
}
if (event.button === MouseButton.Forward) {
this.eventButton = 'Forward'
}
if (event.button === MouseButton.None) {
this.eventButton = 'None'
}
if (event.event.action === MouseAction.Press) {
this.eventAction = 'Press'
}
if (event.event.action === MouseAction.Release) {
this.eventAction = 'Release'
}
......
......@@ -116,6 +116,9 @@ struct scrollCode {
console.info(xOffset + ' ' + yOffset)
})
.onScrollEdge((side: Edge) => {
if (side==Edge.Middle) {
globalThis.sideMiddle = side;
}
console.info('To the edge')
})
.onScrollEnd(() => {
......
......@@ -51,6 +51,10 @@ struct LoadingProgressExample {
.key('LP')
.height(this.loadingHeight)
.color(Color.Black)
Text(''+LoadingProgressStyle.Circular).width(100).height(60).fontSize(20).key('LPCircular')
Text(''+LoadingProgressStyle.Default).width(100).height(60).fontSize(20).key('LPDefault')
Text(''+LoadingProgressStyle.Orbital).width(100).height(60).fontSize(20).key('LPOrbital')
}.width('100%').margin({ top: 6 })
}
}
\ No newline at end of file
......@@ -109,5 +109,41 @@ export default function loadingProgressJsunit() {
console.info('testLoadingProgress_600 END');
done();
});
it('testLoadingProgress_700', 0, async function (done) {
console.info('[testLoadingProgress_700] START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPOrbital');
let obj = JSON.parse(strJson);
console.info("testLoadingProgress_700 component obj is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(LoadingProgressStyle.Orbital.toString())
console.info('testLoadingProgress_700 END');
done();
});
it('testLoadingProgress_800', 0, async function (done) {
console.info('[testLoadingProgress_800] START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPDefault');
let obj = JSON.parse(strJson);
console.info("testLoadingProgress_800 component obj is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(LoadingProgressStyle.Default.toString())
console.info('testLoadingProgress_800 END');
done();
});
it('testLoadingProgress_900', 0, async function (done) {
console.info('[testLoadingProgress_900] START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPCircular');
let obj = JSON.parse(strJson);
console.info("testLoadingProgress_900 component obj is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(LoadingProgressStyle.Circular.toString())
console.info('testLoadingProgress_900 END');
done();
});
})
}
\ No newline at end of file
......@@ -68,9 +68,14 @@
"pages/Navigator",
"pages/Panel",
"pages/Row",
"pages/EnumsWeek",
"pages/ProgressPage",
"pages/SideBarPage",
"pages/Common",
"pages/Swiper",
"pages/Tab",
"pages/AlertDialog",
"pages/CheckboxGroup",
"pages/Prop",
"pages/Link",
"pages/AppStorage",
......
import events_emitter from '@ohos.events.emitter';
/*
* Copyright (c) 2021 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 CheckboxExample {
@State flagTest:boolean = false
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("scrollCode page state change called:" + JSON.stringify(eventData));
this.flagTest = eventData.data.stateChange;
console.info("scrollableValue:" + this.flagTest);
} else {
console.info("scrollCode page color not change called:" + JSON.stringify(eventData));
}
}
onPageShow(){
var stateChangeEvent = {
eventId: 1850,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Scroll() {
Column() {
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){
CheckboxGroup({group : 'checkboxGroup'})
.selectedColor(0xed6f21)
.onChange((itemName:CheckboxGroupResult) => {
console.info("TextPicker::dialogResult is" + JSON.stringify(itemName.status))
globalThis.status = itemName.status;
})
.key('CheckboxGroup')
Text('select all').fontSize(20)
}
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
.select(false)
.selectedColor(0x39a2db)
.onChange((value: boolean) => {
console.info('Checkbox1 change is' + value)
})
Text('Checkbox1').fontSize(20)
}
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){
Checkbox({ name: 'checkbox2', group: 'checkboxGroup' })
.select(false)
.selectedColor(0x39a2db)
.onChange((value: boolean) => {
console.info('Checkbox2 change is' + value)
})
.key('Checkbox2')
Text('Checkbox2').fontSize(20)
}
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }){
Checkbox({ name: 'checkbox3', group: 'checkboxGroup' })
.select(false)
.selectedColor(0x39a2db)
.onChange((value: boolean) => {
console.info('Checkbox3 change is' + value)
})
Text('Checkbox3').fontSize(20)
}
}
}
}
}
\ No newline at end of file
import events_emitter from '@ohos.events.emitter';
/*
* Copyright (c) 2021 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 CommonPage {
@State isEnable: boolean = true
@Styles pressedStyles() {
.backgroundColor("#ED6F21")
.borderRadius(10)
.borderStyle(BorderStyle.Dashed)
.borderWidth(2)
.borderColor("#33000000")
.width(120)
.height(30)
.opacity(1)
}
@Styles clickedStyles() {
.backgroundColor("#ffd23535")
.borderRadius(10)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor("#2a10d497")
.width(90)
.height(25)
.opacity(1)
}
@Styles normalStyles() {
.backgroundColor("#0A59F7")
.borderRadius(10)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor("#33000000")
.width(100)
.height(25)
.opacity(1)
}
build() {
Column({ space: 10 }) {
Button() {
Text('onKeyTab').fontSize(25).fontWeight(FontWeight.Bold)
}.margin({ top: 20 }).backgroundColor('#0D9FFB')
.onKeyEvent((event:KeyEvent) => {
globalThis.deviceId = event.deviceId;
globalThis.keyCode = event.keyCode;
globalThis.keySource = event.keySource;
globalThis.keyText = event.keyText;
globalThis.metaKey = event.metaKey;
console.info('keyEvent deviceId + ' +event.deviceId)
console.info('keyEvent keyCode : ' +event.keyCode)
console.info('keyEvent keySource : ' +event.keySource)
console.info('keyEvent keyText : ' +event.keyText)
console.info('keyEvent metaKey : ' +event.metaKey)
})
Text("normal")
.fontSize(14)
.fontColor(Color.White)
.opacity(0.5)
.stateStyles({
normal: this.normalStyles,
})
.margin({ bottom: 20 })
.textAlign(TextAlign.Center)
.key('normal')
Text("pressed")
.backgroundColor("#0A59F7")
.borderRadius(20)
.borderStyle(BorderStyle.Dotted)
.borderWidth(2)
.borderColor(Color.Red)
.width(100)
.height(25)
.opacity(1)
.fontSize(14)
.fontColor(Color.White)
.stateStyles({
pressed: this.pressedStyles,
})
.margin({ bottom: 20 })
.textAlign(TextAlign.Center)
.key('pressed')
Text(this.isEnable ? "effective" : "clicked")
.backgroundColor("#0A59F7")
.borderRadius(20)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.borderColor(Color.Gray)
.width(100)
.height(25)
.opacity(1)
.fontSize(14)
.fontColor(Color.White)
// .enabled(this.isEnable)
.stateStyles({
clicked: this.clickedStyles,
})
.onClick((event:ClickEvent) => {
console.info('globalPosition'+event.target.area.globalPosition.x)
console.info('globalPosition'+event.target.area.globalPosition.y)
globalThis.globalPositionX = event.target.area.globalPosition.x;
globalThis.globalPositionY = event.target.area.globalPosition.y;
this.isEnable = !this.isEnable
console.log(`${this.isEnable}`)
})
.textAlign(TextAlign.Center)
.key('clicked')
}
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 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 EnumsWeek {
@State weekTime:Week = 0
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Text(''+Week.Mon).width(100).height(60).fontSize(20).key('TextMon')
Text(''+Week.Thur).width(100).height(60).fontSize(20).key('TextThur')
Text(''+Week.Fri).width(100).height(60).fontSize(20).key('TextFri')
Text(''+Week.Sat).width(100).height(60).fontSize(20).key('TextSat')
Text(''+Edge.Middle).width(100).height(60).fontSize(20).key('TextMiddle')
Text(''+HoverEffect.Auto).width(100).height(60).fontSize(20).key('TextAuto')
Text(''+HoverEffect.None).width(100).height(60).fontSize(20).key('TextNone')
Text(''+HoverEffect.Highlight).width(100).height(60).fontSize(20).key('TextHighlight')
Text(''+HoverEffect.Scale).width(100).height(60).fontSize(20).key('TextScale')
}.height(400).padding({ left: 35, right: 35, top: 35 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 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 app from '@system.app';
@Entry
@Component
struct ProgressPage {
aboutToAppear(){
console.log('start')
console.log('vc = '+app.getInfo().versionCode )
globalThis.versionCode = app.getInfo().versionCode;
}
build() {
Column({ space: 15 }) {
Text('ScaleRing Progress').fontSize(9).fontColor(0xCCCCCC).width('90%')
Row({ space: 40 }) {
Progress({ value: 20, total: 150, type: ProgressType.ScaleRing })
.color(Color.Grey).value(50).width(100)
.style({ strokeWidth: 15, scaleCount: 15, scaleWidth: 5 })
.key('progress')
}
}.width('100%').margin({ top: 30 })
}
}
\ No newline at end of file
/**
* Copyright (c) 2021 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 SideBarPage {
normalIcon : Resource = $rawfile('person.png')
selectedIcon: Resource = $rawfile('hand.png')
@State arr: number[] = [1, 2, 3]
@State current: number = 1
buttonStyle: ButtonStyle = {
left:30,
icons:{
shown: '显示',
hidden: '隐藏',
switching:'过程'
}
}
build() {
SideBarContainer(SideBarContainerType.Embed)
{
Column() {
ForEach(this.arr, (item, index) => {
Column({ space: 5 }) {
Image(this.current === item ? this.selectedIcon : this.normalIcon).width(64).height(64)
Text("Index0" + item)
.fontSize(25)
.fontColor(this.current === item ? '#0A59F7' : '#999')
.fontFamily('source-sans-pro,cursive,sans-serif')
}
.onClick(() => {
this.current = item
})
}, item => item)
}.width('100%')
.justifyContent(FlexAlign.SpaceEvenly)
.backgroundColor('#fc2efd42')
RowSplit() {
Column(){
Text('Split page one').fontSize(30)
}.justifyContent(FlexAlign.Center)
Column(){
Text('Split page two').fontSize(30)
}.justifyContent(FlexAlign.Center)
}.width('100%').backgroundColor('#ffd94444')
}
.key('sideBar')
.sideBarWidth(240)
.controlButton(this.buttonStyle)
.minSideBarWidth(210)
.maxSideBarWidth(260)
.onChange((value: boolean) => {
console.info('status:' + value)
})
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 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 pluginComponentManager from '@ohos.pluginComponent'
@Entry
@Component
struct pluginComponent {
private content: string = "pluginComponent Page";
@State isPlaying: boolean = false
onPageShow() {
console.info('pluginComponent page show called');
}
onBuildDone() {
console.info('pluginComponent page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 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.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
import events_emitter from '@ohos.events.emitter';
export default function checkboxGroupJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('CheckboxGroupTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/CheckboxGroup',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get CheckboxGroup state success " + JSON.stringify(pages));
if (!("CheckboxExample" == pages.name)) {
console.info("get CheckboxGroup state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push CheckboxGroup page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push CheckboxGroup page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("CheckboxGroup after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('checkboxGroupTest001', 0, async function (done) {
console.info('checkboxGroupTest001 START');
await sleep(1)
sendEventByKey("Checkbox2", 10, "")
await sleep(1)
let status = globalThis.status;
console.info("status : "+status)
expect(status).assertEqual(1)
console.info('checkboxGroupTest001 END');
done();
});
}
)
}
/*
* Copyright (c) 2021 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.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function commonJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('CommonTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/Common',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get Common state success " + JSON.stringify(pages));
if (!("Common" == pages.name)) {
console.info("get Common state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push Common page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push Common page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("Common after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('commonTest001', 0, async function (done) {
console.info('commonTest001 START');
await sleep(1)
let keyEvent: KeyEvent = {
type: KeyType.Down,
keyCode: 2049,
keyText: 'tab',
keySource: 4,
deviceId: 2,
metaKey: 0
}
sendKeyEvent(keyEvent)
await sleep(1)
let deviceId = globalThis.deviceId;
let keyCode = globalThis.keyCode;
let keySource = globalThis.keySource;
let keyText = globalThis.keyText;
let metaKey = globalThis.metaKey;
console.log("deviceId : "+deviceId)
console.log("keyCode : "+keyCode)
console.log("keySource : "+keySource)
console.log("keyText : "+keyText)
console.log("metaKey : "+metaKey)
expect(deviceId).assertEqual(2)
expect(keyCode).assertEqual(2049)
expect(keySource).assertEqual(4)
expect(keyText).assertEqual('Unknown')
expect(metaKey).assertEqual(0)
console.info('commonTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('commonTest002', 0, async function (done) {
console.info('commonTest002 START');
let strJson = getInspectorByKey('normal');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('normal')
console.info('commonTest002 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('commonTest003', 0, async function (done) {
console.info('commonTest003 START');
await sleep(1)
let strJson = getInspectorByKey('pressed');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('pressed')
console.info('commonTest003 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('commonTest004', 0, async function (done) {
console.info('commonTest004 START');
await sleep(1)
sendEventByKey("clicked", 10, "")
await sleep(1)
let strJson = getInspectorByKey('clicked');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('clicked')
let globalPositionX = globalThis.globalPositionX;
let globalPositionY = globalThis.globalPositionY;
console.log("globalPositionX : "+globalPositionX)
expect(globalPositionX).assertEqual(16.333333333333332)
console.log("globalPositionY : "+globalPositionY)
expect(globalPositionY).assertEqual(169.33333333333334)
console.info('commonTest004 END');
done();
});
})
}
/*
* Copyright (c) 2021 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.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function EnumsWeekJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('EnumsWeekTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/EnumsWeek',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get EnumsWeek state success " + JSON.stringify(pages));
if (!("EnumsWeek" == pages.name)) {
console.info("get EnumsWeek state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push EnumsWeek page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push EnumsWeek page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("EnumsWeek after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest001', 0, async function (done) {
console.info('enumsWeekTest001 START');
let strJson = getInspectorByKey('TextMon');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('1')
console.info('enumsWeekTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest002', 0, async function (done) {
console.info('enumsWeekTest002 START');
let strJson = getInspectorByKey('TextThur');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('8')
console.info('enumsWeekTest002 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest003', 0, async function (done) {
console.info('enumsWeekTest003 START');
await sleep(1)
let strJson = getInspectorByKey('TextFri');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('16')
console.info('enumsWeekTest003 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest004', 0, async function (done) {
console.info('enumsWeekTest004 START');
let strJson = getInspectorByKey('TextSat');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('32')
console.info('enumsWeekTest004 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest005', 0, async function (done) {
console.info('enumsWeekTest005 START');
let strJson = getInspectorByKey('TextMiddle');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual('5')
console.info('enumsWeekTest005 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest006', 0, async function (done) {
console.info('enumsWeekTest006 START');
let strJson = getInspectorByKey('TextAuto');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(HoverEffect.Auto.toString())
console.info('enumsWeekTest006 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest007', 0, async function (done) {
console.info('enumsWeekTest007 START');
let strJson = getInspectorByKey('TextNone');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(HoverEffect.None.toString())
console.info('enumsWeekTest007 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest008', 0, async function (done) {
console.info('enumsWeekTest008 START');
let strJson = getInspectorByKey('TextHighlight');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(HoverEffect.Highlight.toString())
console.info('enumsWeekTest008 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('enumsWeekTest009', 0, async function (done) {
console.info('enumsWeekTest009 START');
let strJson = getInspectorByKey('TextScale');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.content).assertEqual(HoverEffect.Scale.toString())
console.info('enumsWeekTest009 END');
done();
});
})
}
......@@ -17,6 +17,11 @@ import appStorageJsunit from './AppStorageJsunit.test.ets';
import linkJsunit from './LinkJsunit.test.ets';
import propJsunit from './PropJsunit.test.ets';
import alphabetIndexerJsunit from './AlphabetIndexerJsunit.test.ets';
import checkboxGroupJsunit from './CheckboxGroupJsunit.test.ets';
import commonJsunit from './CommonJsunit.test.ets';
import enumsWeekJsunit from './EnumsWeekJsunit.test.ets';
import progressPageJsunit from './ProgressPageJsunit.test.ets';
import sideBarPageJsunit from './SideBarPageJsunit.test.ets';
import listJsunit from './ListJsunit.test.ets';
import tabJsunit from './TabJsunit.test.ets';
import swiperJsunit from './SwiperJsunit.test.ets';
......@@ -29,6 +34,11 @@ import gridJsunit from './GridJsnuit.test.ets';
import videoJsunit from './VideoJsunit.test.ets';
export default function testsuite() {
alphabetIndexerJsunit()
checkboxGroupJsunit()
commonJsunit()
enumsWeekJsunit()
progressPageJsunit()
sideBarPageJsunit()
rowJsunit()
gridJsunit()
gridItemJsunit()
......
/*
* Copyright (c) 2021 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.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function ProgressPageJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('ProgressPageTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/ProgressPage',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get ProgressPage state success " + JSON.stringify(pages));
if (!("EnumsWeek" == pages.name)) {
console.info("get ProgressPage state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push ProgressPage page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push ProgressPage page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("ProgressPage after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('progressPageTest001', 0, async function (done) {
console.info('progressPageTest001 START');
let strJson = getInspectorByKey('progress');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.style.scaleCount))
console.log(JSON.stringify(obj.$attrs.style.scaleWidth))
expect(obj.$attrs.style.scaleCount).assertEqual('15')
expect(obj.$attrs.style.scaleWidth).assertEqual('5.00vp')
console.info('progressPageTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('progressPageTest002', 0, async function (done) {
console.info('progressPageTest002 START');
let versionCode = globalThis.versionCode;
console.log('versionCode = '+versionCode )
expect(versionCode).assertEqual(1000000)
console.info('progressPageTest002 END');
done();
});
})
}
/*
* Copyright (c) 2021 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.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function SideBarPageJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('SideBarPageTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/SideBarPage',
}
try {
router.clear();
await sleep(1);
let pages = router.getState();
console.info("get SideBarPage state success " + JSON.stringify(pages));
if (!("EnumsWeek" == pages.name)) {
console.info("get SideBarPage state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push SideBarPage page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push SideBarPage page error " + JSON.stringify(result));
}
await sleep(2)
done()
});
afterEach(async function () {
await sleep(1)
console.info("SideBarPage after each called");
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('sideBarPageTest001', 0, async function (done) {
console.info('sideBarPageTest001 START');
let strJson = getInspectorByKey('sideBar');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj))
console.log(JSON.stringify(obj.$attrs.controlButton))
let controlButton = JSON.parse(obj.$attrs.controlButton)
console.log(JSON.stringify(controlButton.controlButton.icon.shown))
console.log(JSON.stringify(controlButton.controlButton.icon.hidden))
console.log(JSON.stringify(controlButton.controlButton.icon.switching))
expect(controlButton.controlButton.icon.shown).assertEqual('显示')
expect(controlButton.controlButton.icon.hidden).assertEqual('隐藏')
expect(controlButton.controlButton.icon.switching).assertEqual('过程')
// expect(obj.$attrs.style.scaleWidth).assertEqual('5.00vp')
console.info('sideBarPageTest001 END');
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册