Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
cfc5c784
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cfc5c784
编写于
2月 20, 2023
作者:
Y
ywx1211260
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revise
Signed-off-by:
N
ywx1211260
<
yupeng78@huawei.com
>
上级
fc05df80
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
171 addition
and
45 deletion
+171
-45
arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
..._web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
+1
-19
arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/webTwo.ets
...b_dev_two/entry/src/main/ets/MainAbility/pages/webTwo.ets
+74
-0
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/List.test.ets
...ace_ets_web_dev_two/entry/src/main/ets/test/List.test.ets
+2
-1
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
...ts_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
+2
-22
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebTwoJsunit.test.ets
...web_dev_two/entry/src/main/ets/test/WebTwoJsunit.test.ets
+88
-0
arkui/ace_ets_web_dev_two/entry/src/main/resources/base/profile/main_pages.json
...two/entry/src/main/resources/base/profile/main_pages.json
+2
-1
arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/index.html
...s_web_dev_two/entry/src/main/resources/rawfile/index.html
+2
-2
未找到文件。
arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
浏览文件 @
cfc5c784
...
...
@@ -137,10 +137,6 @@ struct Index {
},3000)
break;
}
case "emitOnConsole":{
this.controller.runJavaScript({script:"consoleTest()"})
break;
}
case "emitLoaData":{
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
setTimeout(()=>{
...
...
@@ -164,7 +160,6 @@ struct Index {
this.controller.runJavaScript({script:"getPageHeight()",callback:(res1)=>{
var zoomInCalled = false
this.controller.runJavaScript({script:"getPageHeight()",callback:(res)=>{
console.info("getPageHeight==>"+res)
if (Number(res) > Number(res1)) {
zoomInCalled = true
}
...
...
@@ -207,20 +202,7 @@ struct Index {
.databaseAccess(true)
.zoomAccess(this.zoomAccessValue)
.textZoomRatio(this.textRatio)
.onConsole((event) => {
let level = event.message.getMessageLevel()
let msg = event.message.getMessage()
let lineNumber = event.message.getLineNumber().toString()
let sourceId = event.message.getSourceId()
console.log("lineNumber:" + lineNumber)
setTimeout(()=>{
Utils.emitEvent(lineNumber,420)
},3000)
setTimeout(()=>{
Utils.emitEvent(sourceId,422)
},3000)
return false
})
}
}
}
arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/webTwo.ets
0 → 100644
浏览文件 @
cfc5c784
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import events_emitter from '@ohos.events.emitter';
import Utils from '../../test/Utils';
@Entry
@Component
struct Second {
controller:WebController = new WebController()
@State str:string="emitOnConsole"
@State overviewModeAccess:boolean=true
@State overviewScale:string=""
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
};
events_emitter.on(valueChangeEvent,this.valueChangeCallBack);
}
private valueChangeCallBack=(eventData)=>{
console.info("web page valueChangeCallBack");
if(eventData != null){
console.info("valueChangeCallBack:"+ JSON.stringify(eventData));
if(eventData.data.ACTION != null){
this.str = eventData.data.ACTION;
}
}
}
build(){
Column(){
Row(){
Button("web click").key('webcomponenttwo').onClick(async ()=>{
console.info("key==>"+this.str);
switch(this.str){
case "emitOnConsole":{
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.runJavaScript({script:"consoleTest()"})
break;
}
default:
console.info("can not match case");
}
})
}
Web({src:$rawfile('index.html'),controller:this.controller})
.onConsole((event) => {
let level = event.message.getMessageLevel()
let msg = event.message.getMessage()
let lineNumber = event.message.getLineNumber().toString()
let sourceId = event.message.getSourceId()
console.log("lineNumber:" + lineNumber)
setTimeout(()=>{
Utils.emitEvent(lineNumber,420)
},3000)
setTimeout(()=>{
Utils.emitEvent(sourceId,422)
},3000)
return false
})
}
}
}
\ No newline at end of file
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/List.test.ets
浏览文件 @
cfc5c784
...
...
@@ -13,7 +13,8 @@
* limitations under the License.
*/
import webJsunit from './WebJsunit.test'
import webTwoJsunit from './WebTwoJsunit.test'
export default function testsuite() {
webJsunit()
webTwoJsunit()
}
\ No newline at end of file
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
浏览文件 @
cfc5c784
...
...
@@ -100,28 +100,8 @@ export default function webJsunit() {
*tc.desic return whether the third party cookie is allowed
*/
it('isThirdPartyCookieAllowed',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("isThirdPartyCookieAllowed",false,412,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_076
*tc.name getLineNumber
*tc.desic return the number of console message lines
*/
it('getLineNumber',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("getLineNumber","51",420,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_077
*tc.name getSourceId
*tc.desic return the source url
*/
it('getSourceId',0,async function(done){
emitKey="emitLoaData";
Utils.registerEvent("
getSourceId","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",42
2,done);
Utils.registerEvent("
isThirdPartyCookieAllowed",false,41
2,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -131,7 +111,7 @@ export default function webJsunit() {
*/
it('loadData',0,async function(done){
emitKey="emitZoomAccess";
Utils.registerEvent("loadData","
index
",424,done);
Utils.registerEvent("loadData","
\"index\"
",424,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebTwoJsunit.test.ets
0 → 100644
浏览文件 @
cfc5c784
/*
* 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.
*/
// @ts-nocheck
import { describe, beforeEach, afterEach, it, expect, beforeAll} from "@ohos/hypium";
import events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import Utils from './Utils.ets';
let emitKey = "emitOnConsole";
export default function webTwoJsunit() {
describe('overviewTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webTwo',
}
try {
router.clear();
let pages = router.getState();
console.info("get webTwo state success " + JSON.stringify(pages));
if (!("webTwo" == pages.name)) {
console.info("get webTwo state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webTwo page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webTwo page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("web beforeEach start");
done();
})
afterEach(async function (done) {
console.info("web afterEach start:"+emitKey);
try {
let backData = {
data: {
"ACTION": emitKey
}
}
let backEvent = {
eventId:10,
priority:events_emitter.EventPriority.LOW
}
console.info("start send emitKey");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("emit emitKey err: " + JSON.stringify(err));
}
await Utils.sleep(2000);
done();
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_076
*tc.name getLineNumber
*tc.desic return the number of console message lines
*/
it('getLineNumber',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("getLineNumber","51",420,done);
sendEventByKey('webcomponenttwo',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_077
*tc.name getSourceId
*tc.desic return the source url
*/
it('getSourceId',0,async function(done){
emitKey="emitGetSourceId";
Utils.registerEvent("getSourceId","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",422,done);
sendEventByKey('webcomponenttwo',10,'');
})
})
}
\ No newline at end of file
arkui/ace_ets_web_dev_two/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
cfc5c784
{
"src"
:
[
"MainAbility/pages/web"
"MainAbility/pages/web"
,
"MainAbility/pages/webTwo"
]
}
\ No newline at end of file
arkui/ace_ets_web_dev_two/entry/src/main/resources/rawfile/index.html
浏览文件 @
cfc5c784
...
...
@@ -14,8 +14,8 @@
<body>
<div
id=
"container"
>
首页
</div>
<div
id=
"pageHeight"
></div>
<a
href=
"
file:///data/storage/el1/bundle/phone/resources/rawfile/
second.html"
id=
"fileAccess"
>
打开rawfile文件
</a>
<img
src=
"
file:///data/storage/el1/bundle/phone/resources/rawfile/
icon.png"
alt=
"icon"
id=
"imgs"
>
<a
href=
"second.html"
id=
"fileAccess"
>
打开rawfile文件
</a>
<img
src=
"icon.png"
alt=
"icon"
id=
"imgs"
>
</body>
<script>
let
ele
=
document
.
getElementById
(
"
imgs
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录