提交 c446d3b6 编写于 作者: L luffy505

modify

Signed-off-by: Nluffy505 <zhangjuan54@huawei.com>
上级 30e837b3
......@@ -9,7 +9,7 @@
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
"target": 8
}
},
"deviceConfig": {},
......
......@@ -19,8 +19,8 @@ import emitter from '@ohos.events.emitter';
@Entry
@Component
struct EllipseExample {
@State width: string = "200px";
@State height: string = "200px";
@State width: string = "200.00px";
@State height: string = "200.00px";
onPageShow() {
console.info('[ellipse] page show called');
......
......@@ -115,7 +115,7 @@ export default function ellipseJsunit() {
try {
var eventData = {
data: {
"width": '1111111111111'
"width": '1111111111111.00px'
}
}
var innerEvent = {
......@@ -141,7 +141,7 @@ export default function ellipseJsunit() {
try {
var eventData = {
data: {
"height": '12111111111111'
"height": '12111111111111.00px'
}
}
var innerEvent = {
......@@ -167,7 +167,7 @@ export default function ellipseJsunit() {
try {
var eventData = {
data: {
"height": '-40'
"height": '-40.00px'
}
}
var innerEvent = {
......@@ -193,7 +193,7 @@ export default function ellipseJsunit() {
try {
var eventData = {
data: {
"width": '-10'
"width": '-10.00px'
}
}
var innerEvent = {
......
......@@ -9,7 +9,7 @@
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
"target": 8
}
},
"deviceConfig": {},
......
......@@ -9,7 +9,7 @@
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
"target": 8
}
},
"deviceConfig": {},
......
......@@ -20,8 +20,8 @@ import emitter from '@ohos.events.emitter';
@Component
struct PathExample {
@State commandsOne: string = 'M0 0 L900 0'
@State widthOne: number = 300
@State heightOne: number = 10
@State widthOne: string = '300.00px'
@State heightOne: string = '10.00px'
onPageShow() {
......
......@@ -63,9 +63,9 @@ export default function enableJsunit() {
try {
var eventData = {
data: {
"height": 200,
"height": '200.00px',
"commands": "M0 110 L900 0",
"width": 200,
"width": '200.00px',
}
}
var innerEvent = {
......
......@@ -9,7 +9,7 @@
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
"target": 8
}
},
"deviceConfig": {},
......
......@@ -299,6 +299,8 @@ export default function buttonJsunit() {
console.info("[testButton12] get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true)
let event = JSON.parse(eventData.data.event);
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenY));
console.info("[testButton12] get event state result is: " + Math.trunc(event.screenX));
expect(event.screenX).assertEqual(135)
expect(event.screenY).assertEqual(368.80340576171875)
expect(event.x).assertEqual(100)
......
......@@ -14,25 +14,59 @@
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import display from '@ohos.display';
import Utils from './Utils';
export default function commonJsunit() {
describe('commonTest', function () {
var dpiValue;
beforeAll(async function (done) {
console.info("commonJsunit beforeEach start");
await display.getDefaultDisplay().then(dsp => {
console.info('getDefaultDisplay id : ' + JSON.stringify(dsp));
dpiValue = dsp.densityDPI;
console.info('getDefaultDisplay dpiValue is : ' + JSON.stringify(dpiValue));
Utils.sleep(2000);
}, (err) => {
console.info('getDefaultDisplay failed, err :' + JSON.stringify(err));
})
done()
});
it('commonTest_0100', 0, async function (done) {
console.info('commonTest_0100 START');
display.getDefaultDisplay().then(dsp => {
console.info('getDefaultDisplay id : ' + JSON.stringify(dsp));
dpiValue = dsp.densityDPI;
setTimeout(() => {
console.info('commonTest_0100 START' + dpiValue);
}, 2000)
}, (err) => {
console.info('getDefaultDisplay failed, err :' + JSON.stringify(err));
})
console.info('commonTest_0100 START' + dpiValue);
var a = 90;
var ret = a * (dpiValue/160);
var b = vp2px(a);
console.info('commonTest_0100 vp2px result:' + b);
expect(b == 90).assertTrue();
console.info('commonTest_0100 vp2px result:' + ret);
expect(b == ret).assertTrue();
console.info('commonTest_0100 END');
done();
});
it('commonTest_0200', 0, async function (done) {
console.info('commonTest_0200 START');
console.info('commonTest_0200 START' + dpiValue);
var a = -90;
var ret = a * (dpiValue/160);
var b = vp2px(a);
console.info('commonTest_0200 vp2px result:' + b);
expect(b == -90).assertTrue();
console.info('commonTest_0200 vp2px result:' + ret);
expect(b == ret).assertTrue();
console.info('commonTest_0200 END');
done();
});
......@@ -50,9 +84,10 @@ export default function commonJsunit() {
it('commonTest_0400', 0, async function (done) {
console.info('commonTest_0400 START');
var a = 80;
var ret = a / (dpiValue/160);
var b = px2vp(a);
console.info('commonTest_0400 px2vp result:' + b);
expect(b == 80).assertTrue();
expect(b == ret).assertTrue();
console.info('commonTest_0400 END');
done();
});
......@@ -60,9 +95,10 @@ export default function commonJsunit() {
it('commonTest_0500', 0, async function (done) {
console.info('commonTest_0500 START');
var a = -800000000;
var ret = a / (dpiValue/160);
var b = px2vp(a);
console.info('commonTest_0500 px2vp result:' + b);
expect(b == -800000000).assertTrue();
expect(b == ret).assertTrue();
console.info('commonTest_0500 END');
done();
});
......@@ -80,13 +116,25 @@ export default function commonJsunit() {
it('commonTest_0700', 0, async function (done) {
console.info('commonTest_0700 START');
var a = 70;
var ret = a * (dpiValue/160);
var b = fp2px(a);
console.info('commonTest_0700 fp2px result:' + b);
expect(b == 70).assertTrue();
expect(b == ret).assertTrue();
console.info('commonTest_0700 END');
done();
});
it('commonTest_0800', 0, async function (done) {
console.info('commonTest_0800 START');
var a = -70;
var ret = a * (dpiValue/160);
var b = fp2px(a);
console.info('commonTest_0800 fp2px result:' + b);
expect(b == ret).assertTrue();
console.info('commonTest_0800 END');
done();
});
it('commonTest_0900', 0, async function (done) {
console.info('commonTest_0900 START');
var a = '70';
......@@ -100,19 +148,21 @@ export default function commonJsunit() {
it('commonTest_1000', 0, async function (done) {
console.info('commonTest_1000 START');
var a = 60;
var ret = a / (dpiValue/160);
var b = px2fp(a);
console.info('commonTest_1000 px2fp result:' + b);
expect(b == 60).assertTrue();
expect(b == ret).assertTrue();
console.info('commonTest_1000 END');
done();
});
it('commonTest_1100', 0, async function (done) {
console.info('commonTest_1100 START');
var a = -6000000000;
var a = -60;
var ret = a / (dpiValue/160);
var b = px2fp(a);
console.info('commonTest_1100 px2fp result:' + b);
expect(b == -6000000000).assertTrue();
expect(b == ret).assertTrue();
console.info('commonTest_1100 END');
done();
});
......@@ -127,25 +177,6 @@ export default function commonJsunit() {
done();
});
it('commonTest_1300', 0, async function (done) {
console.info('commonTest_1300 START');
var a = 50;
var b = lpx2px(a);
console.info('commonTest_1300 lpx2px result:' + b);
expect(b == 50).assertTrue();
console.info('commonTest_1300 END');
done();
});
it('commonTest_1400', 0, async function (done) {
console.info('commonTest_1400 START');
var a = -500000000;
var b = lpx2px(a);
console.info('commonTest_1400 lpx2px result:' + b);
expect(b == -500000000).assertTrue();
console.info('commonTest_1400 END');
done();
});
it('commonTest_1500', 0, async function (done) {
console.info('commonTest_1500 START');
......@@ -157,26 +188,6 @@ export default function commonJsunit() {
done();
});
it('commonTest_1600', 0, async function (done) {
console.info('commonTest_1600 START');
var a = 40;
var b = px2lpx(a);
console.info('commonTest_1600 px2lpx result:' + b);
expect(b == 40).assertTrue();
console.info('commonTest_1600 END');
done();
});
it('commonTest_1700', 0, async function (done) {
console.info('commonTest_1700 START');
var a = -400000;
var b = px2lpx(a);
console.info('commonTest_1700 px2lpx result:' + b);
expect(b == -400000).assertTrue();
console.info('commonTest_1700 END');
done();
});
it('commonTest_1800', 0, async function (done) {
console.info('commonTest_1800 START');
var a = '40';
......
......@@ -9,7 +9,7 @@
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
"target": 8
}
},
"deviceConfig": {},
......
......@@ -44,6 +44,7 @@ struct LoadingProgressExample {
Text('Orbital LoadingProgress ')
.fontSize(19)
.fontColor(0xCCCCCC)
.height(50)
.width('90%')
.key('LP')
LoadingProgress()
......
......@@ -72,7 +72,7 @@ export default function loadingProgressJsunit() {
let strJson = getInspectorByKey('LP');
let obj = JSON.parse(strJson);
console.info("testLoadingProgress_300 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.height).assertEqual("22.000000");
expect(obj.$attrs.height).assertEqual("50.00px");
console.info('testLoadingProgress_300 END');
done();
});
......
......@@ -9,7 +9,7 @@
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
"target": 8
}
},
"deviceConfig": {},
......
......@@ -127,8 +127,6 @@ struct text_textcase {
.zIndex(this.zIndex)
.fontColor(this.fontColor)
.fontSize(this.fontSize)
.minFontSize(this.minFontSize)
.letterSpacing(this.letterSpacing)
.maxFontSize(this.maxFontSize)
.fontWeight(this.fontWeight)
.fontStyle(this.fontStyle)
......
......@@ -65,55 +65,6 @@ export default function textJsunit() {
let strJson = getInspectorByKey('Text');
let obj = JSON.parse(strJson);
console.info("cd text component obj is: " + JSON.stringify(obj));
console.log("cd text type" + JSON.stringify(obj.$type));
console.log("cd text height" + JSON.stringify(obj.$attrs.height));
console.log("cd text width" + JSON.stringify(obj.$attrs.width));
console.log("cd text padding" + JSON.stringify(obj.$attrs.padding));
console.log("cd text constraintSize" + JSON.stringify(obj.$attrs.constraintSize));
console.log("cd text opacity" + JSON.stringify(obj.$attrs.opacity));
console.log("cd text align" + JSON.stringify(obj.$attrs.align));
console.log("cd text markAnchor type1" + typeof ({
"x": "50.00vp", "y": "50.00vp"
}));
console.log("cd text markAnchor1" + JSON.stringify({
"x": "50.00vp", "y": "50.00vp"
}));
console.log("cd text markAnchor type" + typeof (obj.$attrs.markAnchor));
console.log("cd text markAnchor" + JSON.stringify(obj.$attrs.markAnchor));
console.log("cd text offset" + JSON.stringify(obj.$attrs.offset));
console.log("cd text position" + JSON.stringify(obj.$attrs.position));
console.log("cd text flexGrow" + JSON.stringify(obj.$attrs.flexGrow));
console.log("cd text flexShrink" + JSON.stringify(obj.$attrs.flexShrink));
console.log("cd text alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text borderStyle" + JSON.stringify(obj.$attrs.borderStyle));
console.log("cd text borderRadius" + JSON.stringify(obj.$attrs.borderRadius));
console.log("cd text borderWidth" + JSON.stringify(obj.$attrs.borderWidth));
console.log("cd text borderColor" + JSON.stringify(obj.$attrs.borderColor));
console.log("cd text backgroundColor" + JSON.stringify(obj.$attrs.backgroundColor));
console.log("cd text enabled" + JSON.stringify(obj.$attrs.enabled));
console.log("cd text zIndex" + JSON.stringify(obj.$attrs.zIndex));
console.log("cd text fontColor" + JSON.stringify(obj.$attrs.fontColor));
console.log("cd text visibility" + JSON.stringify(obj.$attrs.visibility));
console.log("cd text fontSize" + JSON.stringify(obj.$attrs.fontSize));
console.log("cd text minFontSize" + JSON.stringify(obj.$attrs.minFontSize));
console.log("cd text letterSpacing" + JSON.stringify(obj.$attrs.letterSpacing));
console.log("cd text maxFontSize" + JSON.stringify(obj.$attrs.maxFontSize));
console.log("cd text fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text fontStyle" + JSON.stringify(obj.$attrs.fontStyle));
console.log("cd text fontFamily" + JSON.stringify(obj.$attrs.fontFamily));
console.log("cd text textAlign" + JSON.stringify(obj.$attrs.textAlign));
console.log("cd text textOverflow" + JSON.stringify(obj.$attrs.textOverflow));
console.log("cd text lineHeight" + JSON.stringify(obj.$attrs.lineHeight));
console.log("cd text baselineOffset" + JSON.stringify(obj.$attrs.baselineOffset));
console.log("cd text maxLines" + JSON.stringify(obj.$attrs.maxLines));
console.log("cd text textCase" + JSON.stringify(obj.$attrs.textCase));
console.log("cd text decoration" + JSON.stringify(obj.$attrs.decoration));
console.log("cd text decoration1" + JSON.stringify(JSON.stringify({
type: "TextDecorationType.Underline", color: "#FFFF0000"
})));
console.log("cd text direction" + JSON.stringify(obj.$attrs.direction));
console.log("cd text aspectRatio" + JSON.stringify(obj.$attrs.aspectRatio));
console.log("cd text fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$type).assertEqual('Text')
expect(obj.$attrs.width).assertEqual('200.00vp')
expect(obj.$attrs.padding).assertEqual('5.00vp')
......@@ -138,7 +89,7 @@ export default function textJsunit() {
expect(obj.$attrs.zIndex).assertEqual(1)
expect(obj.$attrs.fontColor).assertEqual("#FF000000")
expect(obj.$attrs.visibility).assertEqual("Visibility.Visible")
expect(obj.$attrs.fontSize).assertEqual("15.00px")
expect(obj.$attrs.fontSize).assertEqual("15.00fp")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Bold")
expect(obj.$attrs.fontStyle).assertEqual("FontStyle.Italic")
expect(obj.$attrs.fontFamily).assertEqual("sans-serif")
......@@ -167,23 +118,6 @@ export default function textJsunit() {
let strJson = getInspectorByKey('Text1');
let obj = JSON.parse(strJson);
console.info("cd text1 component obj is: " + JSON.stringify(obj));
console.log("cd text1 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text1 alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text1 borderStyle" + JSON.stringify(obj.$attrs.borderStyle));
console.log("cd text1 enabled" + JSON.stringify(obj.$attrs.enabled));
console.log("cd text1 visibility" + JSON.stringify(obj.$attrs.visibility));
console.log("cd text1 fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text1 textAlign" + JSON.stringify(obj.$attrs.textAlign));
console.log("cd text1 textOverflow" + JSON.stringify(obj.$attrs.textOverflow));
console.log("cd text1 direction" + JSON.stringify(obj.$attrs.direction));
console.log("cd text1 textCase" + JSON.stringify(obj.$attrs.textCase));
console.log("cd text1 decoration" + JSON.stringify(obj.$attrs.decoration));
console.log("cd text1 decoration1" + JSON.stringify(JSON.stringify({
type: "TextDecorationType.LineThrough", color: "#FFFF0000"
})));
console.log("cd text1 fontColor" + JSON.stringify(obj.$attrs.fontColor));
console.log("cd text padding" + JSON.stringify(obj.$attrs.padding));
console.log("cd text margin" + JSON.stringify(obj.$attrs.margin))
expect(obj.$attrs.direction).assertEqual("Direction.Ltr")
expect(obj.$attrs.align).assertEqual("Alignment.Start")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Start")
......@@ -210,20 +144,6 @@ export default function textJsunit() {
let strJson = getInspectorByKey('Text2');
let obj = JSON.parse(strJson);
console.info("cd text2 component obj is: " + JSON.stringify(obj));
console.log("cd text2 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text2 alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text2 borderStyle" + JSON.stringify(obj.$attrs.borderStyle));
console.log("cd text2 visibility" + JSON.stringify(obj.$attrs.visibility));
console.log("cd text2 fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text2 textAlign" + JSON.stringify(obj.$attrs.textAlign));
console.log("cd text2 textOverflow" + JSON.stringify(obj.$attrs.textOverflow));
console.log("cd text2 direction" + JSON.stringify(obj.$attrs.direction));
console.log("cd text2 textCase" + JSON.stringify(obj.$attrs.textCase));
console.log("cd text2 decoration" + JSON.stringify(obj.$attrs.decoration));
console.log("cd text2 decoration1" + JSON.stringify(JSON.stringify({
type: "TextDecorationType.Noneh", color: "#FFFF0000"
})));
console.log("cd text2 fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$attrs.direction).assertEqual("Direction.Rtl")
expect(obj.$attrs.align).assertEqual("Alignment.TopEnd")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Center")
......
......@@ -9,7 +9,7 @@
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
"target": 8
}
},
"deviceConfig": {},
......
......@@ -9,7 +9,7 @@
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
"target": 8
}
},
"deviceConfig": {},
......
......@@ -8,7 +8,7 @@
},
"apiVersion": {
"compatible": 4,
"target": 5
"target": 8
}
},
"deviceConfig": {},
......
......@@ -8,7 +8,7 @@
},
"apiVersion": {
"compatible": 4,
"target": 5
"target": 8
}
},
"deviceConfig": {},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册