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

!5695 ets attr api覆盖

Merge pull request !5695 from Nicklaus/master
...@@ -90,7 +90,7 @@ struct TextInputOnEditChange { ...@@ -90,7 +90,7 @@ struct TextInputOnEditChange {
.border({ width: 1 }) .border({ width: 1 })
.padding(10) .padding(10)
.textAlign(TextAlign.Center) .textAlign(TextAlign.Center)
//设置复制选项时调用 //设置复制选项时调用
.copyOption(0) .copyOption(0)
.key("textInputCopyOptionText") .key("textInputCopyOptionText")
...@@ -108,7 +108,7 @@ struct TextInputOnEditChange { ...@@ -108,7 +108,7 @@ struct TextInputOnEditChange {
//设置密码显示/隐藏图标时调用 //设置密码显示/隐藏图标时调用
.showPasswordIcon(true) .showPasswordIcon(true)
.key("showPasswordIconText") .key("showPasswordIconText")
}.width("100%").height("100%") }.width("100%").height("100%")
} }
} }
......
...@@ -93,11 +93,13 @@ ...@@ -93,11 +93,13 @@
"pages/gridCol", "pages/gridCol",
"pages/gridRow", "pages/gridRow",
"pages/listtest", "pages/listtest",
"pages/list_item_group",
"pages/loadingProgress", "pages/loadingProgress",
"pages/pluginComponent", "pages/pluginComponent",
"pages/progress", "pages/progress",
"pages/radio", "pages/radio",
"pages/refresh", "pages/refresh",
"pages/remoteWindow",
"pages/router", "pages/router",
"pages/scroll_edge", "pages/scroll_edge",
"pages/sidebar", "pages/sidebar",
...@@ -110,7 +112,9 @@ ...@@ -110,7 +112,9 @@
"pages/web", "pages/web",
"pages/copyOption", "pages/copyOption",
"pages/responseType", "pages/responseType",
"pages/hoverEffect" "pages/hoverEffect",
"pages/hitTestMode",
"pages/color"
], ],
"name": ".MainAbility", "name": ".MainAbility",
"window": { "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';
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default
struct ColorEnum {
build() {
Column() {
Text('Transparent')
.fontColor(Color.Transparent)
.backgroundColor(Color.Yellow)
.fontSize(50)
.key('Transparent')
.onClick(() => {
let strJson = getInspectorByKey('Transparent');
let obj = JSON.parse(strJson);
console.info("testTransparent fontColor is" + obj.$attrs.fontColor);
})
}.width("100%").height("100%")
}
}
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import Log from '../common/Log.ets'; import Log from '../common/Log.ets';
import events_emitter from '@ohos.events.emitter';
const TAG = 'ets_apiLack_add'; const TAG = 'ets_apiLack_add';
@Entry @Entry
...@@ -118,7 +118,26 @@ export default struct CommonColorMode { ...@@ -118,7 +118,26 @@ export default struct CommonColorMode {
.textOverflow({ overflow: TextOverflow.None }) .textOverflow({ overflow: TextOverflow.None })
.key("areaText") .key("areaText")
.onClick((event) => { .onClick((event) => {
Log.showInfo(TAG, 'area: ' + JSON.stringify(event.target.area)) Log.showInfo(TAG, 'JSON.stringify area : ' + JSON.stringify(event.target.area))
const area = JSON.stringify(event.target.area)
console.info("area value1 is: " + area)
console.info("area value3 is: " + JSON.parse(JSON.stringify(event.target.area))["width"])
let value = JSON.parse(JSON.stringify(event.target.area))["width"]
try {
var backData = {
data: {
"STATUS": value
}
}
let backEvent = {
eventId: 60312,
priority: events_emitter.EventPriority.LOW
}
console.info("areaValue start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("areaValue emit action state err: " + JSON.stringify(err.message))
}
}) })
Text("common-Repeat") Text("common-Repeat")
.width(320) .width(320)
...@@ -263,6 +282,25 @@ export default struct CommonColorMode { ...@@ -263,6 +282,25 @@ export default struct CommonColorMode {
.key("touchesText") .key("touchesText")
.onTouch((event) => { .onTouch((event) => {
Log.showInfo(TAG, 'touches: ' + JSON.stringify(event.touches)) Log.showInfo(TAG, 'touches: ' + JSON.stringify(event.touches))
const touchesValue = JSON.stringify(event.touches)
console.info("touches value1 is: " + touchesValue)
console.info("touches value3 is: " + JSON.stringify(event.touches)[0]["type"])
let value = JSON.stringify(event.touches)[0]["type"]
try {
var backData1 = {
data: {
"STATUS": value
}
}
let backEvent1 = {
eventId: 60313,
priority: events_emitter.EventPriority.LOW
}
console.info("touchesValue start to emit action state")
events_emitter.emit(backEvent1, backData1)
} catch (err) {
console.info("touchesValue emit action state err: " + JSON.stringify(err.message))
}
}) })
Text("common-ChangedTouches") Text("common-ChangedTouches")
...@@ -280,6 +318,25 @@ export default struct CommonColorMode { ...@@ -280,6 +318,25 @@ export default struct CommonColorMode {
.key("changedTouchesText") .key("changedTouchesText")
.onTouch((event) => { .onTouch((event) => {
Log.showInfo(TAG, 'changedTouches: ' + JSON.stringify(event.changedTouches)) Log.showInfo(TAG, 'changedTouches: ' + JSON.stringify(event.changedTouches))
const changedTouchesValue = JSON.stringify(event.changedTouches)
console.info("changedTouchesValue value1 is: " + changedTouchesValue)
console.info("changedTouchesValue value3 is: " + changedTouchesValue[0]["type"])
let value = changedTouchesValue[0]["type"]
try {
var backData2 = {
data: {
"STATUS": value
}
}
let backEvent2 = {
eventId: 60314,
priority: events_emitter.EventPriority.LOW
}
console.info("touchesValue start to emit action state")
events_emitter.emit(backEvent2, backData2)
} catch (err) {
console.info("touchesValue emit action state err: " + JSON.stringify(err.message))
}
}) })
Text("common-KeyCode") Text("common-KeyCode")
......
// @ts-nocheck
/**
* 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
struct HitTestMode {
build() {
Column() {
// outer stack 1
Stack() {
Button('outer button')
.onTouch((event) => {
console.info('HitTestMode outer button touched type: ' + event.type)
})
// inner stack
Stack() {
Button('inner button')
.key("innnerButton")
.onTouch((event) => {
console.info('HitTestMode inner button touched type: ' + event.type)
})
}
.key("Block")
.width("100%")
.height("100%")
.hitTestBehavior(HitTestMode.Block)
.onTouch((event) => {
console.info('HitTestMode inner stack touched type: ' + event.type)
})
Text('Transparent')
.key("Transparent")
.hitTestBehavior(HitTestMode.Transparent)
.width("100%")
.height("50%")
.onTouch((event) => {
console.info('HitTestMode text touched type: ' + event.type)
let strJson = getInspectorByKey('Transparent');
let obj = JSON.parse(strJson);
console.info("HitTestMode hitTestBehavior is " + obj.$attrs.hitTestBehavior);
let strJson2 = getInspectorByKey('Block');
let obj2 = JSON.parse(strJson2);
console.info("HitTestMode hitTestBehavior is " + obj2.$attrs.hitTestBehavior);
})
}.width(300).height(300).backgroundColor(Color.Gray)
}.width('100%').height('100%')
}
}
// @ts-nocheck
/**
* 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';
function itemHeadBuilder(text: string) {
@Builder function itemHead() {
Text(text)
.fontSize(20)
.backgroundColor(0xAABBCC)
.width("100%")
.padding(10)
}
return itemHead
}
function itemFootBuilder(num: number) {
@Builder function itemFoot() {
Text('共' + num + "节课")
.fontSize(16)
.backgroundColor(0xAABBCC)
.width("100%")
.padding(5)
}
return itemFoot
}
@Entry
@Component
struct ListItemGroupExample {
private timetable: any = [
{
title:'Mon',
projects:['语文', '数学', '英语']
},
{
title:'Tues',
projects:['物理', '化学', '生物']
},
{
title:'Wens',
projects:['历史', '地理', '政治']
},
{
title:'Thur',
projects:['美术', '音乐', '体育']
}
]
build() {
Column() {
List({ space: 20 }) {
ForEach(this.timetable, (item) => {
ListItemGroup({ header:itemHeadBuilder(item.title), footer:itemFootBuilder(item.projects.length) }) {
ForEach(item.projects, (project) => {
ListItem() {
Text(project)
.width("100%").height(100).fontSize(20)
.textAlign(TextAlign.Center).backgroundColor(0xFFFFFF)
}
}, item => item)
}
.key(item)
.borderRadius(20)
.divider({ strokeWidth: 1, color: Color.Blue}) // 每行之间的分界线
})
}
.width('90%')
.sticky(StickyStyle.Header | StickyStyle.Footer)
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}
}
\ No newline at end of file
...@@ -20,6 +20,8 @@ const TAG = 'ets_apiLack_add'; ...@@ -20,6 +20,8 @@ const TAG = 'ets_apiLack_add';
@Entry @Entry
@Component @Component
export default struct FormComponentFormDimension { export default struct FormComponentFormDimension {
@State target: WindowAnimationTarget = undefined // 通过windowAnimationManager获取
aboutToAppear() { aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear Dimension start`) Log.showInfo(TAG, `aboutToAppear Dimension start`)
} }
...@@ -52,6 +54,7 @@ export default struct FormComponentFormDimension { ...@@ -52,6 +54,7 @@ export default struct FormComponentFormDimension {
.position({ x: px2vp(this.target?.windowBounds.left), y: px2vp(this.target?.windowBounds.top) }) .position({ x: px2vp(this.target?.windowBounds.left), y: px2vp(this.target?.windowBounds.top) })
.width(px2vp(this.target?.windowBounds.width)) .width(px2vp(this.target?.windowBounds.width))
.height(px2vp(this.target?.windowBounds.height)) .height(px2vp(this.target?.windowBounds.height))
.key('remoteWindow')
} }
.width('100%') .width('100%')
......
...@@ -21,6 +21,8 @@ const TAG = 'ets_apiLack_add'; ...@@ -21,6 +21,8 @@ const TAG = 'ets_apiLack_add';
@Component @Component
export default struct Text_inputPhoneNumber { export default struct Text_inputPhoneNumber {
@State text: string = '' @State text: string = ''
@State text1: string = 'PhoneNumber'
@State text2: string = 'Address'
aboutToAppear() { aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear Text_inputPhoneNumber start`) Log.showInfo(TAG, `aboutToAppear Text_inputPhoneNumber start`)
...@@ -49,6 +51,37 @@ export default struct Text_inputPhoneNumber { ...@@ -49,6 +51,37 @@ export default struct Text_inputPhoneNumber {
this.text = value this.text = value
}) })
Text(this.text1).width('90%')
TextInput({ placeholder: 'input your word' })
.key('textInput1')
.type(InputType.PhoneNumber)
.placeholderColor("rgb(0,0,225)")
.placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic })
.caretColor(Color.Blue)
.height(50)
.fontSize(30)
.fontWeight(FontWeight.Bold)
.fontFamily("sans-serif")
.fontStyle(FontStyle.Normal)
.fontColor(Color.Red)
.style(TextInputStyle.Default)
Text(this.text2).width('90%')
TextInput({ placeholder: 'input your word' })
.key('textInput2')
.type(InputType.PhoneNumber)
.placeholderColor("rgb(0,0,225)")
.placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic })
.caretColor(Color.Blue)
.height(50)
.fontSize(30)
.fontWeight(FontWeight.Bold)
.fontFamily("sans-serif")
.fontStyle(FontStyle.Normal)
.fontColor(Color.Red)
.style(TextInputStyle.Inline)
.margin(10)
}.width("100%").height("100%") }.width("100%").height("100%")
} }
} }
......
...@@ -23,14 +23,17 @@ import canvasActualBoundingBoxAscentJsunit from './canvas.test.ets'; ...@@ -23,14 +23,17 @@ import canvasActualBoundingBoxAscentJsunit from './canvas.test.ets';
import checkBoxGroupJsunit from './checkBox.test.ets'; import checkBoxGroupJsunit from './checkBox.test.ets';
import checkBoxGroupPartJsunit from './checkBoxGroup.test.ets'; import checkBoxGroupPartJsunit from './checkBoxGroup.test.ets';
import commonColorModeJsunit from './common.test.ets'; import commonColorModeJsunit from './common.test.ets';
import configurationApiTest from './configuration.test.ets'
import datePickerLunarJsunit from './datePicker.test.ets'; import datePickerLunarJsunit from './datePicker.test.ets';
import enumsCancelJsunit from './enums.test.ets'; import enumsCancelJsunit from './enums.test.ets';
import gestureParallelJsunit from './gesture.test.ets'; import gestureParallelJsunit from './gesture.test.ets';
import listtestIdleJsunit from './listtest.test.ets'; import listtestIdleJsunit from './listtest.test.ets';
import list_item_groupJsunit from './list_item_group.test.ets'
import loadingProgressCircularJsunit from './loadingProgress.test.ets'; import loadingProgressCircularJsunit from './loadingProgress.test.ets';
import progressScaleCountJsunit from './progress.test.ets'; import progressScaleCountJsunit from './progress.test.ets';
import radioGroupJsunit from './radio.test.ets'; import radioGroupJsunit from './radio.test.ets';
import refreshDragJsunit from './refresh.test.ets'; import refreshDragJsunit from './refresh.test.ets';
import remoteWindowJsunit from './remoteWindow.test.ets'
import sidebarIconsJsunit from './sidebar.test.ets'; import sidebarIconsJsunit from './sidebar.test.ets';
import sliderMovingJsunit from './slider.test.ets'; import sliderMovingJsunit from './slider.test.ets';
import stateManagementDARKJsunit from './stateManagement.test.ets'; import stateManagementDARKJsunit from './stateManagement.test.ets';
...@@ -42,12 +45,13 @@ import webEditTextJsunit from './web.test.ets'; ...@@ -42,12 +45,13 @@ import webEditTextJsunit from './web.test.ets';
import hoverEffectJsunit from './hoverEffect.test.ets'; import hoverEffectJsunit from './hoverEffect.test.ets';
import responseTypeJsunit from './responseType.test.ets'; import responseTypeJsunit from './responseType.test.ets';
import copyOptionJsunit from './copyOption.test.ets'; import copyOptionJsunit from './copyOption.test.ets';
import hitTestModeJsunit from './hitTestMode.test.ets';
import colorEnumJsunit from './color.test.ets';
import basicJsunit from './basic.test.ets';
export default function testsuite() { export default function testsuite() {
animatorOnframeJsunit() animatorOnframeJsunit()
curvesEaseOutJsunit()
routerStandardJsunit() routerStandardJsunit()
uiAppearanceALWAYS_DARKJsunit()
appVersionCodeJsunit() appVersionCodeJsunit()
alertDialogCenterStartJsunit() alertDialogCenterStartJsunit()
canvasActualBoundingBoxAscentJsunit() canvasActualBoundingBoxAscentJsunit()
...@@ -55,22 +59,23 @@ export default function testsuite() { ...@@ -55,22 +59,23 @@ export default function testsuite() {
checkBoxGroupPartJsunit() checkBoxGroupPartJsunit()
commonColorModeJsunit() commonColorModeJsunit()
datePickerLunarJsunit() datePickerLunarJsunit()
enumsCancelJsunit()
gestureParallelJsunit() gestureParallelJsunit()
listtestIdleJsunit() listtestIdleJsunit()
loadingProgressCircularJsunit() loadingProgressCircularJsunit()
progressScaleCountJsunit() progressScaleCountJsunit()
radioGroupJsunit() radioGroupJsunit()
refreshDragJsunit() remoteWindowJsunit()
sidebarIconsJsunit() sidebarIconsJsunit()
sliderMovingJsunit() sliderMovingJsunit()
stateManagementDARKJsunit() stateManagementDARKJsunit()
stepperItemDisabledJsunit() stepperItemDisabledJsunit()
swiperMaskJsunit() swiperMaskJsunit()
text_inputPhoneNumberJsunit()
unitsModuleNameJsunit() unitsModuleNameJsunit()
webEditTextJsunit() webEditTextJsunit()
hoverEffectJsunit() hoverEffectJsunit()
responseTypeJsunit() responseTypeJsunit()
copyOptionJsunit() copyOptionJsunit()
hitTestModeJsunit()
colorEnumJsunit()
basicJsunit()
} }
\ No newline at end of file
// @ts-nocheck
/**
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
import Utils from './Utils.ets'
export default function basicJsunit() {
describe('basicJsunit', function () {
let businessCallback: AsyncCallback<string, Array<number>> = (error, data) => {
console.info("businessCallback error data is" + JSON.stringify(error.data));
expect(JSON.stringify(error.data)).assertEqual("[1,2]");
}
function businessErrorTest(asyncCallback: AsyncCallback<string, Array<number>>): void {
let businessError: BusinessError<Array<number>> = {
code: 1,
data: [1,2]
};
businessCallback(businessError, "businessErrorCallback");
}
let asyncCallback: AsyncCallback<string, Array<number>> = (error, data) => {
console.info("asyncCallback error data is" + error.data);
expect(error.data).assertEqual(EdgeEffect.Fade);
}
function asyncCallbackTest(asyncCallback: AsyncCallback<string, EdgeEffect>): void {
let businessError: BusinessError<EdgeEffect> = {
code: 1,
data: EdgeEffect.Fade
};
asyncCallback(businessError, "asyncCallback");
}
beforeEach(async function (done) {
console.info("basicTest beforeEach start");
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("basicTest after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testAsyncCallbackE0001
* @tc.desic aceAsyncCallbackEEtsTest0001
*/
it('testAsyncCallbackE0001', 0, async function (done) {
console.info('basicTest testAsyncCallbackE0001 START');
await Utils.sleep(2000);
asyncCallbackTest(asyncCallback);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testBusinessError0002
* @tc.desic aceBusinessErrorEtsTest0001
*/
it('testBusinessError0002', 0, async function (done) {
console.info('basicTest testBusinessError0002 START');
await Utils.sleep(2000);
businessErrorTest(businessCallback);
done();
});
});
}
\ No newline at end of file
/**
* 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 colorEnumJsunit() {
describe('colorEnumJsunit', function () {
beforeEach(async function (done) {
console.info("color beforeEach start");
let options = {
uri: 'pages/color',
}
try {
router.clear();
let pages = router.getState();
console.info("get color state success " + JSON.stringify(pages));
if (!("color" == pages.name)) {
console.info("get color state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(1000);
console.info("push color page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push color page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("colorEnumTest after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testcolorTransparent0001
* @tc.desic acecolorTransparentEtsTest0001
*/
it('testcolorTransparent0001', 0, async function (done) {
console.info('colorEnumTest testcolorTransparent0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Transparent');
console.info("[testcolorTransparent0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
console.info("[testcolorTransparent0001] fontColor value :" + obj.$attrs.fontColor);
expect(obj.$attrs.fontColor).assertEqual("#FF000000");
done();
});
})
}
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import events_emitter from '@ohos.events.emitter';
import router from '@system.router'; import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets' import Utils from './Utils.ets'
...@@ -47,124 +48,199 @@ export default function commonColorModeJsunit() { ...@@ -47,124 +48,199 @@ export default function commonColorModeJsunit() {
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0011 * @tc.number SUB_ACE_BASIC_ETS_API_0011
* @tc.name testcommonColorMode0011 * @tc.name testCommonColorMode0011
* @tc.desic acecommonColorModeEtsTest0011 * @tc.desic acecommonColorModeEtsTest0011
*/ */
it('testcommonColorMode0011', 0, async function (done) { it('testCommonColorMode0011', 0, async function (done) {
console.info('commonColorMode testcommonColorMode0011 START'); console.info('commonColorMode testCommonColorMode0011 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('ThinText'); let strJson = getInspectorByKey('ThinText');
console.info("[testcommonColorMode0011] component textAlign strJson:" + strJson); console.info("[testCommonColorMode0011] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined); expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined);
console.info("[testcommonColorMode0011] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle); console.info("[testCommonColorMode0011] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0012 * @tc.number SUB_ACE_BASIC_ETS_API_0012
* @tc.name testcommonColorMode0012 * @tc.name testCommonColorMode0012
* @tc.desic acecommonColorModeEtsTest0012 * @tc.desic acecommonColorModeEtsTest0012
*/ */
it('testcommonColorMode0012', 0, async function (done) { it('testCommonColorMode0012', 0, async function (done) {
console.info('commonColorMode testcommonColorMode0012 START'); console.info('commonColorMode testCommonColorMode0012 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('ThickText'); let strJson = getInspectorByKey('ThickText');
console.info("[testcommonColorMode0012] component textAlign strJson:" + strJson); console.info("[testCommonColorMode0012] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined); expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined);
console.info("[testcommonColorMode0012] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle); console.info("[testCommonColorMode0012] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_00017 * @tc.number SUB_ACE_BASIC_ETS_API_00017
* @tc.name testcommonMiddle0001 * @tc.name testCommonMiddle0001
* @tc.desic acecommonMiddleEtsTest0001 * @tc.desic acecommonMiddleEtsTest0001
*/ */
it('testcommonMiddle0001', 0, async function (done) { it('testCommonMiddle0001', 0, async function (done) {
console.info('commonMiddle testcommonMiddle0001 START'); console.info('commonMiddle testCommonMiddle0001 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('middleText'); let strJson = getInspectorByKey('middleText');
console.info("[testcommonMiddle0001] component textAlign strJson:" + strJson); console.info("[testCommonMiddle0001] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('Text');
console.info("[testcommonMiddle0001] alignRules value :" + obj.$attrs.alignRules); console.info("[testCommonMiddle0001] alignRules value :" + obj.$attrs.alignRules);
expect(obj.$attrs.alignRules).assertEqual(undefined); expect(obj.$attrs.alignRules).assertEqual(undefined);
console.info("[testcommonMiddle0001] alignRules value :" + obj.$attrs.alignRules); console.info("[testCommonMiddle0001] alignRules value :" + obj.$attrs.alignRules);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_00018 * @tc.number SUB_ACE_BASIC_ETS_API_00018
* @tc.name testcommonOutset0001 * @tc.name testCommonOutset0001
* @tc.desic acecommonOutsetEtsTest0001 * @tc.desic acecommonOutsetEtsTest0001
*/ */
it('testcommonOutset0001', 0, async function (done) { it('testCommonOutset0001', 0, async function (done) {
console.info('commonOutset testcommonOutset0001 START'); console.info('commonOutset testCommonOutset0001 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('outsetText'); let strJson = getInspectorByKey('outsetText');
console.info("[testcommonOutset0001] component textAlign strJson:" + strJson); console.info("[testCommonOutset0001] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('Text');
console.info("[testcommonOutset0001] borderImage value :" + obj.$attrs.borderImage); console.info("[testCommonOutset0001] borderImage value :" + obj.$attrs.borderImage);
expect(obj.$attrs.borderImage).assertEqual(undefined); expect(obj.$attrs.borderImage).assertEqual(undefined);
console.info("[testcommonOutset0001] borderImage value :" + obj.$attrs.borderImage); console.info("[testCommonOutset0001] borderImage value :" + obj.$attrs.borderImage);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_00019 * @tc.number SUB_ACE_BASIC_ETS_API_00019
* @tc.name testcommonRepeat0001 * @tc.name testCommonRepeat0001
* @tc.desic acecommonRepeatEtsTest0001 * @tc.desic acecommonRepeatEtsTest0001
*/ */
it('testcommonRepeat0001', 0, async function (done) { it('testCommonRepeat0001', 0, async function (done) {
console.info('commonRepeat testcommonRepeat0001 START'); console.info('commonRepeat testCommonRepeat0001 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('RepeatText'); let strJson = getInspectorByKey('RepeatText');
console.info("[testcommonRepeat0001] component textAlign strJson:" + strJson); console.info("[testCommonRepeat0001] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.borderImage).assertEqual(undefined); expect(obj.$attrs.borderImage).assertEqual(undefined);
console.info("[testcommonOutset0001] borderImage value :" + obj.$attrs.borderImage); console.info("[testCommonOutset0001] borderImage value :" + obj.$attrs.borderImage);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_00020 * @tc.number SUB_ACE_BASIC_ETS_API_00020
* @tc.name testcommonSpace0001 * @tc.name testCommonSpace0001
* @tc.desic acecommonSpaceEtsTest0001 * @tc.desic acecommonSpaceEtsTest0001
*/ */
it('testcommonSpace0001', 0, async function (done) { it('testCommonSpace0001', 0, async function (done) {
console.info('commonSpace testcommonSpace0001 START'); console.info('commonSpace testCommonSpace0001 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('SpaceText'); let strJson = getInspectorByKey('SpaceText');
console.info("[testcommonSpace0001] component textAlign strJson:" + strJson); console.info("[testCommonSpace0001] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.borderImage).assertEqual(undefined); expect(obj.$attrs.borderImage).assertEqual(undefined);
console.info("[testcommonSpace0001] borderImage value :" + obj.$attrs.borderImage); console.info("[testCommonSpace0001] borderImage value :" + obj.$attrs.borderImage);
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_00021 * @tc.number SUB_ACE_BASIC_ETS_API_00021
* @tc.name testcommonSlice0001 * @tc.name testCommonSlice0001
* @tc.desic acecommonSliceEtsTest0001 * @tc.desic acecommonSliceEtsTest0001
*/ */
it('testcommonSlice0001', 0, async function (done) { it('testCommonSlice0001', 0, async function (done) {
console.info('commonSlice testcommonSlice0001 START'); console.info('commonSlice testCommonSlice0001 START');
await Utils.sleep(2000); await Utils.sleep(2000);
let strJson = getInspectorByKey('sliceText'); let strJson = getInspectorByKey('sliceText');
console.info("[testcommonSlice0001] component textAlign strJson:" + strJson); console.info("[testCommonSlice0001] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson); let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text'); expect(obj.$type).assertEqual('Text');
console.info("[testcommonSlice0001] borderImage value :" + obj.$attrs.borderImage); console.info("[testCommonSlice0001] borderImage value :" + obj.$attrs.borderImage);
expect(obj.$attrs.borderImage).assertEqual(undefined); expect(obj.$attrs.borderImage).assertEqual(undefined);
console.info("[testcommonSlice0001] borderImage value :" + obj.$attrs.borderImage); console.info("[testCommonSlice0001] borderImage value :" + obj.$attrs.borderImage);
done(); done();
}); });
/*
* @tc.number SUB_ACE_BASIC_ETS_API_00022
* @tc.name testCommonArea0001
* @tc.desic acecommonAreaEtsTest0001
*/
it('testCommonArea0001', 0, async function (done) {
console.info('commonSlice testCommonArea0001 START');
await Utils.sleep(500);
try {
var innerEvent = {
eventId: 60312,
priority: events_emitter.EventPriority.LOW
}
var callback = (eventData) => {
console.info("testCommonArea0001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(320);
done();
}
console.info("testCommonArea0001 click result is: " + JSON.stringify(sendEventByKey('areaText', 10, "")));
events_emitter.on(innerEvent, callback);
} catch (err) {
console.info("testCommonArea0001 on click err : " + JSON.stringify(err));
}
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_00023
* @tc.name testCommonTouches0001
* @tc.desic acecommonTouchesEtsTest0001
*/
it('testCommonTouches0001', 0, async function (done) {
console.info('commonSlice testCommonTouches0001 START');
await Utils.sleep(500);
try {
var innerEvent = {
eventId: 60313,
priority: events_emitter.EventPriority.LOW
}
var callback = (eventData) => {
console.info("testCommonTouches0001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(undefined);
done();
}
console.info("testCommonTouches0001 click result is: " + JSON.stringify(sendEventByKey('touchesText', 10, "")));
events_emitter.on(innerEvent, callback);
} catch (err) {
console.info("testCommonTouches0001 on click err : " + JSON.stringify(err));
}
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_00024
* @tc.name testCommonChangedTouches0001
* @tc.desic acecommonTouchesEtsTest0001
*/
it('testCommonChangedTouches0001', 0, async function (done) {
console.info('commonSlice testCommonChangedTouches0001 START');
await Utils.sleep(500);
try {
var innerEvent = {
eventId: 60314,
priority: events_emitter.EventPriority.LOW
}
var callback = (eventData) => {
console.info("testCommonChangedTouches0001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(undefined);
done();
}
console.info("changedTouches0001 click is: " + JSON.stringify(sendEventByKey('changedTouchesText', 10, "")));
events_emitter.on(innerEvent, callback);
} catch (err) {
console.info("testCommonChangedTouches0001 on click err : " + JSON.stringify(err));
}
});
}) })
} }
// @ts-nocheck
/**
* 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 configuration from '@system.configuration';
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets'
export default function configurationApiTest() {
describe('configurationApiTest', function () {
beforeEach(async function (done) {
await Utils.sleep(1000);
console.info("appVersionCode after each called");
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("appVersionCode after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name colorMode001
* @tc.desic aceColorMode001EtsTest0001
*/
it('colorMode001', 0, async function (done) {
console.info('colorMode001 test START');
const localeInfo = configuration.getLocale();
console.info("[configuration.getLocale] localeInfo: " + JSON.stringify(localeInfo));
console.info("[configuration.getLocale] colorMode: " + localeInfo.colorMode);
console.info("[configuration.getLocale] fontScale: " + localeInfo.fontScale);
expect(localeInfo.colorMode).assertEqual('COLOR_MODE_LIGHT');
expect(localeInfo.fontScale).assertEqual('ltr');
console.info('testConfigurationGetLocale 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'
export default function hitTestModeJsunit() {
describe('hitTestModeJsunit', function () {
beforeEach(async function (done) {
console.info("hitTestMode beforeEach start");
let options = {
uri: 'pages/hitTestMode',
}
try {
router.clear();
let pages = router.getState();
console.info("get hitTestMode state success " + JSON.stringify(pages));
if (!("hitTestMode" == pages.name)) {
console.info("get hitTestMode state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push hitTestMode page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push hitTestMode page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("hitTestModeTest after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testhitTestMode0002
* @tc.desic acehitTestModelEtsTest0002
*/
it('testhitTestMode0002', 0, async function (done) {
console.info('hitTestMode testhitTestMode0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Block');
console.info("[testhitTestMode0002] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Stack');
console.info("[testhitTestMode0002] hitTestBehavior value :" + obj.$attrs.hitTestBehavior);
expect(obj.$attrs.hitTestBehavior).assertEqual(undefined);
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_item_groupJsunit() {
describe('list_item_groupJsunit', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/list_item_group',
}
try {
router.clear();
let pages = router.getState();
console.info("get list_item_group state success " + JSON.stringify(pages));
if (!("list_item" == pages.name)) {
console.info("get list_item_group state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push list_item_group page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push list_item_group page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("list_item_group after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testlist_itemOnSelect0001
* @tc.desic acelist_itemOnSelectEtsTest0001
*/
it('testlist_item_group0001', 0, async function (done) {
console.info('testcase testlist_item_group0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Mon');
console.info("[testlist_item_group0001] component state strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItemGroup');
console.info("[testlist_item_group0001] editable value :" + obj.$type);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testlist_itemOnSelect0002
* @tc.desic acelist_itemOnSelectEtsTest0002
*/
it('testlist_item_group0002', 0, async function (done) {
console.info('testcase testlist_item_group0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Tues');
console.info("[testlist_item_group0002] component border strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItemGroup');
console.info("[testlist_item_group0002] selectable value :" + obj.$type);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testlist_itemOnSelect0003
* @tc.desic acelist_itemOnSelectEtsTest0002
*/
it('testlist_item_group0003', 0, async function (done) {
console.info('testcase testlist_item_group0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Wens');
console.info("[testlist_item_group0003] component border strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItemGroup');
expect(obj.$attrs.header).assertNotEqual(undefined);
console.info("[testlist_itemOnSelect0003] hear value :" + obj.$attrs.header);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testlist_itemSwipeAction0004
* @tc.desic acelist_itemSwipeActionEtsTest0004
*/
it('testlist_item_group0004', 0, async function (done) {
console.info('testcase testlist_item_group0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Thurs');
console.info("[testlist_item_group0004] component border strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItemGroup');
expect(obj.$attrs.rooter).assertNotEqual(undefined);
console.info("[testlist_item_group0004] hear value :" + obj.$attrs.rooter);
done();
});
})
}
...@@ -164,8 +164,6 @@ export default function remoteWindowJsunit() { ...@@ -164,8 +164,6 @@ export default function remoteWindowJsunit() {
done(); done();
}); });
/* /*
* @tc.number SUB_ACE_BASIC_ETS_API_0009 * @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testRemoteWindow0009 * @tc.name testRemoteWindow0009
...@@ -216,5 +214,22 @@ export default function remoteWindowJsunit() { ...@@ -216,5 +214,22 @@ export default function remoteWindowJsunit() {
console.info("[testRemoteWindow0011] indicatorStyle value :" + obj.$attrs.indicatorStyle); console.info("[testRemoteWindow0011] indicatorStyle value :" + obj.$attrs.indicatorStyle);
done(); done();
}); });
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0012
* @tc.name testRemoteWindow0011
* @tc.desic aceRemoteWindowEtsTest0011
*/
it('testRemoteWindow0012', 0, async function (done) {
console.info('RemoteWindow testRemoteWindow0012 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('remoteWindow');
console.info("[testRemoteWindow0012] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$attrs.target).assertNotEqual(undefined);
expect(obj.$attrs.target.missionId).assertNotEqual(undefined);
console.info("[testRemoteWindow0012] missionId value :" + obj.$attrs.target.missionId);
done();
});
}) })
} }
...@@ -61,5 +61,29 @@ export default function text_inputPhoneNumberJsunit() { ...@@ -61,5 +61,29 @@ export default function text_inputPhoneNumberJsunit() {
console.info("[testtext_inputPhoneNumber0001] type value :" + obj.$attrs.type); console.info("[testtext_inputPhoneNumber0001] type value :" + obj.$attrs.type);
done(); done();
}); });
it('testtextInputStyle0001', 0, async function (done) {
console.info('textInputStyle testtextInputStyle0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('textInput1');
console.info("[testtextInputStyle0001] strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('TextInput');
expect(obj.$attrs.style).assertEqual('TextInputStyle.Default');
console.info("[testtextInputStyle0001] textInput1 InputStyle value :" + obj.$attrs.style);
done();
});
it('testtextInputStyle0002', 0, async function (done) {
console.info('textInputStyle testtextInputStyle0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('textInput2');
console.info("[testtextInputStyle0002] strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('TextInput');
expect(obj.$attrs.style).assertEqual('TextInputStyle.Inline');
console.info("[testtextInputStyle0002] textInput2 inputStyle value :" + obj.$attrs.style);
done();
});
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册