Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a535d160
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a535d160
编写于
8月 26, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 26, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9875 弹窗扩展多个按钮属性XTS用例
Merge pull request !9875 from 李鲲辉/master
上级
62ba6274
7bc3d111
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
289 addition
and
1 deletion
+289
-1
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/DialogPage.ets
...nt_ui/entry/src/main/ets/MainAbility/pages/DialogPage.ets
+202
-0
arkui/ace_ets_component_ui/entry/src/main/ets/test/DialogJsunit.test.ets
...omponent_ui/entry/src/main/ets/test/DialogJsunit.test.ets
+83
-0
arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets
...ce_ets_component_ui/entry/src/main/ets/test/List.test.ets
+2
-0
arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json
..._ui/entry/src/main/resources/base/profile/main_pages.json
+2
-1
未找到文件。
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/DialogPage.ets
0 → 100644
浏览文件 @
a535d160
/**
* 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 {MessageManager,Callback} from '../utils/MessageManager';
@Entry
@Component
struct DialogPage {
@State title: string = 'title'
@State message: string = "This is the message of alertdialog"
@State autoCancel: boolean = true
@State buttonName: string = 'ButtonHORIZONTAL'
@State buttonName1: string = 'ButtonVERTICAL'
@State buttonName2: string = 'ButtonAuto'
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('DialogPage onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'autoCancel') {
this.autoCancel = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column({ space: 40 }) {
Button(this.buttonName)
.key('button')
.onClick(() => {
this.buttonName = 'threeButtonHor:succ'
this.showThreeButtonHORIZONTAL()
}).backgroundColor(0x317aff)
Button(this.buttonName1)
.key('button1')
.onClick(() => {
this.buttonName1 = 'threeButtonVer:succ'
this.showThreeButtonVERTICAL()
}).backgroundColor(0x317aff)
Button(this.buttonName2)
.key('button2')
.onClick(() => {
this.buttonName2 = 'threeButtonAuto:succ'
this.showThreeButtonAUTO()
}).backgroundColor(0x317aff)
}.width("100%").margin({ top: 150 })
}
private showThreeButtonHORIZONTAL() {
AlertDialog.show(
{
title: this.title,
message: this.message,
autoCancel: this.autoCancel,
buttonDirection:DialogButtonDirection.HORIZONTAL,
buttons: [
{
value: this.buttonName,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
{
value: this.buttonName1,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName1 = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
{
value: this.buttonName2,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName2 = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
],
cancel: () => {
console.info('Closed callbacks')
}
}
)
}
private showThreeButtonVERTICAL() {
AlertDialog.show(
{
title: this.title,
message: this.message,
autoCancel: this.autoCancel,
buttonDirection:DialogButtonDirection.VERTICAL,
buttons: [
{
value: this.buttonName,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
{
value: this.buttonName1,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName1 = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
{
value: this.buttonName2,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName2 = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
],
cancel: () => {
console.info('Closed callbacks')
}
}
)
}
private showThreeButtonAUTO() {
AlertDialog.show(
{
title: this.title,
message: this.message,
autoCancel: this.autoCancel,
buttonDirection:DialogButtonDirection.AUTO,
buttons: [
{
value: this.buttonName,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
{
value: this.buttonName1,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName1 = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
{
value: this.buttonName2,
fontColor: 0xffffff,
backgroundColor: 0x317aff,
action: () => {
this.buttonName2 = "OneButton3:succ"
console.info("Button AlertDialog Button-Clicking callback")
}
},
],
cancel: () => {
console.info('Closed callbacks')
}
}
)
}
}
\ No newline at end of file
arkui/ace_ets_component_ui/entry/src/main/ets/test/DialogJsunit.test.ets
0 → 100644
浏览文件 @
a535d160
/**
* 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 router from '@system.router';
import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.UiTest';
import CommonFunc from '../MainAbility/utils/Common';
import {MessageManager,Callback} from '../MainAbility/utils/MessageManager';
export default function DialogJsunit() {
describe('DialogJsunit', function () {
beforeEach(async function (done) {
console.info("DialogJsunit beforeEach start");
let options = {
uri: 'MainAbility/pages/DialogPage',
}
try {
router.clear();
let pages = router.getState();
console.info("get DialogJsunit state pages: " + JSON.stringify(pages));
if (!("DialogPage" == pages.name)) {
console.info("get DialogJsunit state pages.name: " + JSON.stringify(pages.name));
let result = await router.push(options);
await CommonFunc.sleep(2000);
console.info("push DialogJsunit success: " + JSON.stringify(result));
}
} catch (err) {
console.error("push DialogJsunit page error: " + err);
expect().assertFail();
}
done();
});
it('DialogJsunit_0100', 0, async function (done) {
console.info('[DialogJsunit_0100] START');
await CommonFunc.sleep(1000);
let driver = await UiDriver.create()
let button = await driver.findComponent(BY.key('button'));
await button.click();
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('button');
let obj = JSON.parse(strJson);
console.info('[DialogJsunit_0100] button component obj is: ' + obj.$attrs.label);
expect(obj.$attrs.label).assertEqual('threeButtonHor:succ');
await driver.pressBack();
await CommonFunc.sleep(500);
let button1 = await driver.findComponent(BY.key('button1'));
await button1.click();
await CommonFunc.sleep(1000);
let strJson1 = getInspectorByKey('button1');
let obj1 = JSON.parse(strJson1);
console.info('[DialogJsunit_0100] button1 component obj is: ' + obj1.$attrs.label);
expect(obj1.$attrs.label).assertEqual('threeButtonVer:succ');
await driver.pressBack();
await CommonFunc.sleep(500);
let button2 = await driver.findComponent(BY.key('button2'));
await button2.click();
await CommonFunc.sleep(1000);
let strJson2 = getInspectorByKey('button2');
let obj2 = JSON.parse(strJson2);
console.info('[DialogJsunit_0100] button2 component obj is: ' + obj2.$attrs.label);
expect(obj2.$attrs.label).assertEqual('threeButtonAuto:succ');
await driver.pressBack();
await CommonFunc.sleep(500);
console.info('[DialogJsunit_0100] END');
done();
});
})
}
\ No newline at end of file
arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets
浏览文件 @
a535d160
...
@@ -60,8 +60,10 @@ import ApiCommponentAddJsunit from './ApiCommponentAddJsunit.test.ets';
...
@@ -60,8 +60,10 @@ import ApiCommponentAddJsunit from './ApiCommponentAddJsunit.test.ets';
import fontJsunit from './fontJsunit.test.ets';
import fontJsunit from './fontJsunit.test.ets';
import PanGestureEventJsunit from './PanGestureEventJsunit.test.ets';
import PanGestureEventJsunit from './PanGestureEventJsunit.test.ets';
import RenderFitJsunit from './RenderFitJsunit.test.ets';
import RenderFitJsunit from './RenderFitJsunit.test.ets';
import DialogJsunit from './DialogJsunit.test.ets';
export default function testsuite() {
export default function testsuite() {
DialogJsunit();
blankJsunit();
blankJsunit();
buttonJsunit();
buttonJsunit();
checkBoxGroupUIJsunit();
checkBoxGroupUIJsunit();
...
...
arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
a535d160
...
@@ -93,6 +93,7 @@
...
@@ -93,6 +93,7 @@
"MainAbility/pages/navition3"
,
"MainAbility/pages/navition3"
,
"MainAbility/pages/DragController"
,
"MainAbility/pages/DragController"
,
"MainAbility/pages/richEditor"
,
"MainAbility/pages/richEditor"
,
"MainAbility/pages/richEditorCustomKeyBoard"
"MainAbility/pages/richEditorCustomKeyBoard"
,
"MainAbility/pages/DialogPage"
]
]
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录