提交 3a526d50 编写于 作者: Z zhouke

modify.Signed-off-by: <zhouke35@huawei.com>.

Signed-off-by: Nzhouke <zhouke35@huawei.com>
上级 85f992fe
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
......
...@@ -89,10 +89,7 @@ ...@@ -89,10 +89,7 @@
"type": "pageAbility" "type": "pageAbility"
}, },
"pages": [ "pages": [
"pages/index", "pages/index"
"pages/second",
"pages/third",
"pages/fourth"
], ],
"name": ".TestAbility", "name": ".TestAbility",
"window": { "window": {
......
...@@ -12,11 +12,23 @@ ...@@ -12,11 +12,23 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
console.info('Application onCreate') console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
abilityDelegatorArguments.parameters['-s timeout'] = 3000000
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, },
onDestroy() { onDestroy() {
console.info('Application onDestroy') console.info('Application onDestroy')
}, },
} }
\ No newline at end of file
/**
* Copyright (c) 2022 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 router from '@system.router'; import router from '@system.router';
import prompt from '@ohos.prompt'; import prompt from '@ohos.prompt';
...@@ -8,72 +22,86 @@ struct ScrollExample { ...@@ -8,72 +22,86 @@ struct ScrollExample {
private arr: number[] = [1,2,3,4] private arr: number[] = [1,2,3,4]
build() { build() {
Stack({ alignContent: Alignment.TopStart }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll(this.scroller) { Text('MainPage')
Column() { .fontSize(50)
Button() { .fontWeight(FontWeight.Bold)
Text('next page') Stack({ alignContent: Alignment.TopStart }) {
.fontSize(25) Scroll(this.scroller) {
.fontWeight(FontWeight.Bold) Column() {
}.key('my-key') Button() {
.type(ButtonType.Capsule) Text('next page')
.margin({ top: 20 }) .fontSize(25)
.onClick(() => { .fontWeight(FontWeight.Bold)
router.push({ uri: 'pages/second' }) }
}) .key('my-key')
.gesture( .type(ButtonType.Capsule)
LongPressGesture({repeat:false}) .margin({ top: 20 })
.onAction((event: GestureEvent)=>{ .onClick(() => {
router.push({ uri: 'pages/fourth' }) router.push({ uri: 'pages/second' })
}) })
)
Button() {
Text('Click twice')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.type(ButtonType.Capsule)
.margin({top:20})
.gesture( .gesture(
TapGesture({ count: 2 }) LongPressGesture({ repeat: false })
.onAction(() => { .onAction((event: GestureEvent) => {
router.push({ uri: 'pages/third' }) router.push({ uri: 'pages/fourth' })
}) })
)
Button() {
Text('Click twice')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.type(ButtonType.Capsule)
.margin({ top: 20 })
.gesture(
TapGesture({ count: 1 })
.onAction(() => {
router.push({ uri: 'pages/third' })
})
) )
Checkbox({name:'hi'})
.size({width:30,height:30}) Checkbox({ name: 'hi' })
TextInput({ placeholder: 'welcome', text: 'Hello World'}) .size({ width: 30, height: 30 })
.type(InputType.Normal) TextInput({ placeholder: 'welcome', text: 'Hello World' })
.width(300) .type(InputType.Normal)
.height(50) .width(300)
.fontSize(40) .height(50)
.enabled(true) .fontSize(40)
.margin({ top: 20 }) .enabled(true)
ForEach(this.arr, (item) => { .margin({ top: 20 })
Text(item.toString()) ForEach(this.arr, (item) => {
.width('100%').height('30%').backgroundColor(0xFFFFFF) Text(item.toString())
.borderRadius(75).fontSize(80).textAlign(TextAlign.Center) .width('100%')
.margin({ top: 10 }) .height('30%')
}, item => item) .backgroundColor(0xFFFFFF)
Button() { .borderRadius(75)
Text('bottom') .fontSize(80)
.fontSize(25) .textAlign(TextAlign.Center)
.fontWeight(FontWeight.Bold) .margin({ top: 10 })
}.type(ButtonType.Capsule) }, item => item)
.margin({ Button() {
top: 20, left: 150 Text('bottom')
}) .fontSize(25)
.onClick(() => { .fontWeight(FontWeight.Bold)
router.push({ uri: 'pages/second' }) }.type(ButtonType.Capsule)
}) .margin({
}.width('100%') top: 20, left: 150
} })
.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On) .onClick(() => {
.scrollBarColor(Color.Gray).scrollBarWidth(30) router.push({ uri: 'pages/second' })
.onScroll((xOffset: number, yOffset: number) => { })
console.info(xOffset + ' ' + yOffset) }.width('100%')
}) }
}.width('100%').height('100%').backgroundColor(0xDCDCDC) .scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.On)
.scrollBarColor(Color.Gray)
.scrollBarWidth(30)
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
})
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
} }
} }
...@@ -12,20 +12,10 @@ ...@@ -12,20 +12,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default { export default {
onCreate() { onCreate() {
console.info('Application onCreate') console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
abilityDelegatorArguments.parameters['timeout'] = 3000000
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, },
onDestroy() { onDestroy() {
console.info('Application onDestroy') console.info('Application onDestroy')
......
/**
* Copyright (c) 2022 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 router from '@system.router';
@Entry
@Component
struct Fourth
{
private content: string = "Fourth Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('longClick')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
...@@ -22,72 +22,86 @@ struct ScrollExample { ...@@ -22,72 +22,86 @@ struct ScrollExample {
private arr: number[] = [1,2,3,4] private arr: number[] = [1,2,3,4]
build() { build() {
Stack({ alignContent: Alignment.TopStart }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll(this.scroller) { Text('MainPage')
Column() { .fontSize(50)
Button() { .fontWeight(FontWeight.Bold)
Text('next page') Stack({ alignContent: Alignment.TopStart }) {
.fontSize(25) Scroll(this.scroller) {
.fontWeight(FontWeight.Bold) Column() {
}.key('my-key') Button() {
.type(ButtonType.Capsule) Text('next page')
.margin({ top: 20 }) .fontSize(25)
.onClick(() => { .fontWeight(FontWeight.Bold)
router.push({ uri: 'pages/second' }) }
}) .key('my-key')
.gesture( .type(ButtonType.Capsule)
LongPressGesture({repeat:false}) .margin({ top: 20 })
.onAction((event: GestureEvent)=>{ .onClick(() => {
router.push({ uri: 'pages/fourth' }) router.push({ uri: 'pages/second' })
}) })
)
Button() {
Text('Click twice')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.type(ButtonType.Capsule)
.margin({top:20})
.gesture( .gesture(
TapGesture({ count: 2 }) LongPressGesture({ repeat: false })
.onAction(() => { .onAction((event: GestureEvent) => {
router.push({ uri: 'pages/third' }) router.push({ uri: 'pages/fourth' })
}) })
)
Button() {
Text('Click twice')
.fontSize(25)
.fontWeight(FontWeight.Bold)
}
.type(ButtonType.Capsule)
.margin({ top: 20 })
.gesture(
TapGesture({ count: 1 })
.onAction(() => {
router.push({ uri: 'pages/third' })
})
) )
Checkbox({name:'hi'})
.size({width:30,height:30}) Checkbox({ name: 'hi' })
TextInput({ placeholder: 'welcome', text: 'Hello World'}) .size({ width: 30, height: 30 })
.type(InputType.Normal) TextInput({ placeholder: 'welcome', text: 'Hello World' })
.width(300) .type(InputType.Normal)
.height(50) .width(300)
.fontSize(40) .height(50)
.enabled(true) .fontSize(40)
.margin({ top: 20 }) .enabled(true)
ForEach(this.arr, (item) => { .margin({ top: 20 })
Text(item.toString()) ForEach(this.arr, (item) => {
.width('100%').height('30%').backgroundColor(0xFFFFFF) Text(item.toString())
.borderRadius(75).fontSize(80).textAlign(TextAlign.Center) .width('100%')
.margin({ top: 10 }) .height('30%')
}, item => item) .backgroundColor(0xFFFFFF)
Button() { .borderRadius(75)
Text('bottom') .fontSize(80)
.fontSize(25) .textAlign(TextAlign.Center)
.fontWeight(FontWeight.Bold) .margin({ top: 10 })
}.type(ButtonType.Capsule) }, item => item)
.margin({ Button() {
top: 20, left: 150 Text('bottom')
}) .fontSize(25)
.onClick(() => { .fontWeight(FontWeight.Bold)
router.push({ uri: 'pages/second' }) }.type(ButtonType.Capsule)
}) .margin({
}.width('100%') top: 20, left: 150
} })
.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On) .onClick(() => {
.scrollBarColor(Color.Gray).scrollBarWidth(30) router.push({ uri: 'pages/second' })
.onScroll((xOffset: number, yOffset: number) => { })
console.info(xOffset + ' ' + yOffset) }.width('100%')
}) }
}.width('100%').height('100%').backgroundColor(0xDCDCDC) .scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.On)
.scrollBarColor(Color.Gray)
.scrollBarWidth(30)
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
})
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
} }
} }
/**
* Copyright (c) 2022 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 router from '@system.router';
@Entry
@Component
struct Second {
private content: string = "Second Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('back to index')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
/**
* Copyright (c) 2022 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 router from '@system.router';
@Entry
@Component
struct Third{
private content: string = "Third Page"
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('doubleClick')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
...@@ -58,7 +58,7 @@ export default class OpenHarmonyTestRunner implements TestRunner { ...@@ -58,7 +58,7 @@ export default class OpenHarmonyTestRunner implements TestRunner {
abilityName: testAbilityName, abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback, onAbilityCreate: onAbilityCreateCallback,
}; };
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters) cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册