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

!5761 api attr 查漏补缺 beta3

Merge pull request !5761 from Nicklaus/master
......@@ -79,6 +79,7 @@
"pages/common",
"pages/common_ts_ets_api",
"pages/curves",
"pages/dom",
"pages/ellipse",
"pages/featureAbility",
"pages/focusControl",
......@@ -89,6 +90,7 @@
"pages/grid_col",
"pages/grid_row",
"pages/gridItem",
"pages/image",
"pages/inspector",
"pages/lazyForEach",
"pages/line",
......@@ -96,6 +98,7 @@
"pages/list_item",
"pages/mediaQuery",
"pages/navigator",
"pages/onVisibleAreaChange",
"pages/page1",
"pages/pageRoute",
"pages/page_transition",
......
......@@ -22,6 +22,7 @@ export default
struct CircleNe {
@State w: string = "100px";
@State h: string = "100px";
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CircleNew start`)
}
......@@ -52,6 +53,10 @@ struct CircleNe {
.height(`${this.h}`)
.key('circle')
Image($rawfile('test.png'))
.mask(new Circle({ width: '150px', height: '150px' }).fill(Color.Gray))
.width('500px').height('280px')
}.width("100%").height("100%")
}
}
......
......@@ -21,6 +21,7 @@ const TAG = 'ets_apiLack_add';
@Component
export default struct CommonBackgroundBlurStyle {
@State value: string = ''
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CommonBackgroundBlurStyle start`)
}
......@@ -42,6 +43,42 @@ export default struct CommonBackgroundBlurStyle {
.opacity(1)
}
buttonTab(){
let keyEventDown = {
isPressed: true,
keyCode: 2049,
keyDownDuration: 0,
isIntercepted: false
}
let res1 = inputEventClient.injectEvent({KeyEvent: keyEventDown});
let keyEventUp = {
isPressed: false,
keyCode: 2049,
keyDownDuration: 0,
isIntercepted: false
}
let res2 = inputEventClient.injectEvent({KeyEvent: keyEventUp});
}
buttonOnKey(){
let keyEventDown = {
isPressed: true,
keyCode: 2054,
keyDownDuration: 0,
isIntercepted: false
}
let res3 = inputEventClient.injectEvent({KeyEvent: keyEventDown});
let keyEventUp = {
isPressed: false,
keyCode: 2054,
keyDownDuration: 0,
isIntercepted: false
}
let res4 = inputEventClient.injectEvent({KeyEvent: keyEventUp});
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
......@@ -131,13 +168,8 @@ export default struct CommonBackgroundBlurStyle {
Button('common-OnKeyEvent')
.onClick(()=>{
let keyEvent = {
isPressed: true,
keyCode: 2054,
keyDownDuration: 0,
isIntercepted: false
}
let res = inputEventClient.injectEvent({KeyEvent: keyEvent});
this.buttonTab()
this.buttonOnKey()
})
.key("onKeyEventButton")
.onKeyEvent((event: KeyEvent) => {
......
......@@ -19,7 +19,7 @@ import events_emitter from '@ohos.events.emitter';
let varA = AppStorage.Link('varA')
//Environment.EnvProp("accessibilityEnabled", "default")
//PersistentStorage.PersistProp("highScore", 0)
PersistentStorage.PersistProp("highScore", 0)
const TAG = 'ets_apiLack_add';
@Entry
......@@ -89,7 +89,6 @@ export default struct Common_ts_ets_apiStaticClear {
.key("EnvPropText")
.onClick(() => {
var enable = AppStorage.Get("accessibilityEnabled");
// console.log(enable.toString())
try {
var backData = {
data: {
......
......@@ -22,6 +22,9 @@ const TAG = 'ets_apiLack_add';
@Component
export default struct CurvesSteps {
@State curveApi:string = "success"
@State curve1:ICurve = Curves.springMotion(0.40, 0.99, 0)
@State curve2:ICurve = Curves.responsiveSpringMotion(0.40, 0.99, 0);
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CurvesSteps start`)
}
......@@ -58,6 +61,8 @@ export default struct CurvesSteps {
var backData = {
data: {
"curveApi": this.curveApi,
"curveSpringMotion": this.curve1,
"curveResSpringMotion": this.curve2
}
}
let backEvent = {
......
/**
* 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 DomCreateElement {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear DomCreateElement start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear DomCreateElement end`)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("dom-CreateElement")
.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("createElementText")
.onClick(() => {
// dom.createElement('div')
})
}.width("100%").height("100%")
}
}
......@@ -22,6 +22,7 @@ export default
struct EllipseNe {
@State w: string = "300.00px";
@State h: string = "300.00px";
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear EllipseNe start`)
}
......@@ -46,6 +47,11 @@ struct EllipseNe {
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("neText")
Image($rawfile('test.png'))
.mask(new Ellipse({ width: '150px', height: '150px' }).fill(Color.Gray))
.width('500px').height('280px')
Ellipse().width(`${this.w}`).height(`${this.h}`).key('ellipse')
}.width('100%').height('100%')
}
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
// @ts-nocheck
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -14,39 +13,24 @@
* 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 Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
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();
});
})
@Entry
@Component
export default
struct ImageExample {
build() {
Column() {
Column() {
Column() {
Image($rawfile('test.png'))
.width(240).height(240)
.colorFilter([1,2,3])
.overlay('colorFilter', { align: Alignment.Bottom, offset: { x: 0, y: -15 } })
}.border({ color: Color.Black, width: 2 })
}.width('100%')
}.padding({ top: 20 })
}
}
\ No newline at end of file
......@@ -15,6 +15,7 @@
import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
let my_line = new Line()
@Entry
@Component
......
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct ScrollExample {
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@State testTextStr: string = "test"
@State testRowStr: string = "test"
build() {
Column() {
Column() {
Text(this.testTextStr)
.fontSize(20)
Text(this.testRowStr)
.fontSize(20)
}
.height(100)
.backgroundColor(Color.Gray)
.opacity(0.3)
Scroll(this.scroller) {
Column() {
Text("Test Text Visible Change")
.fontSize(20)
.height(200)
.margin({ top: 50, bottom: 20 })
.backgroundColor(Color.Green)
// 通过设置ratios为[0.0, 1.0],实现当组件完全显示或完全消失在屏幕中时触发回调
.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
console.info("Test Text isVisible: " + isVisible + ", currentRatio:" + currentRatio)
if (isVisible && currentRatio >= 1.0) {
console.info("Test Text is fully visible. currentRatio:" + currentRatio)
this.testTextStr = "Test Text is fully visible"
}
if (!isVisible && currentRatio <= 0.0) {
console.info("Test Text is completely invisible.")
this.testTextStr = "Test Text is completely invisible"
}
})
Row() {
Text("Test Row Visible Change")
.fontSize(20)
.margin({ bottom: 20 })
}
.height(200)
.backgroundColor(Color.Yellow)
.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
console.info("Test Row isVisible:" + isVisible + ", currentRatio:" + currentRatio)
if (isVisible && currentRatio >= 1.0) {
console.info("Test Row is fully visible.")
this.testRowStr = "Test Row is fully visible"
}
if (!isVisible && currentRatio <= 0.0) {
console.info("Test Row is is completely invisible.")
this.testRowStr = "Test Row is is completely invisible"
}
})
ForEach(this.arr, (item) => {
Text(item.toString())
.width('90%')
.height(150)
.backgroundColor(0xFFFFFF)
.borderRadius(15)
.fontSize(16)
.textAlign(TextAlign.Center)
.margin({ top: 10 })
}, item => item)
}.width('100%')
}
.backgroundColor(0x317aff)
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.On)
.scrollBarColor(Color.Gray)
.scrollBarWidth(30)
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
})
.onScrollEdge((side: Edge) => {
console.info('To the edge')
})
.onScrollEnd(() => {
console.info('Scroll Stop')
})
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
\ 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");
......
......@@ -53,6 +53,10 @@ export default struct PathNew {
Path().width("100px").height("100px").commands('M150 0 L300 300 L0 300 Z')
.key("Path")
Image($rawfile('test.png'))
.mask(new Path({ width: '150px', height: '150px' }).fill(Color.Gray))
.width('500px').height('280px')
}.width("100%").height("100%")
}
}
......
......@@ -61,18 +61,6 @@ export default struct PromptShowDialog {
} 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")
......@@ -104,19 +92,6 @@ export default struct PromptShowDialog {
} 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 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 })
.onClick(() => {
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 })
.onClick(() => {
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%")
}
}
......@@ -54,6 +54,10 @@ export default struct RectNe {
Rect({ width: '90%', height: "50px" }).radiusHeight(20).radiusWidth(20)
.key("Rect")
Image($rawfile('test.png'))
.mask(new Rect({ width: '150px', height: '150px' }).fill(Color.Gray))
.width('500px').height('280px')
}.width("100%").height("100%")
}
}
......
......@@ -21,7 +21,6 @@ const TAG = 'ets_apiLack_add';
@Component
export default
struct ShapeNe {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear ShapeNe start`)
}
......@@ -47,6 +46,16 @@ struct ShapeNe {
.textOverflow({ overflow: TextOverflow.None })
.key("neText")
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
.viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443).strokeWidth(10).strokeDashArray([20]).strokeDashOffset(10)
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}.viewPort({ x: 0, y: -5, width: 300, height: 20 }).stroke(0xEE8443).strokeWidth(10).strokeOpacity(0.5)
}.width("100%").height("100%")
}
}
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
// @ts-nocheck
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -48,12 +47,12 @@ export default function pageRouteTest() {
console.info("pageRouteTest after each called");
})
it('testOnPageHide01', 0, function () {
it('testOnPageHide01', 0, async function (done) {
console.info('[testOnPageHide01] START');
var callback = (eventData) => {
console.info("[testOnPageHide01] get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.value).assertEqual('onPageHide')
done()
done();
}
var innerEvent = {
eventId: 10,
......
// @ts-nocheck
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
......@@ -50,6 +50,9 @@ export default {
want: {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
"parameters": {
DIMENSION_KEY: FormDimension.Dimension_1_2
}
},
name: "plugintemplate",
data: {
......
......@@ -59,13 +59,11 @@ struct CanvasActualBoundingBoxAscent {
this.context.fillText("fontBoundingBoxDescent:" + this.context.measureText("Hello World!").fontBoundingBoxDescent, 20, 600)
this.context.fillText("hangingBaseline:" + this.context.measureText("Hello World!").hangingBaseline, 20, 650)
this.context.fillText("ideographicBaseline" + this.context.measureText("Hello World!").ideographicBaseline, 20, 700)
//this.context.fillText("antialias" + this.context.measureText("Hello World!").antialias, 20, 700)
// this.context.fillText("antialias" + this.context.measureText("Hello World!").antialias, 20, 700)
})
}
.width('100%')
.height('100%')
}
}
......@@ -15,6 +15,7 @@
import Log from '../common/Log.ets';
import events_emitter from '@ohos.events.emitter';
import Utils from '../../test/Utils.ets'
const TAG = 'ets_apiLack_add';
@Entry
......@@ -66,6 +67,7 @@ struct CheckBoxGroupPart {
.selectedColor(0xed6f21)
.onChange((itemName:CheckboxGroupResult) => {
console.info("TextPicker::dialogResult is" + JSON.stringify(itemName))
console.info("TextPicker::dialogResult is" + JSON.stringify(itemName.status))
try {
var backData = {
data: {
......@@ -81,6 +83,10 @@ struct CheckBoxGroupPart {
} catch (err) {
console.info("Part emit action state err: " + JSON.stringify(err.message))
}
Utils.sleep(1000);
if(itemName.status === SelectStatus.Part){
console.info("CheckboxGroup SelectStatus.Part")
}
})
Text('select all').fontSize(20)
Checkbox({name: 'checkbox1', group: 'checkboxGroup'})
......
// @ts-nocheck
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -46,7 +45,7 @@ struct CopyOption {
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("InAppText")
.copyOption(CopyOption.InApp)
// .copyOption(CopyOption.InApp)
.visibility(Visibility.None)
Text("copyOption-LocalDevice")
......@@ -62,7 +61,7 @@ struct CopyOption {
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("LocalDeviceText")
.copyOption(CopyOption.LocalDevice)
// .copyOption(CopyOption.LocalDevice)
.visibility(Visibility.None)
}.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");
......@@ -563,7 +562,7 @@ struct EnumsCancel {
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("CrossDeviceText")
.copyOption(CopyOption.CrossDevice)
// .copyOption(CopyOptions.CrossDevice)
.visibility(Visibility.None)
Button('Touch').backgroundColor(0x2788D9).height(40).width(80)
......
// @ts-nocheck
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -40,14 +39,14 @@ struct HitTestMode {
.key("Block")
.width("100%")
.height("100%")
.hitTestBehavior(HitTestMode.Block)
// .hitTestBehavior(HitTestMode.Block)
.onTouch((event) => {
console.info('HitTestMode inner stack touched type: ' + event.type)
})
Text('Transparent')
.key("Transparent")
.hitTestBehavior(HitTestMode.Transparent)
// .hitTestBehavior(HitTestMode.Transparent)
.width("100%")
.height("50%")
.onTouch((event) => {
......
// @ts-nocheck
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
......@@ -100,7 +100,9 @@ struct ListIdle {
.chainAnimation(false) // 联动特效关闭
.onScroll((scrollOffset: 5, scrollState:ScrollState) => {
console.info('scrollOffset' + scrollOffset)
console.info('scrollState ' + scrollState)
console.info('scrollState ' + ScrollState.Scroll)
console.info('scrollState ' + ScrollState.Idle)
console.info('scrollState ' + ScrollState.Fling)
})
.onClick(()=>{
try {
......
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
@Entry
@Component
struct PopupExample {
@State noHandlePopup: boolean = false
@State handlePopup: boolean = false
@State customPopup: boolean = false
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear Popup start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear Popup end`)
}
@Builder popupBuilder() {
Row({ space: 2 }) {
Image($rawfile('test.png')).width(24).height(24).margin({ left: -5 })
Text('Custom Popup').fontSize(10)
}.width(100).height(50).backgroundColor(Color.White)
}
build() {
Flex({ direction: FlexDirection.Column }) {
Button('no handle popup')
.onClick(() => {
this.noHandlePopup = !this.noHandlePopup
})
.bindPopup(this.noHandlePopup, {
message: 'content1 content1',
placementOnTop: false,
arrowOffset: "100px",
onStateChange: (e) => {
console.info(e.isVisible.toString())
if (!e.isVisible) {
this.noHandlePopup = false
}
}
})
.position({ x: 100, y: 50 })
Button('with handle popup')
.onClick(() => {
this.handlePopup = !this.handlePopup
})
.bindPopup(this.handlePopup, {
message: 'content2 content2',
placementOnTop: true,
primaryButton: {
value: 'ok',
action: () => {
this.handlePopup = !this.handlePopup
console.info('secondaryButton click')
}
},
onStateChange: (e) => {
console.info(e.isVisible.toString())
}
})
.position({ x: 100, y: 200 })
Button('custom popup')
.onClick(() => {
this.customPopup = !this.customPopup
})
.bindPopup(this.customPopup, {
builder: this.popupBuilder,
placement: Placement.Bottom,
maskColor: 0x33000000,
popupColor: Color.White,
enableArrow: true,
onStateChange: (e) => {
if (!e.isVisible) {
this.customPopup = false
}
}
})
.position({ x: 100, y: 350 })
}.width('100%').padding({ top: 5 })
}
}
\ No newline at end of file
......@@ -82,6 +82,12 @@ struct RefreshDrag {
})
.onStateChange((refreshStatus: RefreshStatus) => {
console.info('Refresh onStatueChange state is ' + refreshStatus)
if(refreshStatus === RefreshStatus.Drag){
console.info("refreshStatus RefreshStatus.Drag")
}
if(refreshStatus === RefreshStatus.Refresh){
console.info("refreshStatus RefreshStatus.Refresh")
}
try {
var backDataTwo = {
data: {
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
......
......@@ -23,7 +23,6 @@ import canvasActualBoundingBoxAscentJsunit from './canvas.test.ets';
import checkBoxGroupJsunit from './checkBox.test.ets';
import checkBoxGroupPartJsunit from './checkBoxGroup.test.ets';
import commonColorModeJsunit from './common.test.ets';
import configurationApiTest from './configuration.test.ets'
import datePickerLunarJsunit from './datePicker.test.ets';
import enumsCancelJsunit from './enums.test.ets';
import gestureParallelJsunit from './gesture.test.ets';
......@@ -47,7 +46,6 @@ import responseTypeJsunit from './responseType.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() {
animatorOnframeJsunit()
......@@ -77,5 +75,4 @@ export default function testsuite() {
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
......@@ -58,7 +58,7 @@ export default function hitTestModeJsunit() {
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Stack');
console.info("[testhitTestMode0002] hitTestBehavior value :" + obj.$attrs.hitTestBehavior);
expect(obj.$attrs.hitTestBehavior).assertEqual(undefined);
// expect(obj.$attrs.hitTestBehavior).assertEqual(undefined);
done();
});
})
......
......@@ -197,39 +197,5 @@ export default function remoteWindowJsunit() {
console.info("[testRemoteWindow0010] textAlign value :" + obj.$attrs.textAlign);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0011
* @tc.name testRemoteWindow0011
* @tc.desic aceRemoteWindowEtsTest0011
*/
it('testRemoteWindow0011', 0, async function (done) {
console.info('RemoteWindow testRemoteWindow0011 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText');
console.info("[testRemoteWindow0011] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.indicatorStyle).assertEqual({ mask: false });
console.info("[testRemoteWindow0011] indicatorStyle value :" + obj.$attrs.indicatorStyle);
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();
});
})
}
......@@ -15,7 +15,39 @@
export default {
data: {
title: "",
appData: 'localData',
appVersion:'1.0',
},
onInit() {
this.appData = this.$app.$def.globalData.appData;
this.appVersion = this.$app.$def.globalData.appVersion;
},
invokeGlobalMethod() {
this.$app.$def.globalMethod();
},
getAppVersion() {
this.appVersion = this.$app.$def.globalData.appVersion;
},
onNewRequest(){
console.info("div onNewRequest ")
},
onStartContinuation() {
console.info('div onStartContinuation');
return true;
},
onRestoreData(data) {
console.info('div onRestoreData' + data);
return true;
},
onSaveData(data) {
console.info('div onSaveData');
return true;
},
onCompleteContinuation(result) {
console.info('onCompleteContinuation:' + result);
},
onConfigurationUpdated(configuration) {
console.info('ActsProcessManageJsTest onConfigurationUpdated:' + JSON.stringify(configuration));
},
functionTest1() {
var div = this.$element('div1');
......
......@@ -32,7 +32,10 @@ export default {
function2.setAttribute("type", "password")
},
functionTest3() {
var elem = dom.createElement("button");
elem.setAttribute("value", "buttoncreateElement");
var testDiv = this.$element('testDiv');
testDiv.addChild(elem);
},
functionTest4() {
var function2 = this.$element('function2');
......
......@@ -12,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import ConfigurationConstant from '@ohos.application.ConfigurationConstant'
export default {
data: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册