提交 121e9b15 编写于 作者: B bayanxing

api覆盖

Signed-off-by: Nbayanxing <bayanxing@kaihong.com>
上级 dc12624e
...@@ -75,12 +75,17 @@ ...@@ -75,12 +75,17 @@
"pages/alphabetIndexer", "pages/alphabetIndexer",
"pages/checkBoxGroup", "pages/checkBoxGroup",
"pages/circle", "pages/circle",
"pages/common",
"pages/ellipse", "pages/ellipse",
"pages/gauge",
"pages/grid", "pages/grid",
"pages/grid_col",
"pages/grid_row",
"pages/gridItem", "pages/gridItem",
"pages/inspector", "pages/inspector",
"pages/lazyForEach", "pages/lazyForEach",
"pages/navigator", "pages/navigator",
"pages/panel",
"pages/path", "pages/path",
"pages/polygon", "pages/polygon",
"pages/polyLine", "pages/polyLine",
...@@ -88,13 +93,16 @@ ...@@ -88,13 +93,16 @@
"pages/rect", "pages/rect",
"pages/scroll", "pages/scroll",
"pages/search", "pages/search",
"pages/sideBar",
"pages/stack",
"pages/swiper", "pages/swiper",
"pages/tabs", "pages/tabs",
"pages/text", "pages/text",
"pages/textArea", "pages/textArea",
"pages/textInput", "pages/textInput",
"pages/textPicker", "pages/textPicker",
"pages/video" "pages/video",
"pages/web"
], ],
"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 CommonBackgroundBlurStyle {
@State value: string = ''
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CommonBackgroundBlurStyle start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear CommonBackgroundBlurStyle end`)
}
onPageHide(): void {
Log.showInfo(TAG, `onPageHide CommonBackgroundBlurStyle start`)
}
onBackPress(): void {
Log.showInfo(TAG, `onBackPress CommonBackgroundBlurStyle start`)
}
@Styles pressedStyles() {
.backgroundColor('red')
.opacity(1)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("common-BackgroundBlurStyle")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("backgroundBlurStyleText")
.backgroundBlurStyle(BlurStyle.Thick)
Text("common-BorderImage")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("borderImageText")
.borderImage({
source: {
angle: 90,
direction: GradientDirection.Left,
colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]]
},
slice: { top: 10, bottom: 10, left: 10, right: 10 },
width: { top: "10px", bottom: "10px", left: "10px", right: "10px" },
repeat: RepeatMode.Stretch,
fill: false
})
Text("common-HoverEffectHighlight")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("hoverEffectText")
.hoverEffect(HoverEffect.Highlight)
Text("common-HoverEffectScale")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("hoverEffectText")
.hoverEffect(HoverEffect.Scale)
Text("common-OnKeyEvent")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onKeyEventText")
Button('common-OnKeyEvent')
.key("onKeyEventButton")
.onKeyEvent((event: KeyEvent) => {
if (event.type === KeyType.Down) {
Log.showInfo(TAG, `Down`)
}
if (event.type === KeyType.Up) {
Log.showInfo(TAG, `Up`)
}
Log.showInfo(TAG, 'KeyType:' + event.type + ';keyCode:' + event.keyCode + ';keyText:' + event.keyText)
})
Text("common-TabIndex")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("tabIndexText")
.tabIndex(1)
Text("common-ParallelGesture" + '\n' + this.value)
.width(320)
.height(100)
.fontSize(12)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(15)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("parallelGestureText")
.parallelGesture(TapGesture().onAction(() => {
// 并行手势
this.value = 'gesture onAction'
}))
Text("common-Sepia")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("sepiaText")
.backgroundColor('#E78282')
.sepia(1)
Button('Button 1')
.id('target')
Text("common-AlignRules")
.width(260)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("alignRulesText")
.alignRules({
top: { anchor: 'target', align: VerticalAlign.Bottom },
right: { anchor: "target", align: HorizontalAlign.Center }
})
Text("common-StateStyles")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("stateStylesText")
.stateStyles({
pressed: this.pressedStyles
})
Text("common-OnVisibleAreaChange")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onVisibleAreaChangeText")
Text("common-OnPageHide")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onPageHideText")
Text("common-OnBackPress")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onBackPressText")
}.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';
@Entry
@Component
export default
struct GaugeColors {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear GaugeColors start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear GaugeColors end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("gauge-Colors")
.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("colorsText")
Gauge({ value: 50, min: 0, max: 100 })
.startAngle(210).endAngle(150)
.colors([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1], [0xD94838, 1]])
.strokeWidth(20)
.width(200).height(200)
.key("Gauge")
}.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';
@Entry
@Component
export default
struct Grid_colSpan {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear Grid_colSpan start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear Grid_colSpan end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("grid_col-Span")
.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("spanText")
Text("grid_col-Order")
.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("orderText")
GridCol({span: 10, offset:50, order: 10}){
}
.width(100)
.height(100)
.backgroundColor(0x308014)
.backgroundColor(0xf1f3f5)
.margin({ top: 10 })
.key('gridContainer')
}.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';
@Entry
@Component
export default
struct Grid_rowOnBreakpointChange {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear Grid_rowOnBreakpointChange start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear Grid_rowOnBreakpointChange end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("grid_row-OnBreakpointChange")
.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("onBreakpointChangeText")
GridContainer({ sizeType: SizeType.SM }) {
GridRow({gutter: 10, columns:50, direction: GridRowDirection.Row}){
}
.key("GridRow")
.width(100)
.height(100)
.backgroundColor(0xFF0000)
.onBreakpointChange((breakpoints: string) => {
console.info("onBreakpointChange=" + breakpoints)
})
}
}.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';
@Entry
@Component
export default struct PanelBackgroundMask {
@State show1: boolean = false
@State show2: boolean = false
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear PanelBackgroundMask start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear PanelBackgroundMask end`)
}
build() {
// Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) {
Column() {
Text("panel-BackgroundMask")
.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("backgroundMaskText")
.onClick(() => {
this.show1 = !this.show1
})
Text("panel-OnHeightChange")
.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("onHeightChangeText")
.onClick(() => {
this.show2 = !this.show2
})
Panel(this.show1) {
Column() {
Text("panel-BackgroundMask").fontSize(30)
}
}
.backgroundColor('green')
.type(PanelType.Foldable)
.mode(PanelMode.Half)
.dragBar(false)
.halfHeight(300)
.onChange((width: number, height: number, mode: PanelMode) => {
Log.showInfo(TAG, `width:${width},height:${height},mode:${mode}`)
})
.backgroundMask('red')
Panel(this.show2) {
Column() {
Text("panel-OnHeightChange").fontSize(30)
}
}
.backgroundColor('red')
.type(PanelType.Foldable)
.mode(PanelMode.Half)
.dragBar(false)
.halfHeight(300)
.onChange((width: number, height: number, mode: PanelMode) => {
console.log(`width:${width},height:${height},mode:${mode}`)
})
.onHeightChange((value: number) => {
Log.showInfo(TAG, 'onHeightChange: ' + value)
})
}.width("100%").height("100%")
}
}
...@@ -97,8 +97,6 @@ export default struct SearchOnCut { ...@@ -97,8 +97,6 @@ export default struct SearchOnCut {
.searchButton('Search') .searchButton('Search')
.textFont({ size: 20 }) .textFont({ size: 20 })
.placeholderFont({ size: 20 }) .placeholderFont({ size: 20 })
// 编译报错
// .copyOption(CopyOption.InApp)
.key("CopyOption") .key("CopyOption")
}.width("100%").height("100%") }.width("100%").height("100%")
......
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default
struct SideBarShowSideBar {
normalIcon : Resource = $r("app.media.user")
selectedIcon: Resource = $r("app.media.userFull")
@State arr: number[] = [1, 2, 3]
@State current: number = 1
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear SideBarShowSideBar start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear SideBarShowSideBar end`)
}
build() {
SideBarContainer(SideBarContainerType.Embed)
{
Column() {
ForEach(this.arr, (item, index) => {
Column({ space: 5 }) {
Image(this.current === item ? this.selectedIcon : this.normalIcon).width(64).height(64)
Text("Index0" + item)
.fontSize(25)
.fontColor(this.current === item ? '#0A59F7' : '#999')
.fontFamily('source-sans-pro,cursive,sans-serif')
}
.onClick(() => {
this.current = item
})
}, item => item)
}.width('100%')
.justifyContent(FlexAlign.SpaceEvenly)
.backgroundColor('#19000000')
RowSplit() {
Column(){
Text('Split page one').fontSize(30)
}.justifyContent(FlexAlign.Center)
Column(){
Text('Split page two').fontSize(30)
}.justifyContent(FlexAlign.Center)
}.width('100%')
}
.key("SideBarContainer")
.showSideBar(true)
.autoHide(false)
.sideBarWidth(240)
.minSideBarWidth(210)
.maxSideBarWidth(260)
.onChange((value: boolean) => {
console.info('status:' + value)
})
}
}
/**
* 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 StackAlignContent {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear StackAlignContent start`)
}
aboutToDisappear(){
Log.showInfo(TAG, `aboutToDisAppear StackAlignContent end`)
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Text("stack-AlignContent")
.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("alignContentText")
Stack({ alignContent: Alignment.Bottom }) {
Text('First child, show in bottom')
.width('95%')
.width('90%')
.height('100%')
.backgroundColor(0xd2cab3)
.align(Alignment.Top)
Text('Second child, show in top')
.width('70%')
.height('60%')
.backgroundColor(0xc1cbac)
.align(Alignment.Top)
}.key("Stack")
.width('100%').height(150).margin({ top: 5 })
}.width("100%").height("100%")
}
}
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import events_emitter from '@ohos.events.emitter';
import Log from '../common/Log.ets'; import Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add'; const TAG = 'ets_apiLack_add';
...@@ -52,6 +53,21 @@ struct VideoOnFullscreenChange { ...@@ -52,6 +53,21 @@ struct VideoOnFullscreenChange {
console.info('screen is changed') console.info('screen is changed')
console.error('screen is changed') console.error('screen is changed')
console.warn('screen is changed') console.warn('screen is changed')
try{
var backData = {
data: {
"result": "success"
}
}
let backEvent = {
eventId: 101,
priority: events_emitter.EventPriority.LOW
}
console.info("video_101 onClick start to emit action state")
events_emitter.emit(backEvent, backData)
} catch(err) {
console.info("video_101 onClick emit action state err: " + JSON.stringify(err.message))
}
}) })
.onPause(() => { .onPause(() => {
console.error('onPause'); console.error('onPause');
...@@ -75,10 +91,15 @@ struct VideoOnFullscreenChange { ...@@ -75,10 +91,15 @@ struct VideoOnFullscreenChange {
console.error('onUpdateis ' + e.time); console.error('onUpdateis ' + e.time);
}) })
Row() { Row() {
Button("FullScreen").onClick(() => { Button("FullScreen")
.key("fullScreen")
.onClick(() => {
this.controller.requestFullscreen(true) this.controller.requestFullscreen(true)
}); });
Button("ExitFullScreen").onClick(() => {
Button("ExitFullScreen")
.key("exitFullScreen")
.onClick(() => {
this.controller.exitFullscreen() this.controller.exitFullscreen()
}); });
} }
......
/*
* 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';
@Entry
@Component
struct WebComponent {
@State progress: number = 0;
@State hideProgress: boolean = true;
fileAccess: boolean = true;
// 定义Web组件的控制器controller
controller: WebController = new WebController();
webResourceResponse: WebResourceResponse = new WebResourceResponse();
build() {
Column() {
Text('Hello world!')
.fontSize(20)
Progress({value: this.progress, total: 100})
.color('#0000ff')
.visibility(this.hideProgress ? Visibility.None : Visibility.Visible)
// 初始化Web组件,并绑定controller
Web({ src: $rawfile('index.html'), controller: this.controller })
.key("getTitleText")
.fileAccess(this.fileAccess)
.javaScriptAccess(true)
.height(500)
.padding(20)
.blur(2)
.userAgent("Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36")
.fileFromUrlAccess(true)
.initialScale(2)
.webDebuggingAccess(true)
.onPrompt((event) => {
console.info('onPrompt url: ', event.url);
console.info('onPrompt message: ', event.message);
console.info('onPrompt result: ', event.result);
console.info('onPrompt handlePromptConfirm: ', event.result.handlePromptConfirm("confirm"));
return true;
})
.onShowFileSelector((event) => {
console.info('onShowFileSelector getAcceptType: ', event.fileSelector.getAcceptType());
console.info('onShowFileSelector getTitle: ', event.fileSelector.getTitle());
console.info('onShowFileSelector getMode: ', event.fileSelector.getMode());
console.info('onShowFileSelector isCapture: ', event.fileSelector.isCapture());
event.result.handleFileList(["D:\DevEcoStudioProjects","D:\DevEcoStudioProjects"])
return true;
})
.onRenderExited((event) => {
console.info('onRenderExited getAcceptType: ', event.renderExitReason);
})
.onProgressChange(e => {
this.progress = e.newProgress;
if (this.progress === 100) {
this.hideProgress = true;
} else {
this.hideProgress = false;
}
})
.onResourceLoad((event) => {
console.info('onResourceLoad url: ', event.url);
return true;
})
.onPageEnd(e => {
// test()在index.html中定义
this.controller.runJavaScript({ script: 'test()' });
console.info('url: ', e.url);
})
.onHttpAuthRequest((event) => {
console.info('onHttpAuthRequest host: ', event.host);
console.info('onHttpAuthRequest realm: ', event.realm);
console.info('onHttpAuthRequest isHttpAuthInfoSaved: ', event.handler.isHttpAuthInfoSaved());
let result = event.handler;
return true;
})
.onInterceptRequest((event) => {
console.info('onInterceptRequest getRequestUrl: ', event.request.getRequestUrl());
console.info('onInterceptRequest isMainFrame: ', event.request.isMainFrame());
console.info('onInterceptRequest isRedirect: ', event.request.isRedirect());
console.info('onInterceptRequest isRequestGesture: ', event.request.isRequestGesture());
let result = event.request.getRequestHeader();
console.log('The request header result size is ' + result.length);
for (let i of result) {
console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
}
return this.webResourceResponse;
})
// .onContextMenuShow((event) => {
// console.info("x coord = " + event.param.x());
// console.info("y coord = " + event.param.y());
// console.info("link url = " + event.param.getLinkUrl());
// console.info("unfilterendLinkUrl = " + event.param.getUnfilterendLinkUrl());
// console.info("sourceUrl = " + event.param.getSourceUrl());
// console.info("existsImageContents = " + event.param.existsImageContents());
// console.info("closeContextMenu = " + event.result.closeContextMenu());
// console.info("copyImage = " + event.result.copyImage());
// })
// .onPermissionRequest((event) => {
// AlertDialog.show({
// title: 'title',
// message: 'text',
// confirm: {
// value: 'onConfirm',
// action: () => {
// event.request.grant(event.request.getAccessibleResource());
// console.info('onPermissionRequest getAccessibleResource: ', event.request.getAccessibleResource());
// console.info('onPermissionRequest getOrigin: ', event.request.getOrigin());
// }
// },
// cancel: () => {
// event.request.deny();
// }
// })
// })
.onScaleChange((event) => {
console.info('onScaleChange oldScale: ', event.oldScale);
console.info('onScaleChange newScale: ', event.newScale);
})
.onHttpErrorReceive((event) => {
console.log('url:' + event.request.getRequestUrl());
console.log('isMainFrame:' + event.request.isMainFrame());
console.log('isRedirect:' + event.request.isRedirect());
console.log('isRequestGesture:' + event.request.isRequestGesture());
console.log('getResponseData:' + event.response.getResponseData());
console.log('getResponseEncoding:' + event.response.getResponseEncoding());
console.log('getResponseMimeType:' + event.response.getResponseMimeType());
console.log('getResponseCode:' + event.response.getResponseCode());
console.log('getReasonMessage:' + event.response.getReasonMessage());
console.log('setResponseData:' + event.response.setResponseData("ResponseData"));
console.log('setReasonMessage:' + event.response.setReasonMessage("success"));
console.log('setResponseCode:' + event.response.setResponseCode(200));
console.log('setResponseEncoding:' + event.response.setResponseEncoding("UTF-8"));
console.log('setResponseMimeType:' + event.response.setResponseMimeType("application/json"));
console.log('setResponseHeader:' + event.response.setResponseHeader([]));
console.log('web getExtra:' + this.controller.getHitTestValue().getExtra());
console.log('web getType:' + this.controller.getHitTestValue().getType());
console.log('web getCookieManager:' + this.controller.getCookieManager());
console.log('web getCookie:' + this.controller.getCookieManager().getCookie("www.baidu.com"));
console.log('web existCookie:' + this.controller.getCookieManager().existCookie());
console.log('web deleteEntireCookie:' + this.controller.getCookieManager().deleteEntireCookie());
console.log('web deleteExpiredCookie:' + this.controller.getCookieManager().deleteExpiredCookie());
console.log('web deleteSessionCookie:' + this.controller.getCookieManager().deleteSessionCookie());
console.log('web isCookieAllowed:' + this.controller.getCookieManager().isCookieAllowed());
console.log('web isFileURICookieAllowed:' + this.controller.getCookieManager().isFileURICookieAllowed());
console.log('web isThirdPartyCookieAllowed:' + this.controller.getCookieManager().isThirdPartyCookieAllowed());
console.log('web putAcceptCookieEnabled:' + this.controller.getCookieManager().putAcceptCookieEnabled(true));
console.log('web putAcceptFileURICookieEnabled:' + this.controller.getCookieManager().putAcceptFileURICookieEnabled(true));
console.log('web putAcceptThirdPartyCookieEnabled:' + this.controller.getCookieManager().putAcceptThirdPartyCookieEnabled(true));
console.log('web saveCookieSync:' + this.controller.getCookieManager().saveCookieSync());
console.log('web zoomIn:' + this.controller.zoomIn());
console.log('web zoomOut:' + this.controller.zoomOut());
console.log('web zoom:' + this.controller.zoom(2));
console.log('web getWebId:' + this.controller.getWebId());
console.log('web getDefaultUserAgent:' + this.controller.getDefaultUserAgent());
console.log('web getTitle:' + this.controller.getTitle());
console.log('web getPageHeight:' + this.controller.getPageHeight());
console.log('web backOrForward:' + this.controller.backOrForward(2));
let result = event.request.getRequestHeader();
console.log('The request header result size is ' + result.length);
for (let i of result) {
console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
}
let resph = event.response.getResponseHeader();
console.log('The response header result size is ' + resph.length);
for (let i of resph) {
console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
}
})
Text('End')
.fontSize(20)
}
}
}
\ No newline at end of file
...@@ -16,9 +16,13 @@ ...@@ -16,9 +16,13 @@
import alphabetIndexerOnSelectJsunit from './alphabetIndexer.test.ets'; import alphabetIndexerOnSelectJsunit from './alphabetIndexer.test.ets';
import checkBoxGroupSelectAllJsunit from './checkBoxGroup.test.ets'; import checkBoxGroupSelectAllJsunit from './checkBoxGroup.test.ets';
import circleNewJsunit from './circle.test.ets'; import circleNewJsunit from './circle.test.ets';
import commonBackgroundBlurStyleJsunit from './common.test.ets';
import ellipseNeJsunit from './ellipse.test.ets'; import ellipseNeJsunit from './ellipse.test.ets';
import gaugeColorsJsunit from './gauge.test.ets';
import gridMaxCountJsunit from './grid.test.ets'; import gridMaxCountJsunit from './grid.test.ets';
import gridItemOnSelectJsunit from './gridItem.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 inspectorJsunit from './inspector.test.ets'
import lazyForEachOnDataAddJsunit from './lazyForEach.test.ets'; import lazyForEachOnDataAddJsunit from './lazyForEach.test.ets';
import navigatorTargetJsunit from './navigator.test.ets' import navigatorTargetJsunit from './navigator.test.ets'
...@@ -29,6 +33,8 @@ import progressScaleCountJsunit from './progress.test.ets'; ...@@ -29,6 +33,8 @@ import progressScaleCountJsunit from './progress.test.ets';
import rectNeJsunit from './rect.test.ets'; import rectNeJsunit from './rect.test.ets';
import scrollOnScrollBeginJsunit from './scroll.test.ets'; import scrollOnScrollBeginJsunit from './scroll.test.ets';
import searchOnCutJsunit from './search.test.ets' import searchOnCutJsunit from './search.test.ets'
import sideBarShowSideBarJsunit from './sideBar.test.ets';
import stackAlignContentJsunit from './stack.test.ets';
import swiperCurveJsunit from './swiper.test.ets'; import swiperCurveJsunit from './swiper.test.ets';
import tabsBarPositionJsunit from './tabs.test.ets'; import tabsBarPositionJsunit from './tabs.test.ets';
import textMinFontSizeJsunit from './text.test.ets'; import textMinFontSizeJsunit from './text.test.ets';
...@@ -36,13 +42,17 @@ import textAreaOnCutJsunit from './textArea.test.ets'; ...@@ -36,13 +42,17 @@ import textAreaOnCutJsunit from './textArea.test.ets';
import textInputOnEditChangeJsunit from './textInput.test.ets'; import textInputOnEditChangeJsunit from './textInput.test.ets';
import textPickerDefaultPickerItemHeightJsunit from './textPicker.test.ets'; import textPickerDefaultPickerItemHeightJsunit from './textPicker.test.ets';
import videoOnFullscreenChangeJsunit from './video.test.ets'; import videoOnFullscreenChangeJsunit from './video.test.ets';
import webGetTitleJsunit from './web.test.ets';
export default function testsuite() { export default function testsuite() {
lazyForEachOnDataAddJsunit() lazyForEachOnDataAddJsunit()
alphabetIndexerOnSelectJsunit() alphabetIndexerOnSelectJsunit()
checkBoxGroupSelectAllJsunit() checkBoxGroupSelectAllJsunit()
circleNewJsunit() circleNewJsunit()
commonBackgroundBlurStyleJsunit()
ellipseNeJsunit() ellipseNeJsunit()
gaugeColorsJsunit()
grid_rowOnBreakpointChangeJsunit()
gridMaxCountJsunit() gridMaxCountJsunit()
gridItemOnSelectJsunit() gridItemOnSelectJsunit()
inspectorJsunit() inspectorJsunit()
...@@ -54,6 +64,8 @@ export default function testsuite() { ...@@ -54,6 +64,8 @@ export default function testsuite() {
rectNeJsunit() rectNeJsunit()
scrollOnScrollBeginJsunit() scrollOnScrollBeginJsunit()
searchOnCutJsunit() searchOnCutJsunit()
sideBarShowSideBarJsunit()
stackAlignContentJsunit()
swiperCurveJsunit() swiperCurveJsunit()
tabsBarPositionJsunit() tabsBarPositionJsunit()
textMinFontSizeJsunit() textMinFontSizeJsunit()
...@@ -61,4 +73,5 @@ export default function testsuite() { ...@@ -61,4 +73,5 @@ export default function testsuite() {
textInputOnEditChangeJsunit() textInputOnEditChangeJsunit()
textPickerDefaultPickerItemHeightJsunit() textPickerDefaultPickerItemHeightJsunit()
videoOnFullscreenChangeJsunit() videoOnFullscreenChangeJsunit()
webGetTitleJsunit()
} }
\ No newline at end of file
...@@ -249,7 +249,7 @@ export default function alphabetIndexerOnSelectJsunit() { ...@@ -249,7 +249,7 @@ export default function alphabetIndexerOnSelectJsunit() {
console.info("onRequestPopupData_0012 get event state result is: " + JSON.stringify(eventData)); console.info("onRequestPopupData_0012 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(true); expect(eventData.data.STATUS).assertEqual(true);
} }
sendEventByKey('alphabetIndexer', 10, "") // sendEventByKey('alphabetIndexer', 10, "")
console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('alphabetIndexer', 10, ""))); console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('alphabetIndexer', 10, "")));
events_emitter.on(innerEventOne, callback1); events_emitter.on(innerEventOne, callback1);
} catch (err) { } catch (err) {
......
/**
* 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 commonBackgroundBlurStyleJsunit() {
describe('commonBackgroundBlurStyleTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/common',
}
try {
router.clear();
let pages = router.getState();
console.info("get common state success " + JSON.stringify(pages));
if (!("common" == pages.name)) {
console.info("get common state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push common page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push common page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("commonBackgroundBlurStyle after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_001
* @tc.name testcommonBackgroundBlurStyle001
* @tc.desic acecommonBackgroundBlurStyleEtsTest001
*/
it('testcommonBackgroundBlurStyle001', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('borderImageText');
console.info("[testcommonBackgroundBlurStyle001] component borderImage strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
let targetValue = {
source: {
angle: 90,
direction: GradientDirection.Left,
colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]]
},
slice: {
top: 10, bottom: 10, left: 10, right: 10
},
width: {
top: "10px", bottom: "10px", left: "10px", right: "10px"
},
repeat: RepeatMode.Stretch,
fill: false
};
expect(obj.$attrs.borderImage).assertEqual(JSON.stringify(targetValue));
console.info("[testcommonBackgroundBlurStyle001] borderImage value :" + JSON.stringify(obj.$attrs.borderImage));
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_002
* @tc.name testcommonBackgroundBlurStyle002
* @tc.desic acecommonBackgroundBlurStyleEtsTest002
*/
it('testcommonBackgroundBlurStyle002', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabIndexText');
console.info("[testcommonBackgroundBlurStyle002] component tabIndex strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.tabIndex).assertEqual(1);
console.info("[testcommonBackgroundBlurStyle002] tabIndex value :" + obj.$attrs.textAlign);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_003
* @tc.name testcommonBackgroundBlurStyle003
* @tc.desic acecommonBackgroundBlurStyleEtsTest003
*/
it('testcommonBackgroundBlurStyle003', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('sepiaText');
console.info("[testcommonBackgroundBlurStyle003] component sepia strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.sepia).assertEqual(1);
console.info("[testcommonBackgroundBlurStyle003] sepia value :" + obj.$attrs.sepia);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_004
* @tc.name testcommonBackgroundBlurStyle004
* @tc.desic acecommonBackgroundBlurStyleEtsTest004
*/
it('testcommonBackgroundBlurStyle004', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('alignRulesText');
console.info("[testcommonBackgroundBlurStyle004] component alignRules strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
let targetValue = {
top: {
anchor: 'target', align: VerticalAlign.Bottom
},
right: {
anchor: "target", align: HorizontalAlign.Center
}
};
expect(obj.$attrs.alignRules).assertEqual(JSON.stringify(targetValue));
console.info("[testcommonBackgroundBlurStyle004] alignRules value :" + JSON.stringify(obj.$attrs.alignRules));
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_005
* @tc.name testcommonBackgroundBlurStyle005
* @tc.desic acecommonBackgroundBlurStyleEtsTest005
*/
it('testcommonBackgroundBlurStyle005', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle005] component backgroundBlurStyle strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$attrs.backgroundBlurStyle).assertEqual("BlurStyle.Thick");
console.info("[testcommonBackgroundBlurStyle005] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle);
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 gaugeColorsJsunit() {
describe('gaugeColorsTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/gauge',
}
try {
router.clear();
let pages = router.getState();
console.info("get gauge state success " + JSON.stringify(pages));
if (!("gauge" == pages.name)) {
console.info("get gauge state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push gauge page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push gauge page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("gaugeColors after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testgaugeColors0001
* @tc.desic acegaugeColorsEtsTest0001
*/
it('testgaugeColors0001', 0, async function (done) {
console.info('gaugeColors testgaugeColors0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Gauge');
console.info("[testgaugeColors0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Gauge');
expect(obj.$attrs.width).assertEqual("200.00vp");
console.info("[testgaugeColors0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testgaugeColors0002
* @tc.desic acegaugeColorsEtsTest0002
*/
it('testgaugeColors0002', 0, async function (done) {
console.info('gaugeColors testgaugeColors0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Gauge');
console.info("[testgaugeColors0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Gauge');
expect(obj.$attrs.height).assertEqual("200.00vp");
console.info("[testgaugeColors0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testgaugeColors0003
* @tc.desic acegaugeColorsEtsTest0003
*/
it('testgaugeColors0003', 0, async function (done) {
console.info('gaugeColors testgaugeColors0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Gauge');
console.info("[testgaugeColors0003] component startAngle strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Gauge');
expect(obj.$attrs.startAngle).assertEqual("210.00");
console.info("[testgaugeColors0003] startAngle value :" + obj.$attrs.startAngle);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testgaugeColors0004
* @tc.desic acegaugeColorsEtsTest0004
*/
it('testgaugeColors0004', 0, async function (done) {
console.info('gaugeColors testgaugeColors0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Gauge');
console.info("[testgaugeColors0004] component endAngle strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Gauge');
expect(obj.$attrs.endAngle).assertEqual("150.00");
console.info("[testgaugeColors0004] endAngle value :" + obj.$attrs.endAngle);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testgaugeColors0005
* @tc.desic acegaugeColorsEtsTest0005
*/
it('testgaugeColors0005', 0, async function (done) {
console.info('gaugeColors testgaugeColors0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Gauge');
console.info("[testgaugeColors0005] component strokeWidth strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Gauge');
expect(obj.$attrs.strokeWidth).assertEqual("20.00vp");
console.info("[testgaugeColors0005] strokeWidth value :" + obj.$attrs.strokeWidth);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testgaugeColors0006
* @tc.desic acegaugeColorsEtsTest0006
*/
it('testgaugeColors0006', 0, async function (done) {
console.info('gaugeColors testgaugeColors0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Gauge');
console.info("[testgaugeColors0006] component colors strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Gauge');
expect(obj.$attrs.colors).assertEqual('["#FF317AF7","#FF5BA854","#FFE08C3A","#FF9C554B","#FFD94838"]');
console.info("[testgaugeColors0006] colors value :" + obj.$attrs.colors);
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 grid_colSpanJsunit() {
describe('grid_colSpanTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/grid_col',
}
try {
router.clear();
let pages = router.getState();
console.info("get grid_col state success " + JSON.stringify(pages));
if (!("grid_col" == pages.name)) {
console.info("get grid_col state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push grid_col page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push grid_col page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("grid_colSpan after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testgrid_colSpan0001
* @tc.desic acegrid_colSpanEtsTest0001
*/
it('testgrid_colSpan0001', 0, async function (done) {
console.info('grid_rowOnBreakpointChange testgrid_colSpan0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('gridContainer');
console.info("[testgrid_colSpan0001] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('GridCol');
expect(obj.$attrs.width).assertEqual("100.00vp");
console.info("[testgrid_colSpan0001] width value :" + obj.$attrs.width);
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 grid_rowOnBreakpointChangeJsunit() {
describe('grid_rowOnBreakpointChangeTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/grid_row',
}
try {
router.clear();
let pages = router.getState();
console.info("get grid_row state success " + JSON.stringify(pages));
if (!("grid_row" == pages.name)) {
console.info("get grid_row state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push grid_row page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push grid_row page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("grid_rowOnBreakpointChange after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_001
* @tc.name testgrid_rowOnBreakpointChange001
* @tc.desic acegrid_rowOnBreakpointChangeEtsTest001
*/
it('testgrid_rowOnBreakpointChange001', 0, async function (done) {
console.info('grid_rowOnBreakpointChange testgrid_rowOnBreakpointChange001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('GridRow');
console.info("[testgrid_rowOnBreakpointChange001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('GridRow');
expect(obj.$attrs.width).assertEqual("100vp");
console.info("[testgrid_rowOnBreakpointChange001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_002
* @tc.name testgrid_rowOnBreakpointChange002
* @tc.desic acegrid_rowOnBreakpointChangeEtsTest002
*/
it('testgrid_rowOnBreakpointChange002', 0, async function (done) {
console.info('grid_rowOnBreakpointChange testgrid_rowOnBreakpointChange002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('GridRow');
console.info("[testgrid_rowOnBreakpointChange002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('GridRow');
expect(obj.$attrs.height).assertEqual("100vp");
console.info("[testgrid_rowOnBreakpointChange002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_003
* @tc.name testgrid_rowOnBreakpointChange003
* @tc.desic acegrid_rowOnBreakpointChangeEtsTest003
*/
it('testgrid_rowOnBreakpointChange003', 0, async function (done) {
console.info('grid_rowOnBreakpointChange testgrid_rowOnBreakpointChange003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('GridRow');
console.info("[testgrid_rowOnBreakpointChange003] component backgroundColor strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('GridRow');
expect(obj.$attrs.backgroundColor).assertEqual("0xFF0000");
console.info("[testgrid_rowOnBreakpointChange003] backgroundColor value :" + obj.$attrs.backgroundColor);
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 sideBarShowSideBarJsunit() {
describe('sideBarShowSideBarTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/sideBar',
}
try {
router.clear();
let pages = router.getState();
console.info("get sideBar state success " + JSON.stringify(pages));
if (!("sideBar" == pages.name)) {
console.info("get sideBar state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push sideBar page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push sideBar page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("sideBarShowSideBar after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testsideBarShowSideBar0001
* @tc.desic acesideBarShowSideBarEtsTest0001
*/
it('testsideBarShowSideBar0001', 0, async function (done) {
console.info('sideBarShowSideBar testsideBarShowSideBar0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('SideBarContainer');
console.info("[testsideBarShowSideBar0001] component showSideBar strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('SideBarContainer');
expect(obj.$attrs.showSideBar).assertEqual("true");
console.info("[testsideBarShowSideBar0001] showSideBar value :" + obj.$attrs.showSideBar);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testsideBarShowSideBar0002
* @tc.desic acesideBarShowSideBarEtsTest0002
*/
it('testsideBarShowSideBar0002', 0, async function (done) {
console.info('sideBarShowSideBar testsideBarShowSideBar0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('SideBarContainer');
console.info("[testsideBarShowSideBar0002] component autoHide strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('SideBarContainer');
expect(obj.$attrs.autoHide).assertEqual(undefined);
console.info("[testsideBarShowSideBar0002] autoHide value :" + obj.$attrs.autoHide);
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 stackAlignContentJsunit() {
describe('stackAlignContentTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/stack',
}
try {
router.clear();
let pages = router.getState();
console.info("get stack state success " + JSON.stringify(pages));
if (!("stack" == pages.name)) {
console.info("get stack state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push stack page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push stack page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("stackAlignContent after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name teststackAlignContent0001
* @tc.desic acestackAlignContentEtsTest0001
*/
it('teststackAlignContent0001', 0, async function (done) {
console.info('stackAlignContent teststackAlignContent0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Stack');
console.info("[teststackAlignContent0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Stack');
expect(obj.$attrs.width).assertEqual("100.00%");
console.info("[teststackAlignContent0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name teststackAlignContent0002
* @tc.desic acestackAlignContentEtsTest0002
*/
it('teststackAlignContent0002', 0, async function (done) {
console.info('stackAlignContent teststackAlignContent0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('Stack');
console.info("[teststackAlignContent0002] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Stack');
expect(obj.$attrs.height).assertEqual("150.00vp");
console.info("[teststackAlignContent0002] width value :" + obj.$attrs.width);
done();
});
})
}
...@@ -198,5 +198,29 @@ export default function textMinFontSizeJsunit() { ...@@ -198,5 +198,29 @@ export default function textMinFontSizeJsunit() {
console.info("[testtextMinFontSize0010] textAlign value :" + obj.$attrs.textAlign); console.info("[testtextMinFontSize0010] textAlign value :" + obj.$attrs.textAlign);
done(); done();
}); });
it('testtextMinFontSize0011', 0, async function (done) {
console.info('textMinFontSize testtextMinFontSize0011 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('minFontSizeText');
console.info("[testtextMinFontSize0011] component minFontSize strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.minFontSize).assertEqual(undefined);
console.info("[testtextMinFontSize0011] minFontSize value :" + obj.$attrs.minFontSize);
done();
});
it('testtextCopyOptionText0001', 0, async function (done) {
console.info('textMinFontSize testtextCopyOptionText0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('copyOptionText');
console.info("[testtextCopyOptionText0001] component copyOption strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.copyOption).assertEqual(undefined);
console.info("[testtextCopyOptionText0001] copyOption value :" + obj.$attrs.copyOption);
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'
...@@ -197,5 +198,30 @@ export default function videoOnFullscreenChangeJsunit() { ...@@ -197,5 +198,30 @@ export default function videoOnFullscreenChangeJsunit() {
console.info("[testvideoOnFullscreenChange0010] textAlign value :" + obj.$attrs.textAlign); console.info("[testvideoOnFullscreenChange0010] textAlign value :" + obj.$attrs.textAlign);
done(); done();
}); });
it('testvideoOnFullscreenChange0011', 0, async function (done) {
console.info('videoOnFullscreenChange testvideoOnFullscreenChange0011 START');
var innerEvent = {
eventId: 101,
priority: events_emitter.EventPriority.LOW
}
var callback = (eventData) => {
try{
console.info("callback success" );
console.info("eventData.data.result result is: " + eventData.data.result);
expect(eventData.data.result).assertEqual("success");
console.info("video_101 end: ");
}catch(err){
console.info("video_101 on events_emitter err : " + JSON.stringify(err));
}
done();
}
try {
events_emitter.on(innerEvent, callback);
console.info("video_101 click result is: " + JSON.stringify(sendEventByKey('fullScreen', 10, "")));
} catch (err) {
console.info("video_101 on events_emitter err : " + JSON.stringify(err));
}
});
}) })
} }
/**
* 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 webGetTitleJsunit() {
describe('webGetTitleTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/web',
}
try {
router.clear();
let pages = router.getState();
console.info("get web state success " + JSON.stringify(pages));
if (!("web" == pages.name)) {
console.info("get web state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push web page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push web page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("webGetTitle after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testwebGetTitle0002
* @tc.desic acewebGetTitleEtsTest0002
*/
it('testwebGetTitle0001', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0001] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.height).assertEqual("500.00vp");
console.info("[testwebGetTitle0001] height value :" + obj.$attrs.height);
done();
});
it('testwebGetTitle0002', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0002] component fileAccess strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.fileAccess).assertEqual(undefined);
console.info("[testwebGetTitle0002] fileAccess value :" + obj.$attrs.fileAccess);
done();
});
it('testwebGetTitle0003', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0003] component javaScriptAccess strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.javaScriptAccess).assertEqual(undefined);
console.info("[testwebGetTitle0003] javaScriptAccess value :" + obj.$attrs.javaScriptAccess);
done();
});
it('testwebGetTitle0004', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0004] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.padding).assertEqual("20.00vp");
console.info("[testwebGetTitle0004] padding value :" + obj.$attrs.padding);
done();
});
it('testwebGetTitle0005', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0005] component blur strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.blur).assertEqual(2);
console.info("[testwebGetTitle0005] blur value :" + obj.$attrs.blur);
done();
});
it('testwebGetTitle0006', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0006] component userAgent strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.userAgent).assertEqual(undefined);
console.info("[testwebGetTitle0006] userAgent value :" + obj.$attrs.userAgent);
done();
});
it('testwebGetTitle0007', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0007 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0007] component fileFromUrlAccess strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.fileFromUrlAccess).assertEqual(undefined);
console.info("[testwebGetTitle0007] fileFromUrlAccess value :" + obj.$attrs.fileFromUrlAccess);
done();
});
it('testwebGetTitle0008', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0008 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0008] component initialScale strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.initialScale).assertEqual(undefined);
console.info("[testwebGetTitle0008] initialScale value :" + obj.$attrs.initialScale);
done();
});
it('testwebGetTitle0009', 0, async function (done) {
console.info('webGetTitle testwebGetTitle0009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('getTitleText');
console.info("[testwebGetTitle0009] component webDebuggingAccess strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Web');
expect(obj.$attrs.webDebuggingAccess).assertEqual(undefined);
console.info("[testwebGetTitle0009] webDebuggingAccess value :" + obj.$attrs.webDebuggingAccess);
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册