提交 3a088f7f 编写于 作者: H huangdong57

update WholeCompletion

Signed-off-by: Nhuangdong57 <huangdong57@huawei.com>
上级 dffe1b26
......@@ -17,6 +17,7 @@ group("arkui") {
"ace_ets_component:ActsAceEtsComponentTest",
"ace_ets_component_apilack:ActsAceEtsApiLackTest",
"ace_ets_component_attrlack:ActsAceEtsAttrLackTest",
"ace_ets_component_completion:componentCompletionTest",
"ace_ets_component_five:ActsAceEtsComponentFiveTest",
"ace_ets_component_four:ActsAceEtsComponentFourTest",
"ace_ets_component_three:ActsAceEtsComponentThreeTest",
......
......@@ -14,6 +14,6 @@
group("componentCompletionTest") {
testonly = true
if (is_standard_system) {
deps = [ "ace_ets_component_sidebarcontainertest:ActsSidebarTypeTest" ]
deps = [ "ace_ets_component_wholeCompletion:ActsAceEtsWholeCompletionTest" ]
}
}
{
"app": {
"bundleName": "com.example.wholeCompletion",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name",
"distributedNotificationEnabled": true,
"keepAlive": true,
"singleUser": true,
"minAPIVersion": 10,
"targetAPIVersion": 10,
"car": {
"apiCompatibleVersion": 10,
"singleUser": false
}
}
}
\ No newline at end of file
{
"string":[
{
"name":"app_name",
"value":"MyApplication"
}
]
}
\ No newline at end of file
# Copyright (c) 2023 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceEtsWholeCompletionTest") {
hap_profile = "src/main/module.json"
js_build_mode = "debug"
deps = [
":ace_ets_component_wholeCompletion_js_assets",
":ace_ets_component_wholeCompletion_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAceEtsWholeCompletionTest"
part_name = "ace_engine"
subsystem_name = "arkui"
}
ohos_app_scope("ace_ets_component_wholeCompletion_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("ace_ets_component_wholeCompletion_js_assets") {
source_dir = "src/main/ets"
}
ohos_resources("ace_ets_component_wholeCompletion_resources") {
sources = [ "src/main/resources" ]
deps = [ ":ace_ets_component_wholeCompletion_profile" ]
hap_profile = "src/main/module.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.wholeCompletion",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 240000
},
"kits": [{
"test-file-name": [
"ActsAceEtsWholeCompletionTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602"
]
}
]
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import Ability from '@ohos.app.ability.UIAbility'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import testsuite from '../test/List.test'
import Window from '@ohos.window'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? '');
}
onDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: Window.WindowStage) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('TestAbility/pages/Index', (err, data) => {
if (err.code) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR);
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s',
JSON.stringify(data) ?? '');
});
let windowClass = null;
windowStage.getMainWindow((err, data) => {
if (err.code) {
console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err));
return;
}
windowClass = data;
globalThis.uiContent = windowClass.getUIContext();
console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data));
});
}
onWindowStageDestroy() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../test/List.test'
@Entry
@Component
struct Index {
aboutToAppear() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
@State message: string = 'Stage XtsTest'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 Curves from '@ohos.curves'
@Entry
@Component
struct animationCurve {
@State widthSize: number = 50
@State heightSize: number = 50
onFinish() {}
interpolate(fraction) {
return fraction;
}
build() {
Column() {
Text()
.key("curvesText")
.margin({top:100})
.width(this.widthSize)
.height(this.heightSize)
.backgroundColor(Color.Red)
.onClick(()=> {
globalThis.fraction = Curves.customCurve(this.interpolate).interpolate(0.1)
this.widthSize = 2*this.widthSize;
this.heightSize = 2*this.heightSize;
})
.animation({ duration: 2000 , curve: Curves.customCurve(this.interpolate) ,onFinish:this.onFinish })
}.width("100%").height("100%")
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//@ts-nocheck
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct bindPopupOffset {
@State handlePopup: boolean = false
@State handlePopup01: boolean = false
@State handlePopup02: boolean = false
@State handlePopup03: boolean = false
@State handlePopup04: boolean = false
@State customPopup: boolean = false
@State customPopup01: boolean = false
@State customPopup02: boolean = false
@State customPopup03: boolean = false
@State customPopup04: boolean = false
@State offset: any = { x: 10, y:10 }
@State offset10: any = { x:-10, y:-10}
@State offset00: any = { x: 0, y:0 }
@State offset050: any = { x: 0, y:50 }
@State offsetnull: any = null
@Builder popupBuilder() {
Row({ space: 2 }) {
Text('Custom Popup').fontSize(12).key('text')
}.width(100).height(50).backgroundColor(Color.White)
}
build(){
Scroll(){
Flex({ direction: FlexDirection.Column }) {
Button('PopupOptions')
.width(200)
.key('PopupOptions')
.margin({top:100})
.onClick(() => {
this.handlePopup = !this.handlePopup
try {
var backData = {
data: {
"offset": this.offset,
}
}
var backEvent = {
eventId: 12065,
priority: events_emitter.EventPriority.LOW
}
console.info("PopupOptions start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("PopupOptions emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.handlePopup, {
message: 'This is a popup with PopupOptions',
placementOnTop: true,
showInSubWindow:false,
onStateChange: (e) => {
console.info(JSON.stringify(e.isVisible))
if (!e.isVisible) {
this.handlePopup = false
}
},
offset: this.offset
})
Button('PopupOptions00')
.width(200)
.key('PopupOptions00')
.margin({top:100})
.onClick(() => {
this.handlePopup01 = !this.handlePopup01
try {
var backData = {
data: {
"offset": this.offset00,
}
}
var backEvent = {
eventId: 12067,
priority: events_emitter.EventPriority.LOW
}
console.info("PopupOptions00 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("PopupOptions00 emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.handlePopup01, {
message: 'This is a popup with PopupOptions',
placementOnTop: true,
showInSubWindow:false,
onStateChange: (e) => {
console.info(JSON.stringify(e.isVisible))
if (!e.isVisible) {
this.handlePopup01 = false
}
},
offset: this.offset00
})
Button('PopupOptions050')
.width(200)
.key('PopupOptions050')
.margin({top:100})
.onClick(() => {
this.handlePopup02 = !this.handlePopup02
try {
var backData = {
data: {
"offset": this.offset050,
}
}
var backEvent = {
eventId: 12068,
priority: events_emitter.EventPriority.LOW
}
console.info("PopupOptions050 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("PopupOptions050 emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.handlePopup01, {
message: 'This is a popup with PopupOptions',
placementOnTop: true,
showInSubWindow:false,
onStateChange: (e) => {
console.info(JSON.stringify(e.isVisible))
if (!e.isVisible) {
this.handlePopup02 = false
}
},
offset: this.offset050
})
Button('PopupOptionsnull')
.width(200)
.key('PopupOptionsnull')
.margin({top:100})
.onClick(() => {
this.handlePopup03 = !this.handlePopup03
try {
var backData = {
data: {
"offset": this.offsetnull,
}
}
var backEvent = {
eventId: 12069,
priority: events_emitter.EventPriority.LOW
}
console.info("PopupOptionsnull start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("PopupOptionsnull emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.handlePopup03, {
message: 'This is a popup with PopupOptions',
placementOnTop: true,
showInSubWindow:false,
onStateChange: (e) => {
console.info(JSON.stringify(e.isVisible))
if (!e.isVisible) {
this.handlePopup03 = false
}
},
offset: this.offsetnull
})
Button('PopupOptions10')
.width(200)
.key('PopupOptions10')
.margin({top:100})
.onClick(() => {
this.handlePopup04 = !this.handlePopup04
try {
var backData = {
data: {
"offset": this.offset10,
}
}
var backEvent = {
eventId: 12070,
priority: events_emitter.EventPriority.LOW
}
console.info("PopupOptions10 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("PopupOptions10 emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.handlePopup04, {
message: 'This is a popup with PopupOptions',
placementOnTop: true,
showInSubWindow:false,
onStateChange: (e) => {
console.info(JSON.stringify(e.isVisible))
if (!e.isVisible) {
this.handlePopup04 = false
}
},
offset: this.offset10
})
Button('customPopup')
.key('customPopup')
.margin({top:100})
.onClick(() => {
this.customPopup = !this.customPopup
try {
var backData = {
data: {
"offset": this.offset,
}
}
var backEvent = {
eventId: 12066,
priority: events_emitter.EventPriority.LOW
}
console.info("customPopup start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("customPopup emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.customPopup, {
builder: this.popupBuilder,
placement: Placement.Top,
mask: {color:'0x33000000'},
popupColor: Color.Yellow,
enableArrow: true,
showInSubWindow: false,
onStateChange: (e) => {
if (!e.isVisible) {
this.customPopup = false
}
},
offset: this.offset
})
Button('customPopup10')
.key('customPopup10')
.margin({top:100})
.onClick(() => {
this.customPopup01 = !this.customPopup01
try {
var backData = {
data: {
"offset": this.offset10,
}
}
var backEvent = {
eventId: 12071,
priority: events_emitter.EventPriority.LOW
}
console.info("customPopup10 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("customPopup10 emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.customPopup01, {
builder: this.popupBuilder,
placement: Placement.Top,
mask: {color:'0x33000000'},
popupColor: Color.Yellow,
enableArrow: true,
showInSubWindow: false,
onStateChange: (e) => {
if (!e.isVisible) {
this.customPopup01 = false
}
},
offset: this.offset10
})
Button('customPopup00')
.key('customPopup00')
.margin({top:100})
.onClick(() => {
this.customPopup02 = !this.customPopup02
try {
var backData = {
data: {
"offset": this.offset00,
}
}
var backEvent = {
eventId: 12072,
priority: events_emitter.EventPriority.LOW
}
console.info("customPopup00 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("customPopup00 emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.customPopup02, {
builder: this.popupBuilder,
placement: Placement.Top,
mask: {color:'0x33000000'},
popupColor: Color.Yellow,
enableArrow: true,
showInSubWindow: false,
onStateChange: (e) => {
if (!e.isVisible) {
this.customPopup02 = false
}
},
offset: this.offset00
})
Button('customPopup050')
.key('customPopup050')
.margin({top:100})
.onClick(() => {
this.customPopup03 = !this.customPopup03
try {
var backData = {
data: {
"offset": this.offset050,
}
}
var backEvent = {
eventId: 12073,
priority: events_emitter.EventPriority.LOW
}
console.info("customPopup050 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("customPopup050 emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.customPopup03, {
builder: this.popupBuilder,
placement: Placement.Top,
mask: {color:'0x33000000'},
popupColor: Color.Yellow,
enableArrow: true,
showInSubWindow: false,
onStateChange: (e) => {
if (!e.isVisible) {
this.customPopup03 = false
}
},
offset: this.offset050
})
Button('customPopupnull')
.key('customPopupnull')
.margin({top:100})
.onClick(() => {
this.customPopup04 = !this.customPopup04
try {
var backData = {
data: {
"offset": this.offsetnull,
}
}
var backEvent = {
eventId: 12074,
priority: events_emitter.EventPriority.LOW
}
console.info("customPopupnull start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("customPopupnull emit action state err: " + JSON.stringify(err.message))
}
})
.bindPopup(this.customPopup04, {
builder: this.popupBuilder,
placement: Placement.Top,
mask: {color:'0x33000000'},
popupColor: Color.Yellow,
enableArrow: true,
showInSubWindow: false,
onStateChange: (e) => {
if (!e.isVisible) {
this.customPopup04 = false
}
},
offset: this.offsetnull
})
}.width('100%').padding({ top: 5 })
}.width('100%').height("85%")
}
}
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct hover {
@State message: string = 'Hello World'
build() {
Column({ space: 5 }) {
Flex() {
Button("button一")
.width(200)
.height(100)
.backgroundColor(0xAFEEF)
.onHover((isHover: boolean, event: HoverEvent) => {
console.log('button 一' + isHover + '')
})
Button("button二")
.width(100)
.height(50)
.backgroundColor(0xAFEE)
.margin({ top: 25, left: -150 })
.onHover((isHover: boolean, event: HoverEvent) => {
event.stopPropagation()
console.log('button 二' + isHover + '')
}).key("ArkUX_Hover_stoppropagation_0100")
}
.padding(10)
Flex() {
Button("button一")
.width(100)
.height(50)
.backgroundColor(0xAFEEF)
.margin({ top: 25, left: 40 })
.onHover((isHover: boolean, event: HoverEvent) => {
console.log('button 一' + isHover + '')
})
Button("button二")
.width(200)
.height(100)
.backgroundColor(0xAFEE)
.margin({ top: 20, left: -140 })
.onHover((isHover: boolean, event: HoverEvent) => {
event.stopPropagation()
console.log('button 二' + isHover + '')
})
}
.padding(10)
Flex() {
Button("button一")
.width(200)
.height(100)
.backgroundColor(0xAFEEF)
.onHover((isHover: boolean, event: HoverEvent) => {
console.log('button 一' + isHover + '')
})
Button("button二")
.width(100)
.height(50)
.backgroundColor(0xAFEE)
.margin({ top: 25, left: -100 })
.onHover((isHover: boolean, event: HoverEvent) => {
event.stopPropagation()
console.log('button 二' + isHover + '')
})
}
.padding(10)
Flex() {
Button("button一")
.width(200)
.height(100)
.backgroundColor(0xAFEEF)
.onHover((isHover: boolean, event: HoverEvent) => {
console.log('button 一' + isHover + '')
})
Button("button二")
.width(100)
.height(50)
.backgroundColor(0xAFEE)
.margin({ top: 20, left: -80 })
.onHover((isHover: boolean, event: HoverEvent) => {
event.stopPropagation()
console.log('button 二' + isHover + '')
})
}
.padding(10)
}
.width('100%')
.margin({ top: 10 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct imageObscuredTest {
private scroller: Scroller = new Scroller()
build() {
Column() {
Stack({ alignContent: Alignment.End }) {
Scroll(this.scroller) {
Flex({ direction: FlexDirection.Column }) {
Row() {
Image($r('app.media.icon')).width('400px').height('400px')
.obscured([ObscuredReasons.PLACEHOLDER]).borderRadius('20vp')
.key('ArkUX_Redacted_Image_0150')
}.margin({bottom: 50})
Row() {
Image($r('app.media.icon'))
.obscured(null)
.key('ArkUX_Redacted_Image_0160')
}.margin({bottom: 50})
Row() {
Image($r('app.media.icon')).width('700px').height('200px')
.obscured([ObscuredReasons.PLACEHOLDER]).borderRadius(null)
.key('ArkUX_Redacted_Image_0170')
}.margin({bottom: 50})
Row() {
Image($r('app.media.play')).width(30).height(40)
.obscured([ObscuredReasons.PLACEHOLDER]).borderRadius(null)
.key('ArkUX_Redacted_Image_0180')
}.margin({bottom: 50})
Row() {
Image($r('app.media.play')).width(30).height(40)
.obscured([ObscuredReasons.PLACEHOLDER])
.borderRadius('20vp')
.key('ArkUX_Redacted_Image_0190')
}.margin({bottom: 50})
}.margin({ left: 52 })
}
.scrollBar(BarState.Off)
.scrollable(ScrollDirection.Vertical)
ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) {
Text()
.width(30)
.height(100)
.borderRadius(10)
.backgroundColor('#C0C0C0')
}.width(30).backgroundColor('#ededed')
}
}
}
}
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct pushUrl {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//@ts-nocheck
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct stageActionSheet {
build() {
Row() {
Column() {
Text("showActionSheet1")
.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("showActionSheet1")
.onClick(() => {
try {
globalThis.uiContent.showActionSheet({
title: 'ActionSheet title',
message: 'message',
autoCancel: true,
confirm: {
value: 'Confirm button',
action: () => {
console.log('Get Alert Dialog handled')
}
},
cancel: () => {
console.log('actionSheet canceled')
},
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -10 },
sheets: [
{
title: 'apples',
action: () => {
console.log('apples')
}
},
{
title: 'bananas',
action: () => {
console.log('bananas')
}
},
{
title: 'pears',
action: () => {
console.log('pears')
}
}
]
})
var backData = {
data: {
"STATUS": true
}
}
let backEvent = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
console.info("showDialog start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (error) {
console.error("showToast emit action state err:" + JSON.stringify(error.message));
};
})
Text("showActionSheet2")
.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("showActionSheet2")
.onClick(() => {
try {
globalThis.uiContent.showActionSheet({
title: 'ActionSheet title',
message: 'message',
autoCancel: true,
confirm: {
value: 'Confirm button',
action: () => {
console.log('Get Alert Dialog handled')
}
},
cancel: () => {
console.log('actionSheet canceled')
},
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -10 },
sheets: [
{
title: 'apples',
action: () => {
console.log('apples')
}
},
{
title: 'bananas',
action: () => {
console.log('bananas')
}
},
{
title: 'pears',
action: () => {
console.log('pears')
}
}
]
})
var backData1 = {
data: {
"STATUS": 10
}
}
let backEvent1 = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent1, backData1)
} catch (error) {
};
})
Text("showActionSheet3")
.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("showActionSheet3")
.onClick(() => {
try {
globalThis.uiContent.showActionSheet({
title: 'ActionSheet title',
message: 'message',
autoCancel: true,
confirm: {
value: 'Confirm button',
action: () => {
console.log('Get Alert Dialog handled')
}
},
cancel: () => {
console.log('actionSheet canceled')
},
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -10 },
sheets: [
{
title: 'apples',
action: () => {
console.log('apples')
}
},
{
title: 'bananas',
action: () => {
console.log('bananas')
}
},
{
title: 'pears',
action: () => {
console.log('pears')
}
}
]
})
var backData2 = {
data: {
"STATUS": "STATUS"
}
}
let backEvent2 = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent2, backData2)
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
}
.height('100%')
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct stageAlertDialog {
build() {
Row() {
Column() {
Text("AlertDialog1")
.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("AlertDialog1")
.onClick(() => {
try {
globalThis.uiContent.showAlertDialog(
{
title: 'title',
message: 'text',
autoCancel: true,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
gridCount: 3,
confirm: {
value: 'button',
action: () => {
console.info('Button-clicking callback')
}
},
cancel: () => {
console.info('Closed callbacks')
}
}
)
var backData = {
data: {
"STATUS": true
}
}
let backEvent = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
console.info("showDialog start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (error) {
console.error("showToast emit action state err:" + JSON.stringify(error.message));
};
})
Text("AlertDialog2")
.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("AlertDialog2")
.onClick(() => {
try {
globalThis.uiContent.showAlertDialog(
{
title: 'title',
message: 'text',
autoCancel: true,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
gridCount: 3,
confirm: {
value: 'button',
action: () => {
console.info('Button-clicking callback')
}
},
cancel: () => {
console.info('Closed callbacks')
}
}
)
var backData1 = {
data: {
"STATUS": 10
}
}
let backEvent1 = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent1, backData1)
} catch (error) {
};
})
Text("AlertDialog3")
.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("AlertDialog3")
.onClick(() => {
try {
globalThis.uiContent.showAlertDialog(
{
title: 'title',
message: 'text',
autoCancel: true,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
gridCount: 3,
confirm: {
value: 'button',
action: () => {
console.info('Button-clicking callback')
}
},
cancel: () => {
console.info('Closed callbacks')
}
}
)
var backData2 = {
data: {
"STATUS": "STATUS"
}
}
let backEvent2 = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent2, backData2)
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
}
.height('100%')
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct stageDatePickerDialog {
selectedDate: Date = new Date("2010-1-1")
build() {
Row() {
Column() {
Text("DatePickerDialog1")
.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("DatePickerDialog1")
.onClick(() => {
try {
globalThis.uiContent.showDatePickerDialog({
start: new Date("2000-1-1"),
end: new Date("2100-12-31"),
selected: this.selectedDate,
onAccept: (value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info("DatePickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("DatePickerDialog:onCancel()")
},
onChange: (value: DatePickerResult) => {
console.info("DatePickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData = {
data: {
"STATUS": true
}
}
let backEvent = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
console.info("showDialog start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (error) {
console.error("showToast emit action state err:" + JSON.stringify(error.message));
};
})
Text("DatePickerDialog2")
.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("DatePickerDialog2")
.onClick(() => {
try {
globalThis.uiContent.showDatePickerDialog({
start: new Date("2000-1-1"),
end: new Date("2100-12-31"),
selected: this.selectedDate,
onAccept: (value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info("DatePickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("DatePickerDialog:onCancel()")
},
onChange: (value: DatePickerResult) => {
console.info("DatePickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData1 = {
data: {
"STATUS": 10
}
}
let backEvent1 = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent1, backData1)
} catch (error) {
};
})
Text("DatePickerDialog3")
.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("DatePickerDialog3")
.onClick(() => {
try {
globalThis.uiContent.showDatePickerDialog({
start: new Date("2000-1-1"),
end: new Date("2100-12-31"),
selected: this.selectedDate,
onAccept: (value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info("DatePickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("DatePickerDialog:onCancel()")
},
onChange: (value: DatePickerResult) => {
console.info("DatePickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData2 = {
data: {
"STATUS": "STATUS"
}
}
let backEvent2 = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent2, backData2)
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
}
.height('100%')
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct StageFont {
@State message: string = 'Hello World'
@State text: string = ''
controller: TextAreaController = new TextAreaController()
aboutToAppear(){
let fontRegister = globalThis.uiContent.getFont();
console.info(fontRegister);
}
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Button('按钮Button字体')
.labelStyle({
font: { family: 'fontCustom' }
})
.key("button")
Text('文本Text字体')
.fontSize(24)
.fontFamily('fontCustom')
.key("text")
TextArea({
text: this.text,
placeholder: 'TextArea字体',
controller: this.controller
})
.placeholderFont({ size: 24, weight: 400 })
.fontSize(24)
.fontFamily('fontCustom')
.onChange((value: string) => {
this.text = value
})
.key('textArea')
TextInput({ placeholder: 'TextInput字体' })
.fontFamily('fontCustom')
.fontSize(24)
.key('textInput')
Text() {
Span('TextSpan字体')
.fontFamily('fontCustom')
.fontSize(24)
.key('textSpan')
}
}.width("100%").height("100%")
}
}
/*
* Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct stageMediaquery {
@State color: string = '#000'
@State text: string = 'Test'
listener = globalThis.uiContent.getMediaquery().matchMediaSync('(orientation: landscape)')
aboutToAppear() {
this.listener.on('change', (mediaQueryResult) => {
if (mediaQueryResult.matches) {
this.color = '#FFD700'
this.text = 'Landscape'
} else {
this.color = '#DB7093'
this.text = 'Portrait'
}
})
}
aboutToDisappear() {
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("mediaQuery-Off")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("offText")
.onClick(() => {
this.listener.off('change', (mediaQueryResult) => {
console.log(JSON.stringify(mediaQueryResult))
var result=true
try {
var backData = {
data: {
"STATUS": result
}
}
let backEvent = {
eventId: 60218,
priority: events_emitter.EventPriority.LOW
}
console.info("onSelect start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onSelect emit action state err: " + JSON.stringify(err.message))
}
})
})
Text("mediaQuery-MatchMediaSync")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("matchMediaSyncText")
.onClick(() => {
console.log('mediaQuery-MatchMediaSync: ' + JSON.stringify(this.listener))
var result=(this.listener!=null)
try {
var backData = {
data: {
"STATUS": result
}
}
let backEvent = {
eventId: 60219,
priority: events_emitter.EventPriority.LOW
}
console.info("onSelect start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("onSelect emit action state err: " + JSON.stringify(err.message))
}
})
Text(this.text)
.fontSize(50)
.fontColor(this.color)
}.width("100%").height("100%")
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct stagePrompt {
build() {
Row() {
Column() {
Text("promptAction-showToast")
.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("showToastText")
.onClick(() => {
try {
globalThis.uiContent.getPromptAction().showToast({
message: 'Message Info',
duration: 2000,
});
var backData = {
data: {
"STATUS": true
}
}
let backEvent = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
console.info("showDialog start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (error) {
console.error("showToast emit action state err:" + JSON.stringify(error.message));
};
})
Text("promptAction-showDialog")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("showDialogText")
.onClick(() => {
try {
globalThis.uiContent.getPromptAction().showDialog({
title: 'Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000',
},
{
text: 'button2',
color: '#000000',
}
],
})
.then(data => {
console.info('showDialog success, click button: ' + data.index);
})
.catch(err => {
console.info('showDialog error: ' + err);
})
var backData1 = {
data: {
"STATUS": true
}
}
let backEvent1 = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent1, backData1)
} catch (error) {
console.error("showDialog emit action state err:" + JSON.stringify(error.message));
};
})
Text("promptAction-showActionMenu")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("showActionMenuText")
.onClick(() => {
try {
globalThis.uiContent.getPromptAction().showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
})
.then(data => {
console.info('showActionMenu success, click button: ' + data.index);
})
.catch(err => {
console.info('showActionMenu error: ' + err);
})
var backData2 = {
data: {
"STATUS": true
}
}
let backEvent2 = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent2, backData2)
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
Text("promptAction-showDialogTwo")
.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("showDialogTextTwo")
.onClick(() => {
try {
globalThis.uiContent.getPromptAction().showDialog({
title: 'showDialog Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000',
},
{
text: 'button2',
color: '#000000',
}
]
}, (err, data) => {
if (err) {
console.info('showDialog err: ' + err);
return;
}
console.info('showDialog success callback, click button: ' + data.index);
});
var backData3 = {
data: {
"STATUS": true
}
}
let backEvent3 = {
eventId: 60223,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent3, backData3)
} catch (error) {
console.error("showDialog emit action state err:" + JSON.stringify(error.message));
};
})
Text("promptAction-showActionMenuTwo")
.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("showActionMenuTextTwo")
.onClick(() => {
try {
globalThis.uiContent.getPromptAction().showActionMenu({
title: 'Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
}, (err, data) => {
if (err) {
console.info('showActionMenu err: ' + err);
return;
}
console.info('showActionMenu success callback, click button: ' + data.index);
})
var backData4 = {
data: {
"STATUS": true
}
}
let backEvent4 = {
eventId: 60224,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent4, backData4)
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
}
.height('100%')
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct stageRouter {
private TAG: string = '[AnimatorTest]'
private backAnimator: any = undefined
private flag: boolean = false
@State wid: number = 100
@State hei: number = 100
build(){
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){
Button('router-pushUrl')
.width(100)
.height(70)
.fontSize(30)
.fontColor(Color.Black)
.onClick(() => {
globalThis.uiContent.getRouter().pushUrl({
url: 'pages/Animator',
params: {
data1: 'message',
data2: {
data3: [123, 456, 789]
}
}
})
})
.key("routerPushUrl")
}.width("100%").height("100%")
}
}
/*
* Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct stageTextPickerDialog {
private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4', 'banana5']
build() {
Row() {
Column() {
Text("TextPickerDialog1")
.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("TextPickerDialog1")
.onClick(() => {
try {
globalThis.uiContent.showTextPickerDialog({
range: this.fruits,
onAccept: (value: TextPickerResult) => {
console.info("TextPickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("TextPickerDialog:onCancel()")
},
onChange: (value: TextPickerResult) => {
console.info("TextPickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData = {
data: {
"STATUS": true
}
}
let backEvent = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
console.info("showDialog start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (error) {
console.error("showToast emit action state err:" + JSON.stringify(error.message));
};
})
Text("TextPickerDialog2")
.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("TextPickerDialog2")
.onClick(() => {
try {
globalThis.uiContent.showTextPickerDialog({
range: this.fruits,
onAccept: (value: TextPickerResult) => {
console.info("TextPickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("TextPickerDialog:onCancel()")
},
onChange: (value: TextPickerResult) => {
console.info("TextPickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData1 = {
data: {
"STATUS": 10
}
}
let backEvent1 = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent1, backData1)
} catch (error) {
};
})
Text("TextPickerDialog3")
.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("TextPickerDialog3")
.onClick(() => {
try {
globalThis.uiContent.showTextPickerDialog({
range: this.fruits,
onAccept: (value: TextPickerResult) => {
console.info("TextPickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("TextPickerDialog:onCancel()")
},
onChange: (value: TextPickerResult) => {
console.info("TextPickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData2 = {
data: {
"STATUS": "STATUS"
}
}
let backEvent2 = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent2, backData2)
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
}
.height('100%')
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct stageTimePickerDialog {
private selectTime: Date = new Date('2020-12-25T08:30:00')
build() {
Row() {
Column() {
Text("TimePickerDialog1")
.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("TimePickerDialog1")
.onClick(() => {
try {
globalThis.uiContent.showTimePickerDialog({
selected: this.selectTime,
onAccept: (value: TimePickerResult) => {
this.selectTime.setHours(value.hour, value.minute)
console.info("TimePickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("TimePickerDialog:onCancel()")
},
onChange: (value: TimePickerResult) => {
console.info("TimePickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData = {
data: {
"STATUS": true
}
}
let backEvent = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
console.info("showDialog start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (error) {
console.error("showToast emit action state err:" + JSON.stringify(error.message));
};
})
Text("TimePickerDialog2")
.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("TimePickerDialog2")
.onClick(() => {
try {
globalThis.uiContent.showTimePickerDialog({
selected: this.selectTime,
onAccept: (value: TimePickerResult) => {
this.selectTime.setHours(value.hour, value.minute)
console.info("TimePickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("TimePickerDialog:onCancel()")
},
onChange: (value: TimePickerResult) => {
console.info("TimePickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData1 = {
data: {
"STATUS": 10
}
}
let backEvent1 = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent1, backData1)
} catch (error) {
};
})
Text("TimePickerDialog3")
.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("TimePickerDialog3")
.onClick(() => {
try {
globalThis.uiContent.showTimePickerDialog({
selected: this.selectTime,
onAccept: (value: TimePickerResult) => {
this.selectTime.setHours(value.hour, value.minute)
console.info("TimePickerDialog:onAccept()" + JSON.stringify(value))
},
onCancel: () => {
console.info("TimePickerDialog:onCancel()")
},
onChange: (value: TimePickerResult) => {
console.info("TimePickerDialog:onChange()" + JSON.stringify(value))
}
})
var backData2 = {
data: {
"STATUS": "STATUS"
}
}
let backEvent2 = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
console.info("showActionMenu start to emit action state")
events_emitter.emit(backEvent2, backData2)
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
}
.height('100%')
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
private scroller: Scroller = new Scroller()
@State message: string = 'Hello World'
build() {
Column() {
Stack({ alignContent: Alignment.End }) {
Scroll(this.scroller) {
Flex({ direction: FlexDirection.Column }) {
Row() {
Text(this.message)
.fontSize(30)
.fontColor("#FF0000FF")
.obscured([ObscuredReasons.PLACEHOLDER])
.textAlign(TextAlign.Start)
.baselineOffset(30)
.key('ArkUX_Redacted_Text_0090')
}.margin({bottom: 50})
Row() {
Text(this.message)
.fontSize(10)
.fontColor("#FF0000FE")
.obscured(null)
.textAlign(null)
.baselineOffset(null)
.key('ArkUX_Redacted_Text_0100')
}.margin({bottom: 50})
Row() {
Text(this.message)
.fontSize(100)
.fontColor("#FF0000FD")
.obscured([ObscuredReasons.PLACEHOLDER])
.textAlign(TextAlign.End)
.baselineOffset(100)
.key('ArkUX_Redacted_Text_0110')
}.margin({bottom: 50})
Row() {
Text(this.message)
.fontSize(1000)
.fontColor("#FF0000FC")
.obscured([ObscuredReasons.PLACEHOLDER])
.textAlign(TextAlign.Center)
.baselineOffset(1000)
.key('ArkUX_Redacted_Text_0120')
}.margin({bottom: 50})
Row() {
Text(this.message)
.fontSize(1)
.fontColor("#FF0000FB")
.obscured([ObscuredReasons.PLACEHOLDER])
.textAlign(TextAlign.Start)
.baselineOffset(1)
.key('ArkUX_Redacted_Text_0130')
}.margin({bottom: 50})
}.margin({ left: 52 })
}
.scrollBar(BarState.Off)
.scrollable(ScrollDirection.Vertical)
ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) {
Text()
.width(30)
.height(100)
.borderRadius(10)
.backgroundColor('#C0C0C0')
}.width(30).backgroundColor('#ededed')
}
}
}
}
/**
* Copyright (c) 2023 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.
*/
export default class CommonFunc {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time){
return new Promise((resolve,reject)=>{
setTimeout(()=>{
resolve("ok")
},time)
}).then(()=>{
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
}
// @ts-nocheck
/**
* Copyright (c) 2023 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.
*/
const TYPE = '$type'
const ID = '$ID'
const Z_INDEX = '$z-index'
const RECT = '$rect'
const DEBUGLINE = '$debugLine'
const ATTRS = '$attrs'
const ATTRS_SEPIA = 'sepia'
const ATTRS_ASPECTRATIO = 'aspectRatio'
const ATTRS_CONTRAST = 'contrast'
const ATTRS_SATURATE = 'saturate'
const ATTRS_HUEROTATE = 'hueRotate'
const ATTRS_INVERT = 'invert'
const ATTRS_BRIGHTNESS = 'brightness'
const ATTRS_BACKDROPBLUR = 'backdropBlur'
const ATTRS_GRAYSCALE = 'grayscale'
const ATTRS_BLUR = 'blur'
const ATTRS_GRIDOFFSET = 'gridOffset'
const ATTRS_FLEXSHRINK = 'flexShrink'
const ATTRS_FLEXGROW = 'flexGrow'
const ATTRS_OPACITY = 'opacity'
const ATTRS_DIRECTION = 'direction'
const ATTRS_ALIGN = 'align'
const ATTRS_HEIGHT = 'height'
const ATTRS_BACKGROUNDCOLOR = 'backgroundColor'
const ATTRS_ALIGNSELF = 'alignSelf'
const ATTRS_BORDERWIDTH = 'borderWidth'
const ATTRS_WIDTH = 'width'
const ATTRS_BORDERCOLOR = 'borderColor'
const ATTRS_MARGIN_BOTTOM = 'margin-bottom'
const ATTRS_BORDERSTYLE = 'borderStyle'
const ATTRS_MARGIN_RIGHT = 'margin-right'
const ATTRS_CONSTRAINTSIZE = 'constraintSize'
const ATTRS_NARGIN_LEFT = 'margin-left'
const ATTRS_BACKGROUNDIMAGE = 'backgroundImage'
const ATTRS_MARGIN_TOP = 'margin-top'
const ATTRS_BORDERRADIUS = 'borderRadius'
const ATTRS_FLEXBASIC = 'flexBasis'
const ATTRS_VISIBILITY = 'visibility'
const ATTRS_PASSWORD = 'password'
const ATTRS_CHECKED = 'checked'
const ATTRS_SELECTED = 'selected'
const ATTRS_LONG_CLICKABLE = 'long-clickable'
const ATTRS_FOCUSED = 'focused'
const ATTRS_SCROLLABLE = 'scrollable'
const ATTRS_CLICKABLE = 'clickable'
const ATTRS_FOCUSABLE = 'focusable'
const ATTRS_CHECKABLE = 'checkable'
const ATTRS_CLIP = 'clip'
const ATTRS_ENABLE = 'enabled'
const ATTRS_DISPLAYPRIORITY = 'displayPriority'
const ATTRS_LAYOUTWEIGHT = 'layoutWeight'
const ATTRS_LAYOUTPRIORITY = 'layoutPriority'
const ATTRS_GRIDSPAN = 'gridSpan'
const ATTRS_ZINDEX = 'zIndex'
const ATTRS_USEALIGN = 'useAlign'
const ATTRS_USEALIGN_EDGE = 'edge'
const ATTRS_USEALIGN_OFFSET = 'offset'
const ATTRS_MASK = 'mask'
const ATTRS_MARKANCHOR = 'markAnchor'
const ATTRS_MARKANCHOR_X = 'x'
const ATTRS_MARKANCHOR_Y = 'y'
const ATTRS_PADDING = 'padding'
const ATTRS_POSITION = 'position'
const ATTRS_POSITION_X = 'x'
const ATTRS_POSITION_Y = 'y'
const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition'
const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x'
const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y'
const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize'
const ATTRS_OFFSET = 'offset'
const ATTRS_OFFSET_X = 'x'
const ATTRS_OFFSET_Y = 'y'
const ATTRS_SHADOW = 'shadow'
const ATTRS_SHADOW_RADIUS = 'radius'
const ATTRS_SHADOW_COLOR = 'color'
const ATTRS_SHADOW_OFFSETX = 'offsetX'
const ATTRS_SHADOW_OFFSETY = 'offsetY'
const ATTRS_WINDOWBLUR = 'windowBlur'
const ATTRS_WINDOWBLUR_PERCENT = 'percent'
const ATTRS_WINDOWBLUR_STYLE = 'style'
const ATTRS_FONTFAMILY = 'fontFamily'
const ATTRS_FONTWEIGHT = 'fontWeight'
const ATTRS_FONTSTYLE = 'fontStyle'
const ATTRS_FONTSIZE = 'fontSize'
const ATTRS_TEXTCASE = 'textCase'
const ATTRS_MAXLINES = 'maxLines'
const ATTRS_DECORATION = 'decoration'
const ATTRS_BASELINEOFFSET = 'baselineOffset'
const ATTRS_TEXTOVERFLOW = 'textOverflow'
const ATTRS_LINEHEIGHT = 'lineHeight'
const ATTRS_FONTCOLOR = 'fontColor'
const ATTRS_TEXTALIGN = 'textAlign'
const ATTRS_CONTENT = 'content'
/**
* Copyright (c) 2023 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.
*/
export interface Callback {
(message:any):void
}
export class MessageManager {
callback:Callback
callbacks:Map<string,Callback> = new Map()
constructor() {
}
registerCallback(callback:Callback , type?:string) {
if (type == undefined) {
console.error('registerCallback callback set')
this.callback = callback
return
}
this.callbacks.set(type,callback)
}
notify(message:any, type?:string) {
if (type == undefined) {
this.callback(message)
return
}
let tmpCallback:Callback = this.callbacks.get(type)
if (tmpCallback === undefined) {
console.error('callbacks has no callback for type ' + type)
return
}
tmpCallback(message)
}
clear() {
this.callbacks.clear()
this.callback = null
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout',
'-s dryRun'
]);
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`;
}
}
return targetParams.trim();
}
async function onAbilityCreateCallback() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err): Promise<void> {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
}
async onRun() {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments();
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility';
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback);
let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName;
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters);
let debug = abilityDelegatorArguments.parameters['-D'];
if (debug == 'true') {
cmd += ' -D';
}
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd,
(err, d) => {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
});
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 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 stageFontTest from './stageFont.test';
import stageRouterTest from './stageRouter.test';
import animateToTest from './animateto.test';
import stageActionSheet from './stageActionSheet.test';
import stageAlertDialog from './stageAlertDialog.test';
import stageDatePickerDialog from './stageDatePickerDialog.test';
import stageMediaquery from './stageMediaquery.test';
import stagePrompt from './stagePrompt.test';
import stageTextPickerDialog from './stageTextPickerDialog.test';
import stageTimePickerDialog from './stageTimePickerDialog.test';
import bindPopupOffsetTest from './bindPopupOffset.test';
import animationCurveTest from './animationCurve.test';
import hoverTest from './hover.test';
import textObscuredTest from './textObscuredTest.test';
import imageObscuredTest from './imageObscuredTest.test'
export default function testsuite() {
stageFontTest()
stageRouterTest()
animateToTest()
stageActionSheet()
stageAlertDialog()
stageDatePickerDialog()
stageMediaquery()
stagePrompt()
stageTextPickerDialog()
stageTimePickerDialog()
bindPopupOffsetTest()
animationCurveTest()
hoverTest()
textObscuredTest()
imageObscuredTest()
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import Curves from '@ohos.curves'
import router from '@system.router';
export default function animationCurveTest() {
describe('animationCurveTest', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/animationCurve',
}
try {
router.clear();
let pages = router.getState();
console.info("get animationCurve state success " + JSON.stringify(pages));
if (!("animationCurve" == pages.name)) {
console.info("get animationCurve state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push animationCurve page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push animationCurve page error: " + err);
}
done()
});
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('ArkUX_ohos.curves_customCurve_1000', 0, async function (done) {
console.info('ArkUX_ohos.curves_customCurve_1000 START');
var fraction
setTimeout(()=>{
try{
fraction = Curves.customCurve((fraction:number)=>{return fraction }).interpolate(0.1).toFixed(4)
var finalRes
if(fraction==0.1000 ){
finalRes = true;
}else{
finalRes = false;
}
expect(finalRes).assertEqual(true);
} catch(err) {
}
done();
},500)
});
it('ArkUX_ohos.curves_customCurve_1100', 0, async function (done) {
console.info('ArkUX_ohos.curves_customCurve_1000 START');
var fraction1
setTimeout(()=>{
try{
fraction1 = Curves.customCurve((fraction:number)=>{return 2*fraction }).interpolate(0.1).toFixed(4)
console.info( "curves_customCurve_1100",fraction1)
var finalRes1
if(fraction1==0.2000){
finalRes1 = true;
}else{
finalRes1 = false;
}
expect(finalRes1).assertEqual(true);
} catch(err) {
}
done();
},500)
});
it('ArkUX_ohos.curves_customCurve_1200', 0, async function (done) {
console.info('ArkUX_ohos.curves_customCurve_1200 START');
var fraction2
setTimeout(()=>{
try{
fraction2 = Curves.customCurve((fraction:number)=>{return fraction*fraction }).interpolate(0.1).toFixed(4)
console.info( "curves_customCurve_1200",fraction2)
var finalRes2
if(fraction2==0.0100){
finalRes2 = true;
}else{
finalRes2 = false;
}
expect(finalRes2).assertEqual(true);
} catch(err) {
}
done();
},500)
});
it('ArkUX_ohos.curves_customCurve_1300', 0, async function (done) {
console.info('ArkUX_ohos.curves_customCurve_1300 START');
var fraction3
var fraction4
setTimeout(()=>{
try{
fraction3 = Curves.customCurve((fraction:number)=>{return fraction*fraction }).interpolate(0.1).toFixed(4)
fraction4 = Curves.customCurve((fraction:number)=>{return fraction*fraction }).interpolate(0.1).toFixed(4)
console.info( "curves_customCurve_1300",fraction3)
var finalRes3
if(fraction3==0.0100&&fraction4==0.0100){
finalRes3 = true;
}else{
finalRes3 = false;
}
expect(finalRes3).assertEqual(true);
} catch(err) {
}
done();
},500)
});
it('ArkUX_ohos.curves_customCurve_1400', 0, async function (done) {
console.info('ArkUX_ohos.curves_customCurve_1400 START');
var fraction5
var abc
function interpolate3(fraction) {
interpolate4(fraction)
return abc
}
function interpolate4(fraction){
abc=fraction
}
setTimeout(()=>{
try{
fraction5 = Curves.customCurve(interpolate3('fraction')).interpolate(0.1).toFixed(4)
console.info('ArkUX_ohos.curves_customCurve_14005 '+ fraction5);
var finalRes5
if(fraction5==0.1000){
finalRes5 = true;
}else{
finalRes5 = false;
}
expect(finalRes5).assertEqual(true);
} catch(err) {
}
done();
},1000)
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import events_emitter from '@ohos.events.emitter';
import router from '@system.router';
export default function bindPopupOffsetTest() {
describe('bindPopupOffsetTest', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/bindPopupOffset',
}
try {
router.clear();
let pages = router.getState();
console.info("get bindPopupOffset state success " + JSON.stringify(pages));
if (!("bindPopupOffset" == pages.name)) {
console.info("get bindPopupOffset state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push bindPopupOffset page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push bindPopupOffset page error: " + err);
}
done()
});
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('bindPopupOffsetTest_0100', 0, async function (done) {
console.info('bindPopupOffsetTest_0100 START');
try {
let indexEvent = {
eventId: 12065,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0100 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual({ x: 10, y: 10 });
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0100 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('PopupOptions', 10, "")
console.info("bindPopupOffsetTest_0100 click result is: " + JSON.stringify(sendEventByKey('PopupOptions', 10, "")));
console.info('bindPopupOffsetTest_0100 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0100 ERR ' + JSON.stringify(err));
}
done();
});
it('bindPopupOffsetTest_0200', 0, async function (done) {
console.info('bindPopupOffsetTest_0200 START');
try {
let indexEvent = {
eventId: 12066,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0200 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual({ x: 10, y: 10 });
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0200 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('customPopup', 10, "")
console.info("bindPopupOffsetTest_0200 click result is: " + JSON.stringify(sendEventByKey('customPopup', 10, "")));
console.info('bindPopupOffsetTest_0200 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0200 ERR ' + JSON.stringify(err));
}
done();
});
it('bindPopupOffsetTest_0300', 0, async function (done) {
console.info('bindPopupOffsetTest_0300 START');
try {
let indexEvent = {
eventId: 12067,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0300 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual({ x: 0, y: 0 });
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0300 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('PopupOptions00', 10, "")
console.info("bindPopupOffsetTest_0300 click result is: " + JSON.stringify(sendEventByKey('PopupOptions00', 10, "")));
console.info('bindPopupOffsetTest_0300 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0300 ERR ' + JSON.stringify(err));
}
done();
});
it('bindPopupOffsetTest_0400', 0, async function (done) {
console.info('bindPopupOffsetTest_0400 START');
try {
let indexEvent = {
eventId: 12068,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0400 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual({ x: 0, y: 50 });
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0400 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('PopupOptions050', 10, "")
console.info("bindPopupOffsetTest_0400 click result is: " + JSON.stringify(sendEventByKey('PopupOptions050', 10, "")));
console.info('bindPopupOffsetTest_0400 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0400 ERR ' + JSON.stringify(err));
}
done();
});
it('bindPopupOffsetTest_0500', 0, async function (done) {
console.info('bindPopupOffsetTest_0500 START');
try {
let indexEvent = {
eventId: 12069,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0500 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual(null);
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0500 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('PopupOptionsnull', 10, "")
console.info("bindPopupOffsetTest_0500 click result is: " + JSON.stringify(sendEventByKey('PopupOptionsnull', 10, "")));
console.info('bindPopupOffsetTest_0500 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0500 ERR ' + JSON.stringify(err));
}
done();
});
it('bindPopupOffsetTest_0600', 0, async function (done) {
console.info('bindPopupOffsetTest_0600 START');
try {
let indexEvent = {
eventId: 12070,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0600 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual({ x: -10, y: -10 });
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0600 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('PopupOptions10', 10, "")
console.info("bindPopupOffsetTest_0600 click result is: " + JSON.stringify(sendEventByKey('PopupOptions10', 10, "")));
console.info('bindPopupOffsetTest_0600 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0600 ERR ' + JSON.stringify(err));
}
done();
});
it('bindPopupOffsetTest_0700', 0, async function (done) {
console.info('bindPopupOffsetTest_0700 START');
try {
let indexEvent = {
eventId: 12071,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0700 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual({ x: -10, y: -10 });
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0700 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('customPopup10', 10, "")
console.info("bindPopupOffsetTest_0700 click result is: " + JSON.stringify(sendEventByKey('customPopup10', 10, "")));
console.info('bindPopupOffsetTest_0700 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0700 ERR ' + JSON.stringify(err));
}
done();
});
it('bindPopupOffsetTest_0800', 0, async function (done) {
console.info('bindPopupOffsetTest_0800 START');
try {
let indexEvent = {
eventId: 12072,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0800 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual({ x: 0, y: 0 });
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0800 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('customPopup00', 10, "")
console.info("bindPopupOffsetTest_0800 click result is: " + JSON.stringify(sendEventByKey('customPopup00', 10, "")));
console.info('bindPopupOffsetTest_0800 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0800 ERR ' + JSON.stringify(err));
}
done();
});
it('bbindPopupOffsetTest_0900', 0, async function (done) {
console.info('bindPopupOffsetTest_0900 START');
try {
let indexEvent = {
eventId: 12073,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_0900 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual({ x: 0, y: 50 });
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_0900 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('customPopup050', 10, "")
console.info("bindPopupOffsetTest_0900 click result is: " + JSON.stringify(sendEventByKey('customPopup050', 10, "")));
console.info('bindPopupOffsetTest_0900 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_0900 ERR ' + JSON.stringify(err));
}
done();
});
it('bindPopupOffsetTest_1000', 0, async function (done) {
console.info('bindPopupOffsetTest_1000 START');
try {
let indexEvent = {
eventId: 12074,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("bindPopupOffsetTest_1000 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.offset).assertEqual(null);
done();
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("bindPopupOffsetTest_1000 on events_emitter err : " + JSON.stringify(err));
}
sendEventByKey('PopupOptionsnull', 10, "")
console.info("bindPopupOffsetTest_1000 click result is: " + JSON.stringify(sendEventByKey('PopupOptionsnull', 10, "")));
console.info('bindPopupOffsetTest_1000 END ');
} catch (err) {
expect().assertFail()
console.info('bindPopupOffsetTest_1000 ERR ' + JSON.stringify(err));
}
done();
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import router from '@system.router';
export default function hoverTest() {
describe('hoverTest', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/hover',
}
try {
router.clear();
let pages = router.getState();
console.info("get hover state success " + JSON.stringify(pages));
if (!("hover" == pages.name)) {
console.info("get hover state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push hover page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push hover page error: " + err);
}
done()
});
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('ArkUX_Hover_stoppropagation_0100', 0, async function (done) {
console.info('ArkUX_Hover_stoppropagation_0100 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Hover_stoppropagation_0100');
console.info('ArkUX_Hover_stoppropagation_0100 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Button');
console.info('ArkUX_Hover_stoppropagation_0100 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Hover_stoppropagation_0100 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import router from '@system.router';
export default function imageObscuredTest() {
describe('imageObscuredTest', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/imageObscuredTest',
}
try {
router.clear();
let pages = router.getState();
console.info("get imageObscuredTest state success " + JSON.stringify(pages));
if (!("imageObscuredTest" == pages.name)) {
console.info("get imageObscuredTest state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push imageObscuredTest page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push imageObscuredTest page error: " + err);
}
done()
});
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('ArkUX_Redacted_Image_0150', 0, async function (done) {
console.info('ArkUX_Redacted_Image_0150 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Redacted_Image_0150');
console.info('ArkUX_Redacted_Image_0150 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Redacted_Image_0150 obj is: " + JSON.stringify(obj));
console.info("ArkUX_Redacted_Image_0150 obj.$attrs is: " +
JSON.stringify(obj.$attrs));
let attr = obj.$attrs
expect(attr.width).assertEqual("400.00px");
expect(attr.height).assertEqual("400.00px");
expect(attr.borderRadius).assertEqual("20.00vp");
expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER));
console.info('ArkUX_Redacted_Image_0150 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Redacted_Image_0150 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Redacted_Image_0160', 0, async function (done) {
console.info('ArkUX_Redacted_Image_0160 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Redacted_Image_0160');
console.info('ArkUX_Redacted_Image_0160 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Redacted_Image_0160 obj is: " + JSON.stringify(obj));
console.info("ArkUX_Redacted_Image_0160 obj.$attrs is: " +
JSON.stringify(obj.$attrs));
let attr = obj.$attrs
expect(attr.obscured.length).assertEqual(0);
console.info('ArkUX_Redacted_Image_0020 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Redacted_Image_0160 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Redacted_Image_0170', 0, async function (done) {
console.info('ArkUX_Redacted_Image_0170 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Redacted_Image_0170');
console.info('ArkUX_Redacted_Image_0170 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Redacted_Image_0170 obj is: " + JSON.stringify(obj));
console.info("ArkUX_Redacted_Image_0170 obj.$attrs is: " +
JSON.stringify(obj.$attrs));
let attr = obj.$attrs
expect(attr.width).assertEqual("700.00px");
expect(attr.height).assertEqual("200.00px");
expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER));
console.info('ArkUX_Redacted_Image_0170 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Redacted_Image_0170 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Redacted_Image_0180', 0, async function (done) {
console.info('ArkUX_Redacted_Image_0180 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Redacted_Image_0180');
console.info('ArkUX_Redacted_Image_0180 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Redacted_Image_0180 obj is: " + JSON.stringify(obj));
console.info("ArkUX_Redacted_Image_0180 obj.$attrs is: " +
JSON.stringify(obj.$attrs));
let attr = obj.$attrs
expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER));
console.info('ArkUX_Redacted_Image_0180 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Redacted_Image_0180 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Redacted_Image_0190', 0, async function (done) {
console.info('ArkUX_Redacted_Image_0190 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Redacted_Image_0190');
console.info('ArkUX_Redacted_Image_0190 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Redacted_Image_0190 obj is: " + JSON.stringify(obj));
console.info("ArkUX_Redacted_Image_0190 obj.$attrs is: " +
JSON.stringify(obj.$attrs));
let attr = obj.$attrs
expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER));
console.info('ArkUX_Redacted_Image_0190 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Redacted_Image_0190 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import events_emitter from '@ohos.events.emitter';
import router from '@system.router';
export default function stageActionSheet() {
describe('stageActionSheet', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/stageActionSheet',
}
try {
router.clear();
let pages = router.getState();
console.info("get stageActionSheet state success " + JSON.stringify(pages));
if (!("stageActionSheet" == pages.name)) {
console.info("get stageActionSheet state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push stageActionSheet page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push stageActionSheet page error: " + err);
}
done()
});
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('testShowActionShee001', 0, async function (done) {
console.info('testShowActionShee001 START');
setTimeout(()=>{
try{
var innerEventOne = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("testShowActionShee001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(true);
done();
}
try {
events_emitter.on(innerEventOne, callback1);
} catch (err) {
console.info("testShowActionShee001 on events_emitter err : " + JSON.stringify(err));
}
console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showToastText', 10, "")));
console.info('testShowActionShee001 END ');
} catch(err) {
expect().assertFail()
console.info('testShowActionShee001 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('testShowActionShee002', 0, async function (done) {
console.info('testShowActionShee002 START');
setTimeout(()=>{
try{
var innerEventTwo = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("testShowActionShee002 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(10);
done();
}
try {
events_emitter.on(innerEventTwo, callback1);
} catch (err) {
console.info("testShowActionShee002 on events_emitter err : " + JSON.stringify(err));
}
console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, "")));
console.info('testShowActionShee002 END ');
} catch(err) {
expect().assertFail()
console.info('testShowActionShee002 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('testShowActionShee003', 0, async function (done) {
console.info('testShowActionShee003 START');
setTimeout(()=>{
try{
var innerEventThree = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("testShowActionShee003 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual("STATUS");
done();
}
try {
events_emitter.on(innerEventThree, callback1);
} catch (err) {
console.info("testShowActionShee003 on events_emitter err : " + JSON.stringify(err));
}
console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, "")));
console.info('testShowActionShee003 END ');
} catch(err) {
expect().assertFail()
console.info('testShowActionShee003 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import events_emitter from '@ohos.events.emitter';
import router from '@system.router';
export default function stageAlertDialog() {
describe('stageAlertDialog', function () {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/stageAlertDialog',
}
try {
router.clear();
let pages = router.getState();
console.info("get stageAlertDialog state success " + JSON.stringify(pages));
if (!("stageAlertDialog" == pages.name)) {
console.info("get stageAlertDialog state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push stageAlertDialog page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push stageAlertDialog page error: " + err);
}
done()
});
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('stageAlertDialog001', 0, async function (done) {
console.info('stageAlertDialog001 START');
setTimeout(()=>{
try{
var innerEventOne = {
eventId: 60220,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("stageAlertDialog001 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(true);
done();
}
try {
events_emitter.on(innerEventOne, callback1);
} catch (err) {
console.info("stageAlertDialog001 on events_emitter err : " + JSON.stringify(err));
}
console.info("stageAlertDialog001 click result is: " + JSON.stringify(sendEventByKey('showToastText', 10, "")));
console.info('stageAlertDialog001 END ');
} catch(err) {
expect().assertFail()
console.info('stageAlertDialog001 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('stageAlertDialog002', 0, async function (done) {
console.info('stageAlertDialog002 START');
setTimeout(()=>{
try{
var innerEventTwo = {
eventId: 60221,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("stageAlertDialog002 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual(10);
done();
}
try {
events_emitter.on(innerEventTwo, callback1);
} catch (err) {
console.info("stageAlertDialog002 on events_emitter err : " + JSON.stringify(err));
}
console.info("stageAlertDialog002 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, "")));
console.info('TstageAlertDialog002 END ');
} catch(err) {
expect().assertFail()
console.info('stageAlertDialog002 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('stageAlertDialog003', 0, async function (done) {
console.info('stageAlertDialog003 START');
setTimeout(()=>{
try{
var innerEventThree = {
eventId: 60222,
priority: events_emitter.EventPriority.LOW
}
var callback1 = (eventData) => {
console.info("stageAlertDialog003 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.STATUS).assertEqual("STATUS");
done();
}
try {
events_emitter.on(innerEventThree, callback1);
} catch (err) {
console.info("stageAlertDialog003 on events_emitter err : " + JSON.stringify(err));
}
console.info("stageAlertDialog003 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, "")));
console.info('TstageAlertDialog003 END ');
} catch(err) {
expect().assertFail()
console.info('stageAlertDialog003 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
{
"module": {
"name": "phone",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:test_pages",
"metadata": [{
"name": "ArkTSPartialUpdate",
"value": "true"
}],
"abilities": [
{
"name": "TestAbility",
"srcEntrance": "./ets/TestAbility/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"label": "$string:TestAbility_label",
"visible": true,
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
]
}
}
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
},
{
"name": "Divider_color",
"value": "#000000"
},
{
"name": "checkbox_Color",
"value": "#FFFD0000"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
},
{
"name": "Divider_width",
"value": "10px"
},
{
"name": "Divider_startMargin",
"value": "5px"
},
{
"name": "Divider_endMargin",
"value": "5px"
},
{
"name": "Check_Mark_Size_test",
"value": "50vp"
}
]
}
\ No newline at end of file
<svg id="图层_2" data-name="图层 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96"><defs><style>.cls-1{fill:#1a1a1a;}</style></defs><title>ic</title><path d="M36,63v-30a4,4,0,0,1,6-3.47l26,15A4,4,0,0,1,69.46,50,4.09,4.09,0,0,1,68,51.44l-26,15A4,4,0,0,1,36,63ZM48,86A38,38,0,1,0,10,48,38,38,0,0,0,48,86Zm0,6A44,44,0,1,1,92,48,44,44,0,0,1,48,92Z" fill="#61E4BD"/></svg>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册