提交 e2e9f67f 编写于 作者: G gaoxi

编译失败整改

Signed-off-by: Ngaoxi <gaoxi785@huawei.com>
上级 5ce115f1
......@@ -121,18 +121,15 @@
"pages/index",
"pages/Button",
"pages/Blank",
"pages/DataPanel",
"pages/Divider",
"pages/Text",
"pages/RowSplit",
"pages/Scroll",
"pages/Stack",
"pages/Image",
"pages/Progress",
"pages/Qrcode",
"pages/Rating",
"pages/Span",
"pages/Slider",
"pages/Badge",
"pages/Column",
"pages/ColumnSplit",
......
/*
* 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 router from '@system.router'
@Entry
@Component
struct dataPanel_testcase {
@State width: string= "200"
@State height: string= "100"
@State active: boolean = false
private content: string = "DataPanel Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Line })
.width(this.width)
.height(this.height)
.key('DataPanel')
.onClick(() => {
router.back()
})
.closeEffect(false)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Circle})
.width(this.width)
.height(this.height)
.key('DataPanel2')
.onClick(() => {
router.back()
})
.closeEffect(true)
DataPanel({ values: [20, 40, 20], max: 100})
.width(this.width)
.height(this.height)
.key('DataPanel3')
.onClick(() => {
router.back()
})
.closeEffect(false)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct image_textcase {
@State Width: number = 0
@State height: number = 0
onPageShow() {
console.info('Image page show called');
}
onBuildDone() {
console.info('Image page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Image page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Image("/resources/rawfile/hand.png")
.matchTextDirection(false)
.fitOriginalSize(false)
.fillColor(0xCCCCCC)
.objectFit(ImageFit.Cover)
.objectRepeat(ImageRepeat.NoRepeat)
.interpolation(ImageInterpolation.None)
.renderMode(ImageRenderMode.Original)
.autoResize(false)
.syncLoad(false)
.sourceSize({ width: 200, height: 100 })
.alt("/resources/rawfile/person.png")
.key('image1')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Contain)
.objectRepeat(ImageRepeat.X)
.interpolation(ImageInterpolation.High)
.renderMode(ImageRenderMode.Template)
.key('image2')
.height(180)
.width(180)
.onComplete((msg: {
width: number,
height: number
}) => {
this.Width = msg.width
this.height = msg.height
console.info('Width ----' + this.Width)
console.info('height ----' + this.height)
})
.onError(() => {
console.info('load image fail')
})
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Fill)
.objectRepeat(ImageRepeat.Y)
.interpolation(ImageInterpolation.Low)
.key('image3')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.None)
.objectRepeat(ImageRepeat.XY)
.interpolation(ImageInterpolation.Medium)
.key('image4')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.ScaleDown)
.key('image5')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(4)
}
}
}
/*
* 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.
*/
@Entry
@Component
struct slider {
@State inSetValue: number= 40
@State outSetValue: number= 40
@State direction: Axis= Axis.Horizontal
@State Begin: number = SliderChangeMode.Begin
onPageShow() {
console.info('Slider page show called');
}
onBuildDone() {
console.info('Slider page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Slider page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Slider({
value: this.outSetValue,
min: 0,
max: 100,
step: 1,
direction: Axis.Horizontal,
reverse: false,
style: SliderStyle.OutSet
})
.blockColor('#FFFF0000')
.selectedColor('#FF0000FF')
.trackColor('#FF808080')
.minLabel('10')
.maxLabel('10')
.showTips(false)
.showSteps(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValue = value
this.Begin = mode
console.info('value: ' + value + '---mode: ' + mode)
})
.width("100")
.height("100")
.key('slider1')
Slider({
value: 40,
min: 0,
max: 100,
step: 1,
style: SliderStyle.InSet
})
.blockColor(Color.Red)
.selectedColor(Color.Blue)
.trackColor(Color.Gray)
.showTips(true)
.showSteps(true)
.key('slider2')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
......@@ -12,9 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, afterAll, it, expect, afterEach} from 'deccjsunit/index.ets';
import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index';
import http from '@ohos.net.http';
import utils from './Utils.ets'
import utils from './Utils'
export default function httpRequestJsunit() {
describe("HttpRequestJsunitTest", function () {
......@@ -28,7 +29,7 @@ export default function httpRequestJsunit() {
console.log("-----------------------HttpRequest_request Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -42,7 +43,7 @@ export default function httpRequestJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequest_request Test end-----------------------");
done();
});
......@@ -69,7 +70,7 @@ export default function httpRequestJsunit() {
}
httpRequest.request("https://www.baidu.com/", (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequest_request_01 Test end-----------------------");
done();
});
......@@ -89,12 +90,12 @@ export default function httpRequestJsunit() {
console.log("-----------------------HttpRequest_request_02 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
connectTimeout: 60
}
};
var httpRequest = http.createHttp();
if (utils.notCheck) {
expect(true).assertTrue();
......@@ -103,7 +104,7 @@ export default function httpRequestJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequest_request_02 Test end-----------------------");
done();
}).catch(error => {
......@@ -126,7 +127,7 @@ export default function httpRequestJsunit() {
console.log("-----------------------HttpRequest_destroy Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -146,7 +147,7 @@ export default function httpRequestJsunit() {
console.log("-----------------------HttpRequest_destroy Test end-----------------------");
done();
}catch(error){
expect().assertFail();
expect(false).assertFail();
done();
}
});
......@@ -171,7 +172,7 @@ export default function httpRequestJsunit() {
done();
return;
}
httpRequest.on_headerReceive((data) => {
httpRequest.on('headerReceive',(data) => {
console.log(casename + " data: " + JSON.stringify(data));
expect(true).assertTrue();
console.log("-----------------------HttpRequest_on_headerReceive Test end-----------------------");
......@@ -199,7 +200,8 @@ export default function httpRequestJsunit() {
done();
return;
}
httpRequest.off_headerReceive((data) => {
//httpRequest.off_headerReceive((data) => {
httpRequest.off('headerReceive',(data) => {
console.log(casename + " data: " + JSON.stringify(data));
expect(true).assertTrue();
console.log("-----------------------HttpRequest_off_headerReceive Test end-----------------------");
......
......@@ -14,7 +14,7 @@
*/
import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index';
import http from '@ohos.net.http';
import utils from './Utils.ets'
import utils from './Utils'
export default function HttpRequestOptionsJsunit() {
......@@ -31,7 +31,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_method Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -45,7 +45,7 @@ export default function HttpRequestOptionsJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestOptions_method Test end-----------------------");
done();
});
......@@ -65,7 +65,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_method_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -79,7 +79,7 @@ export default function HttpRequestOptionsJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestOptions_method_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -102,7 +102,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_extraData Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: {
//tn=albumsdetail&word=渐变风格插画&fr=albumslist&album_tab=设计素材&album_id=409&rn=30
tn: "albumsdetail",
......@@ -124,7 +124,7 @@ export default function HttpRequestOptionsJsunit() {
}
httpRequest.request("https://image.baidu.com/search/albumsdetail/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestOptions_extraData Test end-----------------------");
done();
});
......@@ -144,7 +144,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_extraData_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: {
//tn=albumsdetail&word=渐变风格插画&fr=albumslist&album_tab=设计素材&album_id=409&rn=30
tn: "albumsdetail",
......@@ -166,7 +166,7 @@ export default function HttpRequestOptionsJsunit() {
}
httpRequest.request("https://image.baidu.com/search/albumsdetail/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestOptions_extraData_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -189,7 +189,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_header Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -204,13 +204,13 @@ export default function HttpRequestOptionsJsunit() {
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
try {
var entity = JSON.parse(data.getResult());
var entity = JSON.parse(data.result.toString());
expect(true).assertTrue();
console.log("-----------------------HttpRequestOptions_header Test end-----------------------");
done();
} catch (error) {
console.log("Telephony_Http_HttpRequestOptions_header_0100 : JSON parse error = " + error);
expect().assertFail();
expect(false).assertFail();
done();
}
});
......@@ -230,7 +230,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_header_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -245,7 +245,7 @@ export default function HttpRequestOptionsJsunit() {
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
try {
var entity = JSON.parse(data.getResult());
var entity = JSON.parse(data.result.toString());
expect(true).assertTrue();
console.log("-----------------------HttpRequestOptions_header_01 Test end-----------------------");
done();
......@@ -278,7 +278,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_header_02 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/xml",
readTimeout: 60,
......@@ -293,8 +293,7 @@ export default function HttpRequestOptionsJsunit() {
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
try {
var result = '<?xml version="1.0" encoding="utf-8"?>';
expect(data.getResult().contains(result)).assertTrue();
expect(data.responseCode == 200).assertTrue();
console.log("-----------------------HttpRequestOptions_header_02 Test end-----------------------");
done();
} catch (error) {
......@@ -319,7 +318,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_header_03 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/xml",
readTimeout: 60,
......@@ -335,7 +334,8 @@ export default function HttpRequestOptionsJsunit() {
console.log(casename + JSON.stringify(data));
try {
var result = '<?xml version="1.0" encoding="utf-8"?>';
expect(data.getResult().contains(result)).assertTrue();
//expect(data.getResult().contains(result)).assertTrue();
expect(data.result.valueOf() == result).assertTrue();
console.log("-----------------------HttpRequestOptions_header_03 Test end-----------------------");
done();
} catch (error) {
......@@ -365,7 +365,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_readTimeout Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 0.1,
......@@ -379,7 +379,7 @@ export default function HttpRequestOptionsJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode == 408).assertTrue();
expect(data.responseCode == 408).assertTrue();
console.log("-----------------------HttpRequestOptions_readTimeout Test end-----------------------");
done();
});
......@@ -399,7 +399,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_readTimeout_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 0.1,
......@@ -413,7 +413,7 @@ export default function HttpRequestOptionsJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode == 408).assertTrue();
expect(data.responseCode == 408).assertTrue();
console.log("-----------------------HttpRequestOptions_readTimeout_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -436,7 +436,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_connectTimeout Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -450,7 +450,7 @@ export default function HttpRequestOptionsJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode == 504).assertTrue();
expect(data.responseCode == 504).assertTrue();
console.log("-----------------------HttpRequestOptions_connectTimeout Test end-----------------------");
done();
});
......@@ -471,7 +471,7 @@ export default function HttpRequestOptionsJsunit() {
console.log("-----------------------HttpRequestOptions_connectTimeout_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -485,7 +485,7 @@ export default function HttpRequestOptionsJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode == 504).assertTrue();
expect(data.responseCode == 504).assertTrue();
console.log("-----------------------HttpRequestOptions_connectTimeout_01 Test end-----------------------");
done();
}).catch(error => {
......
......@@ -14,7 +14,7 @@
*/
import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index';
import http from '@ohos.net.http';
import utils from './Utils.ets'
import utils from './Utils'
export default function httpResponseJsunit() {
describe("HttpResponseJsunitTest", function () {
......@@ -30,7 +30,7 @@ export default function httpResponseJsunit() {
console.log("-----------------------HttpResponse result Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -44,7 +44,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResult() != null).assertTrue();
expect(data.result != null).assertTrue();
console.log("-----------------------HttpResponse result Test end-----------------------");
done();
});
......@@ -73,7 +73,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResult() != null).assertTrue();
expect(data.result != null).assertTrue();
console.log("-----------------------HttpResponse result_01 Test end-----------------------");
done();
});
......@@ -95,7 +95,7 @@ export default function httpResponseJsunit() {
console.log("-----------------------HttpResponse result_02 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -109,7 +109,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResult() != null).assertTrue();
expect(data.result != null).assertTrue();
console.log("-----------------------HttpResponse result_02 Test end-----------------------");
done();
}).catch(error => {
......@@ -134,7 +134,7 @@ export default function httpResponseJsunit() {
console.log("-----------------------HttpResponse responseCode Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -148,7 +148,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode() != 0).assertTrue();
expect(data.responseCode != 0).assertTrue();
console.log("-----------------------HttpResponse responseCode Test end-----------------------");
done();
});
......@@ -177,7 +177,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode() != 0).assertTrue();
expect(data.responseCode != 0).assertTrue();
console.log("-----------------------HttpResponse responseCode_01 Test end-----------------------");
done();
});
......@@ -200,7 +200,7 @@ export default function httpResponseJsunit() {
console.log("-----------------------HttpResponse responseCode_02 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -214,7 +214,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode() != 0).assertTrue();
expect(data.responseCode != 0).assertTrue();
console.log("-----------------------HttpResponse responseCode_02 Test end-----------------------");
done();
}).catch(error => {
......@@ -238,7 +238,7 @@ export default function httpResponseJsunit() {
console.log("-----------------------HttpResponse header Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -252,7 +252,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getHead() != null).assertTrue();
expect(data.header != null).assertTrue();
console.log("-----------------------header result Test end-----------------------");
done();
});
......@@ -281,7 +281,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getHead() != null).assertTrue();
expect(data.header != null).assertTrue();
console.log("-----------------------header header_01 Test end-----------------------");
done();
});
......@@ -304,7 +304,7 @@ export default function httpResponseJsunit() {
console.log("-----------------------HttpResponse header_02 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -318,7 +318,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getHead() != null).assertTrue();
expect(data.header != null).assertTrue();
console.log("-----------------------HttpResponse header_02 Test end-----------------------");
done();
}).catch(error => {
......@@ -342,7 +342,7 @@ export default function httpResponseJsunit() {
console.log("-----------------------HttpResponse cookies Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -356,7 +356,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getCookies != null).assertTrue();
expect(data.cookies != null).assertTrue();
console.log("-----------------------HttpResponse cookies Test end-----------------------");
done();
});
......@@ -386,7 +386,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getCookies != null).assertTrue();
expect(data.cookies != null).assertTrue();
console.log("-----------------------HttpResponse cookies_01 Test end-----------------------");
done();
});
......@@ -408,7 +408,7 @@ export default function httpResponseJsunit() {
console.log("-----------------------HttpResponse cookies_02 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: 'GET',
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -422,7 +422,7 @@ export default function httpResponseJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getCookies() != null).assertTrue();
expect(data.cookies != null).assertTrue();
console.log("-----------------------HttpResponse cookies_02 Test end-----------------------");
done();
}).catch(error => {
......
......@@ -14,12 +14,12 @@
*/
//other import
import httpJsunit from './HttpJsunit.test.ets'
import responseCodeJsunit from './ResponseCodeJsunit.test.ets';
import requestMethodJsunit from './RequestMethodJsunit.test.ets';
import httpResponseJsunit from './HttpResponseJsunit.test.ets';
import HttpRequestOptionsJsunit from './HttpRequestOptionsJsunit.test.ets';
import httpRequestJsunit from './HttpRequestJsunit.test.ets';
import httpJsunit from './HttpJsunit.test'
import responseCodeJsunit from './ResponseCodeJsunit.test';
import requestMethodJsunit from './RequestMethodJsunit.test';
import httpResponseJsunit from './HttpResponseJsunit.test';
import HttpRequestOptionsJsunit from './HttpRequestOptionsJsunit.test';
import httpRequestJsunit from './HttpRequestJsunit.test';
export default function testsuite() {
//other
......
......@@ -14,7 +14,7 @@
*/
import {describe, beforeAll, afterAll, it, expect, afterEach} from 'hypium/index';
import http from '@ohos.net.http';
import utils from './Utils.ets'
import utils from './Utils'
export default function requestMethodJsunit() {
describe("requestMethodJsunit", function () {
......@@ -30,7 +30,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_options Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "OPTIONS",
method: http.RequestMethod.OPTIONS,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -44,7 +44,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_options Test end-----------------------");
done();
});
......@@ -67,7 +67,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_options_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "OPTIONS",
method: http.RequestMethod.OPTIONS,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -81,7 +81,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_options_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -107,7 +107,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_GET Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "GET",
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -121,7 +121,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_GET Test end-----------------------");
done();
});
......@@ -144,7 +144,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_GET_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "GET",
method: http.RequestMethod.GET,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -158,7 +158,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_GET_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -182,7 +182,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_POST Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "POST",
method: http.RequestMethod.POST,
extraData: {
//tn=albumsdetail&word=渐变风格插画&fr=albumslist&album_tab=设计素材&album_id=409&rn=30
tn: "albumsdetail",
......@@ -204,7 +204,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://image.baidu.com/search/albumsdetail/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_POST Test end-----------------------");
done();
});
......@@ -227,7 +227,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_POST_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "POST",
method: http.RequestMethod.POST,
extraData: {
//tn=albumsdetail&word=渐变风格插画&fr=albumslist&album_tab=设计素材&album_id=409&rn=30
tn: "albumsdetail",
......@@ -249,7 +249,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://image.baidu.com/search/albumsdetail/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_POST_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -275,7 +275,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_TRACE Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "TRACE",
method: http.RequestMethod.TRACE,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -289,7 +289,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_TRACE Test end-----------------------");
done();
});
......@@ -311,7 +311,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_TRACE_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "TRACE",
method: http.RequestMethod.TRACE,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -325,7 +325,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_TRACE_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -353,7 +353,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_PUT Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "PUT",
method: http.RequestMethod.PUT,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -367,7 +367,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_PUT Test end-----------------------");
done();
});
......@@ -377,6 +377,8 @@ export default function requestMethodJsunit() {
}
});
/**
* @tc.number Telephony_http_HttpRequestMethod_PUT_0200
* @tc.name HttpRequestMethod::PUT
......@@ -388,7 +390,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_PUT_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "PUT",
method: http.RequestMethod.PUT,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -402,7 +404,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_PUT_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -426,7 +428,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_head Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "HEAD",
method: http.RequestMethod.HEAD,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -440,7 +442,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_head Test end-----------------------");
done();
});
......@@ -460,7 +462,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_HEAD_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "HEAD",
method: http.RequestMethod.HEAD,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -474,7 +476,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_HEAD_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -498,7 +500,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_DELETE Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "DELETE",
method: http.RequestMethod.DELETE,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -512,7 +514,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_DELETE Test end-----------------------");
done();
});
......@@ -532,7 +534,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_DELETE_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "DELETE",
method: http.RequestMethod.DELETE,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -546,7 +548,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_DELETE_01 Test end-----------------------");
done();
}).catch(error => {
......@@ -570,7 +572,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_CONNECT Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "CONNECT",
method: http.RequestMethod.CONNECT,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -584,7 +586,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions, (err, data) => {
console.log(casename + JSON.stringify(err) + " data: " + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_CONNECT Test end-----------------------");
done();
});
......@@ -604,7 +606,7 @@ export default function requestMethodJsunit() {
console.log("-----------------------HttpRequestMethod_CONNECT_01 Test is starting-----------------------");
try {
let httpRequestOptions = {
method: "CONNECT",
method: http.RequestMethod.CONNECT,
extraData: null,
header: "content-type': 'application/json",
readTimeout: 60,
......@@ -618,7 +620,7 @@ export default function requestMethodJsunit() {
}
httpRequest.request("https://www.baidu.com/", httpRequestOptions).then(data => {
console.log(casename + JSON.stringify(data));
expect(data.getResponseCode = 200).assertTrue();
expect(data.responseCode = 200).assertTrue();
console.log("-----------------------HttpRequestMethod_CONNECT_01 Test end-----------------------");
done();
}).catch(error => {
......
......@@ -121,18 +121,15 @@
"pages/index",
"pages/Button",
"pages/Blank",
"pages/DataPanel",
"pages/Divider",
"pages/Text",
"pages/RowSplit",
"pages/Scroll",
"pages/Stack",
"pages/Image",
"pages/Progress",
"pages/Qrcode",
"pages/Rating",
"pages/Span",
"pages/Slider",
"pages/Badge",
"pages/Column",
"pages/ColumnSplit",
......
/*
* 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 router from '@system.router'
@Entry
@Component
struct dataPanel_testcase {
@State width: string= "200"
@State height: string= "100"
@State active: boolean = false
private content: string = "DataPanel Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Line })
.width(this.width)
.height(this.height)
.key('DataPanel')
.onClick(() => {
router.back()
})
.closeEffect(false)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Circle})
.width(this.width)
.height(this.height)
.key('DataPanel2')
.onClick(() => {
router.back()
})
.closeEffect(true)
DataPanel({ values: [20, 40, 20], max: 100})
.width(this.width)
.height(this.height)
.key('DataPanel3')
.onClick(() => {
router.back()
})
.closeEffect(false)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct image_textcase {
@State Width: number = 0
@State height: number = 0
onPageShow() {
console.info('Image page show called');
}
onBuildDone() {
console.info('Image page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Image page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Image("/resources/rawfile/hand.png")
.matchTextDirection(false)
.fitOriginalSize(false)
.fillColor(0xCCCCCC)
.objectFit(ImageFit.Cover)
.objectRepeat(ImageRepeat.NoRepeat)
.interpolation(ImageInterpolation.None)
.renderMode(ImageRenderMode.Original)
.autoResize(false)
.syncLoad(false)
.sourceSize({ width: 200, height: 100 })
.alt("/resources/rawfile/person.png")
.key('image1')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Contain)
.objectRepeat(ImageRepeat.X)
.interpolation(ImageInterpolation.High)
.renderMode(ImageRenderMode.Template)
.key('image2')
.height(180)
.width(180)
.onComplete((msg: {
width: number,
height: number
}) => {
this.Width = msg.width
this.height = msg.height
console.info('Width ----' + this.Width)
console.info('height ----' + this.height)
})
.onError(() => {
console.info('load image fail')
})
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Fill)
.objectRepeat(ImageRepeat.Y)
.interpolation(ImageInterpolation.Low)
.key('image3')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.None)
.objectRepeat(ImageRepeat.XY)
.interpolation(ImageInterpolation.Medium)
.key('image4')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.ScaleDown)
.key('image5')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(4)
}
}
}
/*
* 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.
*/
@Entry
@Component
struct slider {
@State inSetValue: number= 40
@State outSetValue: number= 40
@State direction: Axis= Axis.Horizontal
@State Begin: number = SliderChangeMode.Begin
onPageShow() {
console.info('Slider page show called');
}
onBuildDone() {
console.info('Slider page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Slider page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Slider({
value: this.outSetValue,
min: 0,
max: 100,
step: 1,
direction: Axis.Horizontal,
reverse: false,
style: SliderStyle.OutSet
})
.blockColor('#FFFF0000')
.selectedColor('#FF0000FF')
.trackColor('#FF808080')
.minLabel('10')
.maxLabel('10')
.showTips(false)
.showSteps(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValue = value
this.Begin = mode
console.info('value: ' + value + '---mode: ' + mode)
})
.width("100")
.height("100")
.key('slider1')
Slider({
value: 40,
min: 0,
max: 100,
step: 1,
style: SliderStyle.InSet
})
.blockColor(Color.Red)
.selectedColor(Color.Blue)
.trackColor(Color.Gray)
.showTips(true)
.showSteps(true)
.key('slider2')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
......@@ -108,18 +108,15 @@
"pages/index",
"pages/Button",
"pages/Blank",
"pages/DataPanel",
"pages/Divider",
"pages/Text",
"pages/RowSplit",
"pages/Scroll",
"pages/Stack",
"pages/Image",
"pages/Progress",
"pages/Qrcode",
"pages/Rating",
"pages/Span",
"pages/Slider",
"pages/Badge",
"pages/Column",
"pages/ColumnSplit",
......
/*
* 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 router from '@system.router'
@Entry
@Component
struct dataPanel_testcase {
@State width: string= "200"
@State height: string= "100"
@State active: boolean = false
private content: string = "DataPanel Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Line })
.width(this.width)
.height(this.height)
.key('DataPanel')
.onClick(() => {
router.back()
})
.closeEffect(false)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Circle})
.width(this.width)
.height(this.height)
.key('DataPanel2')
.onClick(() => {
router.back()
})
.closeEffect(true)
DataPanel({ values: [20, 40, 20], max: 100})
.width(this.width)
.height(this.height)
.key('DataPanel3')
.onClick(() => {
router.back()
})
.closeEffect(false)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct image_textcase {
@State Width: number = 0
@State height: number = 0
onPageShow() {
console.info('Image page show called');
}
onBuildDone() {
console.info('Image page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Image page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Image("/resources/rawfile/hand.png")
.matchTextDirection(false)
.fitOriginalSize(false)
.fillColor(0xCCCCCC)
.objectFit(ImageFit.Cover)
.objectRepeat(ImageRepeat.NoRepeat)
.interpolation(ImageInterpolation.None)
.renderMode(ImageRenderMode.Original)
.autoResize(false)
.syncLoad(false)
.sourceSize({ width: 200, height: 100 })
.alt("/resources/rawfile/person.png")
.key('image1')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Contain)
.objectRepeat(ImageRepeat.X)
.interpolation(ImageInterpolation.High)
.renderMode(ImageRenderMode.Template)
.key('image2')
.height(180)
.width(180)
.onComplete((msg: {
width: number,
height: number
}) => {
this.Width = msg.width
this.height = msg.height
console.info('Width ----' + this.Width)
console.info('height ----' + this.height)
})
.onError(() => {
console.info('load image fail')
})
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Fill)
.objectRepeat(ImageRepeat.Y)
.interpolation(ImageInterpolation.Low)
.key('image3')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.None)
.objectRepeat(ImageRepeat.XY)
.interpolation(ImageInterpolation.Medium)
.key('image4')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.ScaleDown)
.key('image5')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(4)
}
}
}
/*
* 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.
*/
@Entry
@Component
struct slider {
@State inSetValue: number= 40
@State outSetValue: number= 40
@State direction: Axis= Axis.Horizontal
@State Begin: number = SliderChangeMode.Begin
onPageShow() {
console.info('Slider page show called');
}
onBuildDone() {
console.info('Slider page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Slider page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Slider({
value: this.outSetValue,
min: 0,
max: 100,
step: 1,
direction: Axis.Horizontal,
reverse: false,
style: SliderStyle.OutSet
})
.blockColor('#FFFF0000')
.selectedColor('#FF0000FF')
.trackColor('#FF808080')
.minLabel('10')
.maxLabel('10')
.showTips(false)
.showSteps(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValue = value
this.Begin = mode
console.info('value: ' + value + '---mode: ' + mode)
})
.width("100")
.height("100")
.key('slider1')
Slider({
value: 40,
min: 0,
max: 100,
step: 1,
style: SliderStyle.InSet
})
.blockColor(Color.Red)
.selectedColor(Color.Blue)
.trackColor(Color.Gray)
.showTips(true)
.showSteps(true)
.key('slider2')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
......@@ -17,6 +17,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
import observer from '@ohos.telephony.observer'
import cellular from '@ohos.telephony.data'
import radio from '@ohos.telephony.radio'
import call from '@ohos.telephony.call'
import utils from './Utils.ets'
import {SimStateData} from '@ohos.telephony.observer'
import {LockReason} from '@ohos.telephony.observer'
......
......@@ -121,18 +121,15 @@
"pages/index",
"pages/Button",
"pages/Blank",
"pages/DataPanel",
"pages/Divider",
"pages/Text",
"pages/RowSplit",
"pages/Scroll",
"pages/Stack",
"pages/Image",
"pages/Progress",
"pages/Qrcode",
"pages/Rating",
"pages/Span",
"pages/Slider",
"pages/Badge",
"pages/Column",
"pages/ColumnSplit",
......
/*
* 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 router from '@system.router'
@Entry
@Component
struct dataPanel_testcase {
@State width: string= "200"
@State height: string= "100"
@State active: boolean = false
private content: string = "DataPanel Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Line })
.width(this.width)
.height(this.height)
.key('DataPanel')
.onClick(() => {
router.back()
})
.closeEffect(false)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Circle})
.width(this.width)
.height(this.height)
.key('DataPanel2')
.onClick(() => {
router.back()
})
.closeEffect(true)
DataPanel({ values: [20, 40, 20], max: 100})
.width(this.width)
.height(this.height)
.key('DataPanel3')
.onClick(() => {
router.back()
})
.closeEffect(false)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* 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.
*/
@Entry
@Component
struct image_textcase {
@State Width: number = 0
@State height: number = 0
onPageShow() {
console.info('Image page show called');
}
onBuildDone() {
console.info('Image page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Image page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Image("/resources/rawfile/hand.png")
.matchTextDirection(false)
.fitOriginalSize(false)
.fillColor(0xCCCCCC)
.objectFit(ImageFit.Cover)
.objectRepeat(ImageRepeat.NoRepeat)
.interpolation(ImageInterpolation.None)
.renderMode(ImageRenderMode.Original)
.autoResize(false)
.syncLoad(false)
.sourceSize({ width: 200, height: 100 })
.alt("/resources/rawfile/person.png")
.key('image1')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Contain)
.objectRepeat(ImageRepeat.X)
.interpolation(ImageInterpolation.High)
.renderMode(ImageRenderMode.Template)
.key('image2')
.height(180)
.width(180)
.onComplete((msg: {
width: number,
height: number
}) => {
this.Width = msg.width
this.height = msg.height
console.info('Width ----' + this.Width)
console.info('height ----' + this.height)
})
.onError(() => {
console.info('load image fail')
})
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Fill)
.objectRepeat(ImageRepeat.Y)
.interpolation(ImageInterpolation.Low)
.key('image3')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.None)
.objectRepeat(ImageRepeat.XY)
.interpolation(ImageInterpolation.Medium)
.key('image4')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.ScaleDown)
.key('image5')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(4)
}
}
}
/*
* 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.
*/
@Entry
@Component
struct slider {
@State inSetValue: number= 40
@State outSetValue: number= 40
@State direction: Axis= Axis.Horizontal
@State Begin: number = SliderChangeMode.Begin
onPageShow() {
console.info('Slider page show called');
}
onBuildDone() {
console.info('Slider page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Slider page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Slider({
value: this.outSetValue,
min: 0,
max: 100,
step: 1,
direction: Axis.Horizontal,
reverse: false,
style: SliderStyle.OutSet
})
.blockColor('#FFFF0000')
.selectedColor('#FF0000FF')
.trackColor('#FF808080')
.minLabel('10')
.maxLabel('10')
.showTips(false)
.showSteps(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValue = value
this.Begin = mode
console.info('value: ' + value + '---mode: ' + mode)
})
.width("100")
.height("100")
.key('slider1')
Slider({
value: 40,
min: 0,
max: 100,
step: 1,
style: SliderStyle.InSet
})
.blockColor(Color.Red)
.selectedColor(Color.Blue)
.trackColor(Color.Gray)
.showTips(true)
.showSteps(true)
.key('slider2')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
......@@ -200,6 +200,11 @@ export default function radioSecondJsunit() {
* @tc.desc Test getRadioTech() api by callback .SlotId parameter input is 0
*/
it("Telephony_NetworkSearch_getRadioTech_Async_0500", 0, async function(done){
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getRadioTech(0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getRadioTech_Async_0500 fail err: ${err}`);
......@@ -219,6 +224,11 @@ export default function radioSecondJsunit() {
* @tc.desc SlotId parameter input is 0 ,Test getRadioTech() api by promise
*/
it("Telephony_NetworkSearch_getRadioTech_Promise_0500", 0, async function(done){
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
let data = await radio.getRadioTech(0);
console.log(`Telephony_NetworkSearch_getRadioTech_Promise_0500 success`);
......@@ -286,6 +296,11 @@ export default function radioSecondJsunit() {
* @tc.desc SlotId parameter input is 0, test getISOCountryCodeForNetwork() api by callback.
*/
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getISOCountryCodeForNetwork(0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0500 fail err: ${err}`);
......@@ -306,6 +321,11 @@ export default function radioSecondJsunit() {
* @tc.desc SlotId parameter input is 0, test getISOCountryCodeForNetwork() api by promise.
*/
it('Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0500', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
let data = await radio.getISOCountryCodeForNetwork(0);
console.log(
......@@ -326,6 +346,11 @@ export default function radioSecondJsunit() {
* @tc.desc SlotId parameter input is 0, test getSignalInformation() api by callback.
*/
it('Telephony_NetworkSearch_getSignalInformation_Async_0500', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
radio.getSignalInformation(0, (err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getSignalInformation_Async_0500 fail err: ${err}`);
......@@ -345,6 +370,11 @@ export default function radioSecondJsunit() {
* @tc.desc SlotId parameter input is 0, test getSignalInformation() api by promise.
*/
it('Telephony_NetworkSearch_getSignalInformation_Promise_0500', 0, async function (done) {
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
let data = await radio.getSignalInformation(0);
console.log(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册