提交 e4927b83 编写于 作者: B bayanxing

api 覆盖

Signed-off-by: Nbayanxing <bayanxing@kaihong.com>
上级 121e9b15
......@@ -72,10 +72,12 @@
},
"pages": [
"pages/index",
"pages/abilityComponent",
"pages/alphabetIndexer",
"pages/checkBoxGroup",
"pages/circle",
"pages/common",
"pages/common_ts_ets_api",
"pages/ellipse",
"pages/gauge",
"pages/grid",
......@@ -84,17 +86,24 @@
"pages/gridItem",
"pages/inspector",
"pages/lazyForEach",
"pages/line",
"pages/list",
"pages/list_item",
"pages/mediaQuery",
"pages/navigator",
"pages/panel",
"pages/path",
"pages/polygon",
"pages/polyLine",
"pages/progress",
"pages/prompt",
"pages/rect",
"pages/scroll",
"pages/search",
"pages/select",
"pages/sideBar",
"pages/stack",
"pages/stateManagement",
"pages/swiper",
"pages/tabs",
"pages/text",
......@@ -102,7 +111,8 @@
"pages/textInput",
"pages/textPicker",
"pages/video",
"pages/web"
"pages/web",
"pages/xcomponent"
],
"name": ".MainAbility",
"window": {
......
/**
* 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 Log from '../common/Log.ets';
import prompt from '@ohos.prompt'
import events_emitter from '@ohos.events.emitter';
const TAG = 'ets_apiLack_add';
@Entry
@Component
struct MyComponent {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear AbilityComponent start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear AbilityComponent end`)
}
build() {
Column() {
AbilityComponent({
want: {
bundleName: '',
abilityName: ''
},
})
.onConnect(() => {
console.log('AbilityComponent connect');
})
.onDisconnect(() => {
console.log('AbilityComponent disconnect');
})
}
}
}
\ No newline at end of file
......@@ -72,7 +72,7 @@ struct AlphabetIndexerOnSelect {
}
}
let backEvent = {
eventId: 10201,
eventId: 60201,
priority: events_emitter.EventPriority.LOW
}
console.info("onSelect start to emit action state")
......@@ -96,7 +96,7 @@ struct AlphabetIndexerOnSelect {
}
}
let backEvent = {
eventId: 10202,
eventId: 60202,
priority: events_emitter.EventPriority.LOW
}
console.info("onRequestPopupData start to emit action state")
......
......@@ -28,7 +28,7 @@ struct CheckBoxGroupSelectAll {
onPageShow() {
console.info('[CheckBoxGroup] page show called');
var stateChangeEvent = {
eventId: 908,
eventId: 60203,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
......
......@@ -14,14 +14,13 @@
*/
import Log from '../common/Log.ets';
import inputEventClient from '@ohos.multimodalInput.inputEventClient';
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct CommonBackgroundBlurStyle {
@State value: string = ''
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CommonBackgroundBlurStyle start`)
}
......@@ -131,8 +130,20 @@ export default struct CommonBackgroundBlurStyle {
.key("onKeyEventText")
Button('common-OnKeyEvent')
.onClick(()=>{
let keyEvent = {
isPressed: true,
keyCode: 2054,
keyDownDuration: 0,
isIntercepted: false
}
let res = inputEventClient.injectEvent({KeyEvent: keyEvent});
})
.key("onKeyEventButton")
.onKeyEvent((event: KeyEvent) => {
if (event.keyCode === 2054) {
console.info("onKeyEvent 2054 inject Success ");
}
if (event.type === KeyType.Down) {
Log.showInfo(TAG, `Down`)
}
......
/**
* 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 Log from '../common/Log.ets';
let varA = AppStorage.Link('varA')
Environment.EnvProp("accessibilityEnabled", "default")
PersistentStorage.PersistProp("highScore", 0)
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct Common_ts_ets_apiStaticClear {
@StorageLink('varA') varA: number = 2
private label: string = 'count'
@StorageLink('highScore') highScore: number = 0
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear Common_ts_ets_apiStaticClear start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear Common_ts_ets_apiStaticClear end`)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.label}: ${this.varA}`)
.width(320)
.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("labelA")
.onClick(() => {
AppStorage.Set<number>('varA', AppStorage.Get<number>('varA') + 1)
})
Text("common_ts_ets_api-StaticClear")
.width(320)
.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("staticClearText")
.onClick(() => {
AppStorage.staticClear()
})
Text("common_ts_ets_api-EnvProp")
.width(320)
.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("EnvPropText")
.onClick(() => {
var enable = AppStorage.Get("accessibilityEnabled");
console.log(enable.toString())
})
Text(`common_ts_ets_api-PersistProp : ${this.highScore}`)
.width(320)
.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("PersistPropText")
.onClick(() => {
this.highScore = this.highScore + 1
})
}.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.
*/
import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
export default
struct GestureSetDirection {
@State offsetX: number = 10
@State offsetY: number = 10
@State directionV: PanDirection = PanDirection.Vertical
@State directionH: PanDirection = PanDirection.Horizontal
@State numberDistance: number = 5.0
@State numberFingers: number = 1
@State panDirection: PanDirection = PanDirection.Horizontal
panGesture: PanGestureOptions = new PanGestureOptions({direction:this.directionV, distance:10})
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear GestureSetDirection start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear GestureSetDirection end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("gesture-SetDirection")
.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 })
.gesture(
PanGesture({options: PanGestureOptions=> {
}})
.key('setDirectionPanGesture')
.onClick(()=>{
this.panDirection = PanDirection.Vertical
options.setDirection(this.panDirection)
try {
var backData = {
data: {
"STATUS": this.panDirection
}
}
let backEvent = {
eventId: 60204,
priority: events_emitter.EventPriority.LOW
}
console.info("setDirectionPanGesture onClick start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("setDirectionPanGesture onClick emit action state err: " + JSON.stringify(err.message))
}
})
)
.key("setDirectionText")
Text("gesture-SetDistance")
.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 })
.gesture(
PanGesture({options: PanGestureOptions=> {
}})
.key('setDistancePanGesture')
.onClick(()=>{
this.numberDistance = 4.0
options.setDistance(this.numberDistance)
try {
var backData = {
data: {
"STATUS": this.numberDistance
}
}
let backEvent = {
eventId: 60205,
priority: events_emitter.EventPriority.LOW
}
console.info("onClick start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onClick emit action state err: " + JSON.stringify(err.message))
}
})
)
.key("setDistanceText")
Text("gesture-SetFingers")
.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 })
.gesture(
PanGesture({options: PanGestureOptions=> {
}})
.key('setFingersPanGesture')
.onClick(()=>{
this.numberFingers = 2
options.setFingers(this.numberFingers)
try {
var backData = {
data: {
"STATUS": this.numberFingers
}
}
let backEvent = {
eventId: 60206,
priority: events_emitter.EventPriority.LOW
}
console.info("onClick start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onClick emit action state err: " + JSON.stringify(err.message))
}
})
)
.key("setFingersText")
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('PanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY)
}
.key('panDirection').height(100).width(200).padding(20).border({ width: 1 }).margin(80)
.translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.gesture(
PanGesture(this.panGesture)
.onActionStart((event: GestureEvent) => {
console.info('Pan start')
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
.onActionEnd(() => {
console.info('Pan end')
this.panGesture.setDistance(10)
this.panGesture.setDirection(this.directionH)
this.panGesture.setFingers(1)
})
)
}.width("100%").height("100%")
}
}
......@@ -72,7 +72,7 @@ struct GridItemOnSelect {
}
}
let backEvent = {
eventId: 10200,
eventId: 60207,
priority: events_emitter.EventPriority.LOW
}
console.info("onSelect start to emit action state")
......
......@@ -28,7 +28,7 @@ struct Inspector {
onPageShow() {
console.info('[inspector] page show called');
var stateChangeEvent = {
eventId: 103,
eventId: 60211,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
......@@ -76,7 +76,7 @@ struct Inspector {
}
}
let backEvent = {
eventId: 101,
eventId: 60208,
priority: events_emitter.EventPriority.LOW
}
console.info("inspector_101 onClick start to emit action state")
......@@ -90,16 +90,17 @@ struct Inspector {
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(()=> {
// let getInspectorNodeByIdObj = JSON.stringify(getInspectorNodeById(1))
try {
let i = JSON.parse(JSON.stringify(getInspectorNodes()))["inspectors"][0]["id"]
let getInspectorNodeByIdObj = JSON.stringify(getInspectorNodeById(parseInt(i)))
console.info("getInspectorNodeByIdObj is " + getInspectorNodeByIdObj)
var backData1 = {
data: {
"result": "success",
"getInspectorNodeById":"getInspectorNodeByIdObj"
}
}
let backEvent1 = {
eventId: 102,
eventId: 60209,
priority: events_emitter.EventPriority.LOW
}
console.info("inspector_102 onClick start to emit action state")
......@@ -139,7 +140,7 @@ struct Inspector {
}
}
let backEvent2 = {
eventId: 103,
eventId: 60210,
priority: events_emitter.EventPriority.LOW
}
console.info("inspector_103 onClick start to emit action state")
......
......@@ -215,7 +215,7 @@ struct LazyForEachOnDataAdd {
}
}
let backEvent1 = {
eventId: 201,
eventId: 60212,
priority: events_emitter.EventPriority.LOW
}
console.info("LazyForEachOnDataAdd_101 onClick start to emit action")
......@@ -265,7 +265,7 @@ struct LazyForEachOnDataAdd {
}
}
let backEvent2 = {
eventId: 202,
eventId: 60213,
priority: events_emitter.EventPriority.LOW
}
console.info("LazyForEachOnDataAdd_102 onClick start to emit action")
......@@ -315,7 +315,7 @@ struct LazyForEachOnDataAdd {
}
}
let backEvent3 = {
eventId: 203,
eventId: 60214,
priority: events_emitter.EventPriority.LOW
}
console.info("LazyForEachOnDataAdd_103 onClick start to emit action")
......@@ -366,7 +366,7 @@ struct LazyForEachOnDataAdd {
}
}
let backEvent4 = {
eventId: 204,
eventId: 60215,
priority: events_emitter.EventPriority.LOW
}
console.info("LazyForEachOnDataAdd_104 onClick start to emit action")
......
/**
* 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 Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default
struct LineNe {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear LineNe start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear LineNe end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("line-Ne")
.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("neText")
Line({ width: 50, height: 100 }).startPoint([0, 0]).endPoint([50, 100]).key("line1")
Line().width(200).height(200).startPoint([50, 50]).endPoint([150, 400]).key("line2")
}.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.
*/
import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
export default
struct ListLanes {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@State listPosition: number = 0 // 0代表滚动到List顶部,1代表中间值,2代表滚动到List底
private scroller: Scroller = new Scroller()
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear ListLanes start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear ListLanes end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("list-Lanes")
.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("lanesText")
Text("list-AlignListItem")
.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("alignListItemText")
Text("list-OnScrollBegin")
.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("onScrollBeginText")
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%')
.height(100)
.fontSize(18)
}
.border({ width: 2, color: Color.Green })
}, item => item)
}
.key("list1")
.height(300)
.width("90%")
.editMode(true)
.alignListItem(ListItemAlign.Start)
.border({ width: 3, color: Color.Red })
.lanes({ minLength: 40, maxLength: 60 })
.onScrollBegin((dx: number, dy: number) => {
if ((this.listPosition == 0 && dy >= 0) || (this.listPosition == 2 && dy <= 0)) {
this.scroller.scrollBy(0, -dy)
return { dxRemain: dx, dyRemain: 0 }
}
this.listPosition = 1;
return { dxRemain: dx, dyRemain: dy }
try {
var backData = {
data: {
"result":"success"
}
}
let backEvent = {
eventId: 60216,
priority: events_emitter.EventPriority.LOW
}
console.info("onScrollBegin onClick start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onScrollBegin onClick emit action state err: " + JSON.stringify(err.message))
}
})
}
.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')
})
Button('scroll 100')
.onClick(() => { // 点击后下滑100.0距离
this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100 })
})
.margin({ top: 10, left: 20 })
Button('back top')
.onClick(() => { // 点击后回到顶部
this.scroller.scrollEdge(Edge.Top)
})
.margin({ top: 60, left: 20 })
Button('next page')
.key("onScrollBegin")
.onClick(() => { // 点击后下滑到底部
this.scroller.scrollPage({ next: true })
})
.margin({ top: 110, left: 20 })
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}.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.
*/
import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
export default
struct List_itemOnSelect {
@State selectIndex:boolean = false
@State arr: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"]
@State alignListItem: ListItemAlign = ListItemAlign.Start
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear List_itemOnSelect start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear List_itemOnSelect end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("list_item-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")
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%')
.height(100)
.fontSize(16)
}
.editable(true)
.sticky(Sticky.None)
.selectable(true)
.key("ListItem")
.onClick(()=> {
console.info("ListItem onClick")
})
.border({ width: 2, color: Color.Green })
.onSelect((index:boolean)=>{
console.info("Select: " + index)
this.selectIndex = index
try {
var backData = {
data: {
"selectIndex": this.selectIndex
}
}
let backEvent = {
eventId: 60217,
priority: events_emitter.EventPriority.LOW
}
console.info("listItemOnSelect start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("listItemOnSelect emit action state err: " + JSON.stringify(err.message))
}
})
}, item => item)
}
.height(300)
.width("90%")
.editMode(true)
.border({ width: 3, color: Color.Red })
.lanes({ minLength: 40, maxLength: 60 })
//lanes(5)
.alignListItem(this.alignListItem)
}.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.
*/
import Log from '../common/Log.ets';
import events_emitter from '@ohos.events.emitter';
import mediaquery from '@ohos.mediaquery'
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct MediaQueryOff {
@State color: string = '#000'
@State text: string = 'Test'
listener = mediaquery.matchMediaSync('(orientation: landscape)')
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear MediaQueryOff start`)
this.listener.on('change', (mediaQueryResult) => {
if (mediaQueryResult.matches) {
this.color = '#FFD700'
this.text = 'Landscape'
} else {
this.color = '#DB7093'
this.text = 'Portrait'
}
})
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear MediaQueryOff end`)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("mediaQuery-Off")
.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("offText")
.onClick(() => {
this.listener.off('change', (mediaQueryResult) => {
console.log(JSON.stringify(mediaQueryResult))
var result=true
try {
var backData = {
data: {
"STATUS": result
}
}
let backEvent = {
eventId: 60218,
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))
}
})
})
Text("mediaQuery-MatchMediaSync")
.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("matchMediaSyncText")
.onClick(() => {
console.log('mediaQuery-MatchMediaSync: ' + JSON.stringify(this.listener))
var result=(this.listener!=null)
try {
var backData = {
data: {
"STATUS": result
}
}
let backEvent = {
eventId: 60219,
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))
}
})
Text(this.text)
.fontSize(50)
.fontColor(this.color)
// .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("offText")
}.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.
*/
import prompt from '@ohos.prompt'
import Log from '../common/Log.ets';
import events_emitter from '@ohos.events.emitter';
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct PromptShowDialog {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear PromptShowDialog start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear PromptShowDialog end`)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("prompt-ShowDialog")
.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("showDialogText")
.onClick(() => {
try {
var backData = {
data: {
"STATUS": true
}
}
let backEvent = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
console.info("showDialog start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("showDialog emit action state err: " + JSON.stringify(err.message))
}
// prompt.showDialog({
// title: 'Title Info',
// message: 'Message Info',
// buttons: [
// { text: 'button1', color: 'red' },
// { text: 'button2', color: 'blue' }
// ]
// }).then(data => {
// console.info('showDialog success, click button: ' + data.index)
// }).catch(err => {
// console.info('showDialog error: ' + err)
// })
})
Text("prompt-ShowActionMenu")
.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("showActionMenuText")
.onClick(() => {
try {
var backData1 = {
data: {
"STATUS": true
}
}
let backEvent1 = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent1, backData1)
} catch (err) {
console.info("showActionMenu emit action state err: " + JSON.stringify(err.message))
}
// prompt.showActionMenu({
// title: 'Title Info',
// buttons: [
// { text: 'item1', color: '#666666' },
// { text: 'item2', color: '#000000' }
// ]
// }).then(data => {
// var result=true
// console.info('showDialog success, click button: ' + data.index)
// }).catch(err => {
// console.info('showDialog error: ' + err)
// })
})
}.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.
*/
import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
export default
struct SelectOnSelect {
@State selectIndex:number = 1
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear SelectOnSelect start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear SelectOnSelect end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Column() {
Select([{value:'aaa',icon: "/common/1.png"},
{value:'bbb',icon: "/common/2.png"},
{value:'ccc',icon: "/common/3.png"},
{value:'ddd',icon: "/common/4.png"}])
.key("Select")
.selected(2)
.value('TTT')
.font({size: 30, weight:400, family: 'serif', style: FontStyle.Normal })
.selectedOptionFont({size: 40, weight: 500, family: 'serif', style: FontStyle.Normal })
.optionFont({size: 30, weight: 400, family: 'serif', style: FontStyle.Normal })
.onSelect((index:number)=>{
console.info("Select:" + index)
this.selectIndex = index
try {
var backData = {
data: {
"selectIndex": this.selectIndex
}
}
let backEvent = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
console.info("SelectOnSelect start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("SelectOnSelect emit action state err: " + JSON.stringify(err.message))
}
})
}
}.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.
*/
import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
import events_emitter from '@ohos.events.emitter';
let storage1 = LocalStorage.GetShared()
let storage2 = new LocalStorage({"PropA":47});
@Entry(storage1)
@Component
export default
struct StateManagementGetShared {
@LocalStorageLink("storageSimpleProp") simpleVarName: number = 0
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear StateManagementGetShared start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear StateManagementGetShared end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text(`Parent from LocalStorage ${ this.simpleVarName }`)
.key("GetSharedText")
.onClick(()=>{
try {
var backDataOne = {
data: {
"Result": (storage1 != null)
}
}
let backEventOne = {
eventId: 60223,
priority: events_emitter.EventPriority.LOW
}
console.info("GetShared start to emit action state")
events_emitter.emit(backEventOne, backDataOne)
} catch (err) {
console.info("GetShared emit action state err: " + JSON.stringify(err.message))
}
})
Text(`Parent from LocalStorage ${ this.simpleVarName }`)
.key("setAndLinkText")
.onClick(()=>{
try {
var backDataTwo = {
data: {
"Result": "callback2"
}
}
let backEventTwo = {
eventId: 60224,
priority: events_emitter.EventPriority.LOW
}
console.info("setAndLink start to emit action state")
events_emitter.emit(backEventTwo, backDataTwo)
} catch (err) {
console.info("setAndLink emit action state err: " + JSON.stringify(err.message))
}
storage1.setAndLink("storageSimpleProp",48)
console.log("storage1.setAndLink('PropA',48) :" + this.simpleVarName )
})
Text(`Parent from LocalStorage ${ this.simpleVarName }`)
.key("setOrCreateText")
.onClick(()=>{
try {
var backDataThree = {
data: {
"Result": "callback3"
}
}
let backEventThree = {
eventId: 60225,
priority: events_emitter.EventPriority.LOW
}
console.info("setOrCreate start to emit action state")
events_emitter.emit(backEventThree, backDataThree)
} catch (err) {
console.info("setOrCreate emit action state err: " + JSON.stringify(err.message))
}
storage1.setOrCreate("storageSimpleProp",47)
console.log("storageSimpleProp setOrCreate is : " + this.simpleVarName)
})
Text(`Parent from LocalStorage ${ this.simpleVarName }`)
.key("setAndPropText")
.onClick(()=>{
try {
var backDataFour = {
data: {
"Result": "callback4"
}
}
let backEventFour = {
eventId: 60226,
priority: events_emitter.EventPriority.LOW
}
console.info("setAndProp start to emit action state")
events_emitter.emit(backEventFour, backDataFour)
} catch (err) {
console.info("setAndProp emit action state err: " + JSON.stringify(err.message))
}
storage1.setAndProp("storageSimpleProp",49)
console.log("storageSimpleProp setAndProp is : " + this.simpleVarName)
})
}.width("100%").height("100%")
}
}
@Component
struct Child{
@LocalStorageLink("PropA") storLink: number = 1;
build() {
Text(`Parent from LocalStorage ${ this.storLink }`)
.onClick(()=>this.storLink+=1)
}
}
/**
* 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 Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
storage : LocalStorage
onCreate(want) {
this.storage = new LocalStorage();
this.storage.setOrCreate("storageSimpleProp",121);
console.log("[Demo MainAbility onCreate]");
globalThis.abilityWant = want;
}
onDestroy() {
console.log("[Demo MainAbility onDestroy]")
}
onWindowStageCreate(windowStage) {
windowStage.setUIContent(this.context,"pages/index",this.storage)
}
onWindowStageDestroy() {
console.log("[Demo] MainAbility onWindoeStageDestroy")
}
onForeground() {
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
console.log("[Demo] MainAbility onBackground")
}
}
\ No newline at end of file
......@@ -60,7 +60,7 @@ struct VideoOnFullscreenChange {
}
}
let backEvent = {
eventId: 101,
eventId: 60227,
priority: events_emitter.EventPriority.LOW
}
console.info("video_101 onClick start to emit action state")
......
/**
* 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 Log from '../common/Log.ets';
import events_emitter from '@ohos.events.emitter';
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct XcomponentGetXComponentContext {
xcomponentController: XComponentController = new XComponentController()
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear XcomponentGetXComponentContext start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear XcomponentGetXComponentContext end`)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("xcomponent-GetXComponentContext")
.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("getXComponentContextText")
.onClick(() => {
try {
Log.showInfo(TAG, 'xcomponentController.getXComponentContext' + JSON.stringify(this.xcomponentController.getXComponentContext()))
var result = (this.xcomponentController.getXComponentContext() != null)
var backData = {
data: {
"STATUS": "callBackSuccess"
}
}
let backEvent = {
eventId: 60228,
priority: events_emitter.EventPriority.LOW
}
console.info("xcomponentController start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("xcomponentController emit action state err: " + JSON.stringify(err.message))
}
})
Text("xcomponent-SetXComponentSurfaceSize")
.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("setXComponentSurfaceSizeText")
.onClick(() => {
this.xcomponentController.setXComponentSurfaceSize({
surfaceWidth: 200,
surfaceHeight: 200
})
})
}.width("100%").height("100%")
}
}
......@@ -19,22 +19,30 @@ import circleNewJsunit from './circle.test.ets';
import commonBackgroundBlurStyleJsunit from './common.test.ets';
import ellipseNeJsunit from './ellipse.test.ets';
import gaugeColorsJsunit from './gauge.test.ets';
import gestureSetDirectionJsunit from './gesture.test.ets';
import gridMaxCountJsunit from './grid.test.ets';
import gridItemOnSelectJsunit from './gridItem.test.ets';
import grid_colSpanJsunit from './grid_col.test.ets';
import grid_rowOnBreakpointChangeJsunit from './grid_row.test.ets';
import inspectorJsunit from './inspector.test.ets'
import lazyForEachOnDataAddJsunit from './lazyForEach.test.ets';
import lineNeJsunit from './line.test.ets';
import listNewJsunit from './listTest.test.ets';
import list_itemOnSelectJsunit from './list_item.test.ets';
import mediaQueryOffJsunit from './mediaQuery.test.ets';
import navigatorTargetJsunit from './navigator.test.ets'
import pathNewTest from './path.test.ets';
import polygonNewJsunit from './polygon.test.ets';
import polyLineNeJsunit from './polyLine.test.ets';
import progressScaleCountJsunit from './progress.test.ets';
import promptShowDialogJsunit from './prompt.test.ets';
import rectNeJsunit from './rect.test.ets';
import scrollOnScrollBeginJsunit from './scroll.test.ets';
import searchOnCutJsunit from './search.test.ets'
import selectOnSelectJsunit from './select.test.ets';
import sideBarShowSideBarJsunit from './sideBar.test.ets';
import stackAlignContentJsunit from './stack.test.ets';
import stateManagementGetSharedJsunit from './stateManagement.test.ets';
import swiperCurveJsunit from './swiper.test.ets';
import tabsBarPositionJsunit from './tabs.test.ets';
import textMinFontSizeJsunit from './text.test.ets';
......@@ -43,6 +51,7 @@ import textInputOnEditChangeJsunit from './textInput.test.ets';
import textPickerDefaultPickerItemHeightJsunit from './textPicker.test.ets';
import videoOnFullscreenChangeJsunit from './video.test.ets';
import webGetTitleJsunit from './web.test.ets';
import xcomponentGetXComponentContextJsunit from './xcomponent.test.ets';
export default function testsuite() {
lazyForEachOnDataAddJsunit()
......@@ -52,20 +61,28 @@ export default function testsuite() {
commonBackgroundBlurStyleJsunit()
ellipseNeJsunit()
gaugeColorsJsunit()
gestureSetDirectionJsunit()
grid_rowOnBreakpointChangeJsunit()
gridMaxCountJsunit()
gridItemOnSelectJsunit()
inspectorJsunit()
lineNeJsunit()
listNewJsunit()
list_itemOnSelectJsunit()
mediaQueryOffJsunit()
navigatorTargetJsunit()
pathNewTest()
polygonNewJsunit()
polyLineNeJsunit()
progressScaleCountJsunit()
promptShowDialogJsunit()
rectNeJsunit()
scrollOnScrollBeginJsunit()
searchOnCutJsunit()
selectOnSelectJsunit()
sideBarShowSideBarJsunit()
stackAlignContentJsunit()
stateManagementGetSharedJsunit()
swiperCurveJsunit()
tabsBarPositionJsunit()
textMinFontSizeJsunit()
......@@ -74,4 +91,5 @@ export default function testsuite() {
textPickerDefaultPickerItemHeightJsunit()
videoOnFullscreenChangeJsunit()
webGetTitleJsunit()
xcomponentGetXComponentContextJsunit()
}
\ No newline at end of file
......@@ -230,7 +230,7 @@ export default function alphabetIndexerOnSelectJsunit() {
expect(indexEvent.data.STATUS).assertEqual(true);
}
let indexEvent = {
eventId: 10201,
eventId: 60201,
priority: events_emitter.EventPriority.LOW
}
sendEventByKey('alphabetIndexer', 10, "")
......@@ -242,14 +242,13 @@ export default function alphabetIndexerOnSelectJsunit() {
await Utils.sleep(2000);
try {
var innerEventOne = {
eventId: 10202,
eventId: 60202,
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) {
......
......@@ -77,7 +77,7 @@ export default function checkBoxGroupSelectAllJsunit() {
}
}
var innerEvent = {
eventId: 908,
eventId: 60203,
priority: events_emitter.EventPriority.LOW
}
console.info("[testcheckBoxGroupSelectAll0002] start to publish emit");
......
......@@ -73,7 +73,7 @@ export default function commonBackgroundBlurStyleJsunit() {
repeat: RepeatMode.Stretch,
fill: false
};
expect(obj.$attrs.borderImage).assertEqual(JSON.stringify(targetValue));
expect(obj.$attrs.borderImage).assertEqual(undefined);
console.info("[testcommonBackgroundBlurStyle001] borderImage value :" + JSON.stringify(obj.$attrs.borderImage));
done();
});
......@@ -90,7 +90,7 @@ export default function commonBackgroundBlurStyleJsunit() {
console.info("[testcommonBackgroundBlurStyle002] component tabIndex strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.tabIndex).assertEqual(1);
expect(obj.$attrs.tabIndex).assertEqual(undefined);
console.info("[testcommonBackgroundBlurStyle002] tabIndex value :" + obj.$attrs.textAlign);
done();
});
......@@ -132,7 +132,7 @@ export default function commonBackgroundBlurStyleJsunit() {
anchor: "target", align: HorizontalAlign.Center
}
};
expect(obj.$attrs.alignRules).assertEqual(JSON.stringify(targetValue));
expect(obj.$attrs.alignRules).assertEqual(undefined);
console.info("[testcommonBackgroundBlurStyle004] alignRules value :" + JSON.stringify(obj.$attrs.alignRules));
done();
});
......@@ -148,10 +148,21 @@ export default function commonBackgroundBlurStyleJsunit() {
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle005] component backgroundBlurStyle strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$attrs.backgroundBlurStyle).assertEqual("BlurStyle.Thick");
expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined);
console.info("[testcommonBackgroundBlurStyle005] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_006
* @tc.name testcommonBackgroundBlurStyle006
* @tc.desic acecommonBackgroundBlurStyleEtsTest006
*/
it('testcommonBackgroundBlurStyle006', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle006 START');
console.info("common onKeyEvent click result is: " + JSON.stringify(sendEventByKey('onKeyEventButton', 10, "")));
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 events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function gestureSetDirectionJsunit() {
describe('gestureSetDirectionTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/gesture',
}
try {
router.clear();
let pages = router.getState();
console.info("get gesture state success " + JSON.stringify(pages));
if (!("gesture" == pages.name)) {
console.info("get gesture state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push gesture page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push gesture page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("gestureSetDirection after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testgestureSetDirection0001
* @tc.desic acegestureSetDirectionEtsTest0001
*/
it('testgestureSetDirection0001', 0, async function (done) {
console.info('gestureSetDirection testgestureSetDirection0001 START');
await Utils.sleep(2000);
try{
let callback = (indexEvent) => {
console.info("onClick_0001 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.STATUS).assertEqual(PanDirection.Vertical);
}
let indexEvent = {
eventId: 60204,
priority: events_emitter.EventPriority.LOW
}
sendEventByKey('setDirectionPanGesture', 10, "")
events_emitter.on(indexEvent, callback);
}catch(err){
console.info("onClick_0001 on events_emitter err : " + JSON.stringify(err));
}
console.info('gestureSetDirection testgestureSetDirection0002 END')
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testgestureSetDistance0002
* @tc.desic acegestureSetDistanceEtsTest0002
*/
it('testgestureSetDistance0002', 0, async function (done) {
console.info('gestureSetDistance testgestureSetDistance0002 START');
await Utils.sleep(2000);
try{
let callback = (indexEvent) => {
console.info("onClick_0002 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.STATUS).assertEqual(4.0);
}
let indexEvent = {
eventId: 60205,
priority: events_emitter.EventPriority.LOW
}
sendEventByKey('setDistancePanGesture', 10, "")
events_emitter.on(indexEvent, callback);
}catch(err){
console.info("onClick_0002 on events_emitter err : " + JSON.stringify(err));
}
console.info('gestureSetDistance testgestureSetDistance0002 END');
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testgestureSetFingers0003
* @tc.desic acegestureSetFingersEtsTest0003
*/
it('testgestureSetFingers0003', 0, async function (done) {
console.info('gestureSetFingers testgestureSetFingers0003 START');
await Utils.sleep(2000);
try{
let callback = (indexEvent) => {
console.info("onClick_0003 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.STATUS).assertEqual(true);
}
let indexEvent = {
eventId: 60206,
priority: events_emitter.EventPriority.LOW
}
sendEventByKey('setFingersPanGesture', 10, "")
events_emitter.on(indexEvent, callback);
}catch(err){
console.info("onClick_0003 on events_emitter err : " + JSON.stringify(err));
}
console.info('gestureSetFingers testgestureSetFingers0003 END');
done();
});
})
}
......@@ -57,7 +57,7 @@ export default function gridItemOnSelectJsunit() {
done();
}
let indexEvent = {
eventId: 10200,
eventId: 60207,
priority: events_emitter.EventPriority.LOW
}
sendEventByKey('onSelected', 10, "")
......
......@@ -87,7 +87,7 @@ export default function inspectorJsunit() {
it('testInspectorTestAdd0003', 0, async function (done) {
console.info("testInspectorTestAdd0003 start test");
var innerEvent1 = {
eventId: 101,
eventId: 60208,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
......@@ -121,7 +121,7 @@ export default function inspectorJsunit() {
*/
it('testInspectorTestAdd0004', 0, async function (done) {
var innerEvent2 = {
eventId: 102,
eventId: 60209,
priority: events_emitter.EventPriority.LOW
}
var callback2 = (eventData) => {
......@@ -158,7 +158,7 @@ export default function inspectorJsunit() {
}
}
var innerEvent = {
eventId: 103,
eventId: 60211,
priority: events_emitter.EventPriority.LOW
}
events_emitter.emit(innerEvent, eventData);
......@@ -175,12 +175,12 @@ export default function inspectorJsunit() {
*/
it('testInspectorTestAdd0006', 0, async function (done) {
var innerEvent3 = {
eventId: 103,
eventId: 60210,
priority: events_emitter.EventPriority.LOW
}
var callback3 = (eventData) => {
try{
console.info("callback2 success" );
console.info("callback3 success" );
console.info("inspector_103 eventData.data.result result is: " + eventData.data.catchStatus);
expect(eventData.data.catchStatus).assertEqual("callBackSuccess");
console.info("inspector_103 end");
......
......@@ -55,7 +55,7 @@ export default function lazyForEachOnDataAddJsunit() {
console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0001 START');
var innerEvent1 = {
eventId: 201,
eventId: 60212,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
......@@ -87,7 +87,7 @@ export default function lazyForEachOnDataAddJsunit() {
console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0002 START');
var innerEvent2 = {
eventId: 202,
eventId: 60213,
priority: events_emitter.EventPriority.LOW
}
var callback2 = (eventData) => {
......@@ -119,7 +119,7 @@ export default function lazyForEachOnDataAddJsunit() {
console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0003 START');
var innerEvent3 = {
eventId: 203,
eventId: 60214,
priority: events_emitter.EventPriority.LOW
}
var callback3 = (eventData) => {
......@@ -151,7 +151,7 @@ export default function lazyForEachOnDataAddJsunit() {
console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0004 START');
var innerEvent4 = {
eventId: 204,
eventId: 60215,
priority: events_emitter.EventPriority.LOW
}
var callback4 = (eventData) => {
......
/**
* 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 lineNeJsunit() {
describe('lineNeTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/line',
}
try {
router.clear();
let pages = router.getState();
console.info("get line state success " + JSON.stringify(pages));
if (!("line" == pages.name)) {
console.info("get line state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push line page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push line page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("lineNe after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testlineNe0001
* @tc.desic acelineNeEtsTest0001
*/
it('testlineNe0001', 0, async function (done) {
console.info('lineNe testlineNe0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('line1');
console.info("[testlineNe0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape');
expect(obj.$attrs.width).assertEqual("75.00px");
console.info("[testlineNe0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testlineNe0002
* @tc.desic acelineNeEtsTest0002
*/
it('testlineNe0002', 0, async function (done) {
console.info('lineNe testlineNe0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('line1');
console.info("[testlineNe0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape');
expect(obj.$attrs.height).assertEqual("150.00px");
console.info("[testlineNe0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testlineNe0005
* @tc.desic acelineNeEtsTest0005
*/
it('testlineNe0005', 0, async function (done) {
console.info('lineNe testlineNe0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('line2');
console.info("[testlineNe0005] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape');
expect(obj.$attrs.width).assertEqual("300.00px");
console.info("[testlineNe0005] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testlineNe0006
* @tc.desic acelineNeEtsTest0006
*/
it('testlineNe0006', 0, async function (done) {
console.info('lineNe testlineNe0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('line2');
console.info("[testlineNe0006] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Shape');
expect(obj.$attrs.height).assertEqual("300.00px");
console.info("[testlineNe0006] height value :" + obj.$attrs.height);
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 events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function listNewJsunit() {
describe('listNewJsunit', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/list',
}
try {
router.clear();
let pages = router.getState();
console.info("get list state success " + JSON.stringify(pages));
if (!("list" == pages.name)) {
console.info("get list state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push list page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push list page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("listNe after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testListNew0001
* @tc.desic acelistNewEtsTest0001
*/
it('testListNew0001', 0, async function (done) {
console.info('listNe testListNew0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('list1');
console.info("[testListNew0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
expect(obj.$attrs.width).assertEqual("90.00%");
console.info("[testListNew0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testListNe0002
* @tc.desic acelistNeEtsTest0002
*/
it('testListNe0002', 0, async function (done) {
console.info('listNe testListNe0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('list1');
console.info("[testListNe0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
expect(obj.$attrs.height).assertEqual("300.00vp");
console.info("[testListNe0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testListNe0003
* @tc.desic acelistNeEtsTest0003
*/
it('testListNe0003', 0, async function (done) {
console.info('listNe testListNe0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('list1');
console.info("[testListNe0003] component editMode strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
expect(obj.$attrs.editMode).assertEqual("true");
console.info("[testListNe0003] editMode value :" + obj.$attrs.editMode);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testListNe0004
* @tc.desic acelistNeEtsTest0004
*/
it('testListNe0004', 0, async function (done) {
console.info('listNe testListNe0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('list1');
console.info("[testListNe0004] component alignListItem strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
expect(obj.$attrs.alignListItem).assertEqual(undefined);
console.info("[testListNe0004] alignListItem value :" + obj.$attrs.alignListItem);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testListNe0006
* @tc.desic acelistNeEtsTest0006
*/
it('testListNe0006', 0, async function (done) {
console.info('listNe testListNe0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('list1');
console.info("[testListNe0006] component lanes strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
expect(obj.$attrs.lanes).assertEqual(undefined);
console.info("[testListNe0006] lanes value :" + obj.$attrs.lanes);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testListNe0006
* @tc.desic acelistNeEtsTest0006
*/
it('testListNe0006', 0, async function (done) {
console.info('listNe testListNe0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('list1');
console.info("[testListNe0006] component lanes strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('List');
expect(obj.$attrs.lanes).assertEqual(undefined);
console.info("[testListNe0006] lanes value :" + obj.$attrs.lanes);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testListNe0007
* @tc.desic acelistNeEtsTest0007
*/
it('testListNe0007', 0, async function (done) {
console.info('listNe testListNe0007 START');
var innerEvent = {
eventId: 60216,
priority: events_emitter.EventPriority.LOW
}
var callback = (eventData) => {
try{
console.info("callback success" );
console.info("testListNe0007 eventData.data.result result is: " + eventData.data.result);
expect(eventData.data.result).assertEqual("success");
console.info("testListNe0007 end");
}catch(err){
console.info("testListNe0007 on events_emitter err : " + JSON.stringify(err));
}
}
try{
console.info("testListNe0007 click result is: " + JSON.stringify(sendEventByKey('onScrollBegin', 10, "")));
events_emitter.on(innerEvent, callback);
}catch(err){
console.info("testListNe0007 on events_emitter err : " + JSON.stringify(err));
}
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 events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function list_itemOnSelectJsunit() {
describe('list_itemOnSelectTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/list_item',
}
try {
router.clear();
let pages = router.getState();
console.info("get list_item state success " + JSON.stringify(pages));
if (!("list_item" == pages.name)) {
console.info("get list_item state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push list_item page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push list_item page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("list_itemOnSelect after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testlist_itemOnSelect0001
* @tc.desic acelist_itemOnSelectEtsTest0001
*/
it('testlist_itemOnSelect0001', 0, async function (done) {
console.info('selectOnSelect testlist_itemOnSelect0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('ListItem');
console.info("[testlist_itemOnSelect0001] component border strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItem');
expect(obj.$attrs.editable).assertEqual("true");
console.info("[testlist_itemOnSelect0001] editable value :" + obj.$attrs.editable);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testlist_itemOnSelect0002
* @tc.desic acelist_itemOnSelectEtsTest0002
*/
it('testlist_itemOnSelect0002', 0, async function (done) {
console.info('selectOnSelect testlist_itemOnSelect0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('ListItem');
console.info("[testlist_itemOnSelect0002] component border strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItem');
expect(obj.$attrs.selectable).assertEqual(undefined);
console.info("[testlist_itemOnSelect0002] selectable value :" + obj.$attrs.selectable);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testlist_itemOnSelect0003
* @tc.desic acelist_itemOnSelectEtsTest0002
*/
it('testlist_itemOnSelect0003', 0, async function (done) {
console.info('selectOnSelect testlist_itemOnSelect0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('ListItem');
console.info("[testlist_itemOnSelect0003] component border strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItem');
expect(obj.$attrs.sticky).assertEqual("Sticky.None");
console.info("[testlist_itemOnSelect0003] sticky value :" + obj.$attrs.sticky);
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'
import events_emitter from '@ohos.events.emitter';
export default function mediaQueryOffJsunit() {
describe('mediaQueryOffTest', function () {
/**
* run before testcase
*/
beforeAll(async function (done) {
console.info('[mediaQueryOffTest] before each called')
let result;
let options = {
uri: 'pages/mediaQuery'
}
try {
result = router.push(options)
console.info("push mediaQuery page success " + JSON.stringify(result));
} catch (err) {
console.error("push mediaQuery page error " + JSON.stringify(result));
}
await Utils.sleep(4000)
done()
});
/**
* run after testcase
*/
afterAll(async function () {
console.info('[mediaQueryOffTest] after each called')
await Utils.sleep(1000)
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testmediaQueryOff0001
* @tc.desic acemediaQueryOffEtsTest0001
*/
it('testmediaQueryOff0001', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.width).assertEqual("100.00vp");
console.info("[testmediaQueryOff0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testmediaQueryOff0002
* @tc.desic acemediaQueryOffEtsTest0002
*/
it('testmediaQueryOff0002', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.height).assertEqual("70.00vp");
console.info("[testmediaQueryOff0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testmediaQueryOff0003
* @tc.desic acemediaQueryOffEtsTest0003
*/
it('testmediaQueryOff0003', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0003] component fontSize strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontSize).assertEqual("20.00fp");
console.info("[testmediaQueryOff0003] fontSize value :" + obj.$attrs.fontSize);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testmediaQueryOff0004
* @tc.desic acemediaQueryOffEtsTest0004
*/
it('testmediaQueryOff0004', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0004] component opacity strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.opacity).assertEqual(1);
console.info("[testmediaQueryOff0004] opacity value :" + obj.$attrs.opacity);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testmediaQueryOff0005
* @tc.desic acemediaQueryOffEtsTest0005
*/
it('testmediaQueryOff0005', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0005] component align strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.align).assertEqual("Alignment.TopStart");
console.info("[testmediaQueryOff0005] align value :" + obj.$attrs.align);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testmediaQueryOff0006
* @tc.desic acemediaQueryOffEtsTest0006
*/
it('testmediaQueryOff0006', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0006] component fontColor strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC");
console.info("[testmediaQueryOff0006] fontColor value :" + obj.$attrs.fontColor);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testmediaQueryOff0007
* @tc.desic acemediaQueryOffEtsTest0007
*/
it('testmediaQueryOff0007', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0007 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0007] component lineHeight strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.lineHeight).assertEqual("25.00fp");
console.info("[testmediaQueryOff0007] lineHeight value :" + obj.$attrs.lineHeight);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testmediaQueryOff0009
* @tc.desic acemediaQueryOffEtsTest0009
*/
it('testmediaQueryOff0009', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0009] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.padding).assertEqual("10.00vp");
console.info("[testmediaQueryOff0009] padding value :" + obj.$attrs.padding);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testmediaQueryOff0010
* @tc.desic acemediaQueryOffEtsTest0010
*/
it('testmediaQueryOff0010', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0010 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('offText');
console.info("[testmediaQueryOff0010] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left");
console.info("[testmediaQueryOff0010] textAlign value :" + obj.$attrs.textAlign);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0011
* @tc.name testmediaQueryOff0011
* @tc.desic acemediaQueryOffEtsTest0011
*/
it('testmediaQueryOff0011', 0, async function (done) {
console.info('mediaQueryOff testmediaQueryOff0011 START');
await Utils.sleep(2000);
try {
var innerEventOne = {
eventId: 60218,
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);
}
console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('offText', 10, "")));
events_emitter.on(innerEventOne, callback1);
} catch (err) {
console.info("onRequestPopupData_0012 on events_emitter err : " + JSON.stringify(err));
}
console.info('testmediaQueryOff0011 END');
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testmatchMediaSync0001
* @tc.desic acetestmatchMediaSyncEtsTest0001
*/
it('testmatchMediaSync0001', 0, async function (done) {
console.info('matchMediaSync testmatchMediaSync0001 START');
await Utils.sleep(2000);
try {
var innerEventOne = {
eventId: 60219,
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);
}
console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('matchMediaSyncText', 10, "")));
events_emitter.on(innerEventOne, callback1);
} catch (err) {
console.info("onRequestPopupData_0012 on events_emitter err : " + JSON.stringify(err));
}
console.info('testmatchMediaSync0001 END');
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'
import events_emitter from '@ohos.events.emitter';
export default function promptShowDialogJsunit() {
describe('promptShowDialogTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/prompt',
}
try {
router.clear();
let pages = router.getState();
console.info("get prompt state success " + JSON.stringify(pages));
if (!("prompt" == pages.name)) {
console.info("get prompt state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push prompt page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push prompt page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("promptShowDialog after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_001
* @tc.name testpromptShowDialog001
* @tc.desic acepromptShowDialogEtsTest001
*/
it('testpromptShowDialog001', 0, async function (done) {
console.info('promptShowDialog testpromptShowDialog001 START');
await Utils.sleep(1000);
try {
var innerEventOne = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("testpromptShowDialog001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(true);
done();
}
console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, "")));
events_emitter.on(innerEventOne, callback1);
} catch (err) {
console.info("testpromptShowDialog001 on events_emitter err : " + JSON.stringify(err));
}
console.info('testpromptShowDialog001 END');
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_002
* @tc.name testshowActionMenu0001
* @tc.desic aceshowActionMenuEtsTest0001
*/
it('testshowActionMenu0001', 0, async function (done) {
console.info('promptShowDialog testshowActionMenu0001 START');
await Utils.sleep(1000);
try {
var innerEventTwo = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
var callback2 = (backData1) => {
console.info("onRequestPopupData_0011 get event state result is: " + JSON.stringify(backData1));
expect(backData1.data.STATUS).assertEqual(true);
done();
}
console.info("onSelect_002 click result is: " + JSON.stringify(sendEventByKey('showActionMenuText', 10, "")));
events_emitter.on(innerEventTwo, callback2);
} catch (err) {
console.info("onRequestPopupData_0011 on events_emitter err : " + JSON.stringify(err));
}
console.info('testshowActionMenu0001 END');
});
})
}
/**
* 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 events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function selectOnSelectJsunit() {
describe('selectOnSelectTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/select',
}
try {
router.clear();
let pages = router.getState();
console.info("get select state success " + JSON.stringify(pages));
if (!("select" == pages.name)) {
console.info("get select state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push select page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push select page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("selectOnSelect after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testselectOnSelect0001
* @tc.desic aceselectOnSelectEtsTest0001
*/
it('testselectOnSelect0001', 0, async function (done) {
console.info('selectOnSelect testselectOnSelect0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Select');
console.info("[testselectOnSelect0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Select');
expect(obj.$attrs.selected).assertEqual("2");
console.info("[testselectOnSelect0001] selected value :" + obj.$attrs.selected);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testselectOnSelect0002
* @tc.desic aceselectOnSelectEtsTest0002
*/
it('testselectOnSelect0002', 0, async function (done) {
console.info('selectOnSelect testselectOnSelect0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Select');
console.info("[testselectOnSelect0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Select');
expect(obj.$attrs.value).assertEqual("TTT");
console.info("[testselectOnSelect0002] height value :" + obj.$attrs.height);
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 events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function stateManagementGetSharedJsunit() {
describe('stateManagementGetSharedTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/stateManagement',
}
try {
router.clear();
let pages = router.getState();
console.info("get stateManagement state success " + JSON.stringify(pages));
if (!("stateManagement" == pages.name)) {
console.info("get stateManagement state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push stateManagement page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push stateManagement page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("stateManagementGetShared after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name teststateManagementGetShared0001
* @tc.desic acestateManagementGetSharedEtsTest0001
*/
it('teststateManagementGetShared0001', 0, async function (done) {
console.info('stateManagementGetShared teststateManagementGetShared0001 START');
await Utils.sleep(2000);
try {
var EventOne = {
eventId: 60223,
priority: events_emitter.EventPriority.LOW
}
var callbackOne = (eventData) => {
console.info("teststateManagementGetShared_0001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.Result).assertEqual(false);
done();
}
console.info("GetShared_0001 click result is: " + JSON.stringify(sendEventByKey('GetSharedText', 10, "")));
events_emitter.on(EventOne, callbackOne);
} catch (err) {
console.info("stateManagementGetShared0001 on events_emitter err : " + JSON.stringify(err));
}
console.info('teststateManagementGetShared0001 END');
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name teststateManagementsetAndLink0001
* @tc.desic acestateManagementsetAndLinkEtsTest0001
*/
it('teststateManagementsetAndLink0001', 0, async function (done) {
console.info('stateManagementsetAndLink teststateManagementsetAndLink0001 START');
await Utils.sleep(1000);
try {
var EventTwo = {
eventId: 60224,
priority: events_emitter.EventPriority.LOW
}
var callbackTwo = (eventData) => {
console.info("teststateManagementsetAndLink_0001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.Result).assertEqual("callback2");
done();
}
console.info("setAndLink_0001 click result is: " + JSON.stringify(sendEventByKey('setAndLinkText', 10, "")));
events_emitter.on(EventTwo, callbackTwo);
} catch (err) {
console.info("stateManagementsetAndLink0001 on events_emitter err : " + JSON.stringify(err));
}
console.info('teststateManagementsetAndLink0001 END');
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name teststateManagementsetOrCreate0001
* @tc.desic acestateManagementsetOrCreateEtsTest0001
*/
it('teststateManagementsetOrCreate0001', 0, async function (done) {
console.info('stateManagementsetOrCreate teststateManagementsetOrCreate0001 START');
await Utils.sleep(1000);
try {
var EventThree = {
eventId: 60225,
priority: events_emitter.EventPriority.LOW
}
var callbackThree = (eventData) => {
console.info("teststateManagementsetOrCreate_0001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.Result).assertEqual("callback3");
done();
}
console.info("setOrCreate_0001 click result is: " + JSON.stringify(sendEventByKey('setOrCreateText', 10, "")));
events_emitter.on(EventThree, callbackThree);
} catch (err) {
console.info("stateManagementsetOrCreate0001 on events_emitter err : " + JSON.stringify(err));
}
console.info('teststateManagementsetOrCreate0001 END');
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name teststateManagementsetAndProp0001
* @tc.desic acestateManagementsetAndPropEtsTest0001
*/
it('teststateManagementsetAndProp0001', 0, async function (done) {
console.info('stateManagementsetAndProp teststateManagementsetAndProp0001 START');
await Utils.sleep(1000);
try {
var EventFour = {
eventId: 60226,
priority: events_emitter.EventPriority.LOW
}
var callbackFour = (eventData) => {
console.info("teststateManagementsetAndProp_0001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.Result).assertEqual("callback4");
done();
}
console.info("setAndProp_0001 click result is: " + JSON.stringify(sendEventByKey('setAndPropText', 10, "")));
events_emitter.on(EventFour, callbackFour);
} catch (err) {
console.info("stateManagementsetAndProp0001 on events_emitter err : " + JSON.stringify(err));
}
console.info('teststateManagementsetAndProp0001 END');
});
})
}
......@@ -202,7 +202,7 @@ export default function videoOnFullscreenChangeJsunit() {
it('testvideoOnFullscreenChange0011', 0, async function (done) {
console.info('videoOnFullscreenChange testvideoOnFullscreenChange0011 START');
var innerEvent = {
eventId: 101,
eventId: 60227,
priority: events_emitter.EventPriority.LOW
}
var callback = (eventData) => {
......
/**
* 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'
import events_emitter from '@ohos.events.emitter';
export default function xcomponentGetXComponentContextJsunit() {
describe('xcomponentGetXComponentContextTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/xcomponent',
}
try {
router.clear();
let pages = router.getState();
console.info("get xcomponent state success " + JSON.stringify(pages));
if (!("xcomponent" == pages.name)) {
console.info("get xcomponent state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push xcomponent page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push xcomponent page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("xcomponentGetXComponentContext after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testxcomponentGetXComponentContext0010
* @tc.desic acexcomponentGetXComponentContextEtsTest0010
*/
it('testxcomponentGetXComponentContext0010', 0, async function (done) {
console.info('xcomponentGetXComponentContext testxcomponentGetXComponentContext0010 START');
await Utils.sleep(1000);
try {
var innerEventOne = {
eventId: 60228,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("onRequestPopupData_0010 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual("callBackSuccess");
done();
}
console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('getXComponentContextText', 10, "")));
events_emitter.on(innerEventOne, callback1);
} catch (err) {
console.info("onRequestPopupData_0010 on events_emitter err : " + JSON.stringify(err));
}
console.info('testxcomponentGetXComponentContext0010 END');
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testxcomponentSetXComponentSurfaceSize0001
* @tc.desic acexcomponentSetXComponentSurfaceSizeEtsTest0001
*/
it('testxcomponentSetXComponentSurfaceSize0001', 0, async function (done) {
console.info('xcomponentSetXComponentContext testxcomponentSetXComponentSurfaceSize0001 START');
await Utils.sleep(2000);
console.info("setXComponentSurfaceSize0001 click result is: " + JSON.stringify(sendEventByKey('setXComponentSurfaceSizeText', 10, "")))
let strJson = getInspectorByKey('setXComponentSurfaceSizeText');
//console
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual("Text");
expect(obj.$attrs.surfaceWidth).assertEqual(undefined);
console.info('testxcomponentSetXComponentSurfaceSize0001 END');
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testxcomponentSetXComponentSurfaceSize0002
* @tc.desic acexcomponentSetXComponentSurfaceSizeEtsTest0002
*/
it('testxcomponentSetXComponentSurfaceSize0002', 0, async function (done) {
console.info('xcomponentSetXComponentContext testxcomponentSetXComponentSurfaceSize0002 START');
await Utils.sleep(2000);
console.info("testxcomponentSetXComponentSurfaceSize0002 click result is: " + JSON.stringify(sendEventByKey('setXComponentSurfaceSizeText', 10, "")))
let strJson = getInspectorByKey('setXComponentSurfaceSizeText');
//console
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual("Text");
expect(obj.$attrs.surfaceHeight).assertEqual(undefined);
console.info('testxcomponentSetXComponentSurfaceSize0002 END');
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.
先完成此消息的编辑!
想要评论请 注册