提交 b02d8a40 编写于 作者: B bayanxing

ets api push

Signed-off-by: Nbayanxing <bayanxing@kaihong.com>
上级 2e60c5a4
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets';
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct CommonBackgroundBlurStyle {
@State value: string = ''
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CommonBackgroundBlurStyle start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear CommonBackgroundBlurStyle end`)
}
onPageHide(): void {
Log.showInfo(TAG, `onPageHide CommonBackgroundBlurStyle start`)
}
onBackPress(): void {
Log.showInfo(TAG, `onBackPress CommonBackgroundBlurStyle start`)
}
@Styles pressedStyles() {
.backgroundColor('red')
.opacity(1)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("common-BackgroundBlurStyle")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("backgroundBlurStyleText")
.backgroundBlurStyle(BlurStyle.Thick)
Text("common-BorderImage")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("borderImageText")
.borderImage({
source: {
angle: 90,
direction: GradientDirection.Left,
colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]]
},
slice: { top: 10, bottom: 10, left: 10, right: 10 },
width: { top: "10px", bottom: "10px", left: "10px", right: "10px" },
repeat: RepeatMode.Stretch,
fill: false
})
Text("common-HoverEffectHighlight")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("hoverEffectText")
.hoverEffect(HoverEffect.Highlight)
Text("common-HoverEffectScale")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("hoverEffectText")
.hoverEffect(HoverEffect.Scale)
Text("common-OnKeyEvent")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onKeyEventText")
Button('common-OnKeyEvent')
.onKeyEvent((event: KeyEvent) => {
if (event.type === KeyType.Down) {
Log.showInfo(TAG, `Down`)
}
if (event.type === KeyType.Up) {
Log.showInfo(TAG, `Up`)
}
Log.showInfo(TAG, 'KeyType:' + event.type + ';keyCode:' + event.keyCode + ';keyText:' + event.keyText)
})
Text("common-TabIndex")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("tabIndexText")
.tabIndex(1)
Text("common-ParallelGesture" + '\n' + this.value)
.width(320)
.height(100)
.fontSize(12)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(15)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("parallelGestureText")
.gesture(TapGesture().onAction(() => {
this.value = 'gesture onAction'
}))
//设置为priorityGesture时,会优先识别该绑定手势忽略内部gesture手势
.priorityGesture(TapGesture().onAction((event: GestureEvent) => {
this.value = 'priorityGesture onAction' + '\ncomponent globalPos:('
+ event.target.area.globalPosition.x + ',' + event.target.area.globalPosition.y + ')\nwidth:'
+ event.target.area.width + '\nheight:' + event.target.area.height
}), GestureMask.IgnoreInternal)
Text("common-Sepia")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("sepiaText")
.backgroundColor('#E78282')
.sepia(1)
Button('Button 1')
.id('target')
Text("common-AlignRules")
.width(260)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("alignRulesText")
.alignRules({
top: { anchor: 'target', align: VerticalAlign.Bottom },
right: { anchor: "target", align: HorizontalAlign.Center }
})
Text("common-StateStyles")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("stateStylesText")
.stateStyles({
pressed: this.pressedStyles,
})
Text("common-OnVisibleAreaChange")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onVisibleAreaChangeText")
Text("common-OnPageHide")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onPageHideText")
Text("common-OnBackPress")
.width(320)
.height(50)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("onBackPressText")
}.width("100%").height("100%")
}
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets';
let varA = AppStorage.Link('varA')
//Environment.EnvProp("accessibilityEnabled", "default")
//
//PersistentStorage.PersistProp("highScore", 0)
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct Common_ts_ets_apiStaticClear {
@StorageLink('varA') varA: number = 2
private label: string = 'count'
@StorageLink('highScore') highScore: number = 0
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear Common_ts_ets_apiStaticClear start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear Common_ts_ets_apiStaticClear end`)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.label}: ${this.varA}`)
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("labelA")
.onClick(() => {
AppStorage.Set<number>('varA', AppStorage.Get<number>('varA') + 1)
})
Text("common_ts_ets_api-StaticClear")
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("staticClearText")
.onClick(() => {
AppStorage.staticClear()
})
Text("common_ts_ets_api-EnvProp")
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("EnvPropText")
.onClick(() => {
var enable = AppStorage.Get("accessibilityEnabled");
console.log(enable.toString())
})
Text(`common_ts_ets_api-PersistProp : ${this.highScore}`)
.width(320)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("PersistPropText")
.onClick(() => {
this.highScore = this.highScore + 1
})
}.width("100%").height("100%")
}
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets';
//import Curves from '@ohos.curves'
const TAG = 'ets_apiLack_add';
@Entry
@Component
export default struct CurvesSteps {
aboutToAppear() {
Log.showInfo(TAG, `aboutToAppear CurvesSteps start`)
}
aboutToDisappear() {
Log.showInfo(TAG, `aboutToDisAppear CurvesSteps end`)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text("curves-Steps")
.width(100)
.height(70)
.fontSize(20)
.opacity(1)
.align(Alignment.TopStart)
.fontColor(0xCCCCCC)
.lineHeight(25)
.border({ width: 1 })
.padding(10)
.textAlign(TextAlign.Center)
.textOverflow({ overflow: TextOverflow.None })
.key("stepsText")
// .onClick(() => {
// let curve = Curves.steps(1, true)
// })
}.width("100%").height("100%")
}
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function commonBackgroundBlurStyleJsunit() {
describe('commonBackgroundBlurStyleTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/common',
}
try {
router.clear();
let pages = router.getState();
console.info("get common state success " + JSON.stringify(pages));
if (!("common" == pages.name)) {
console.info("get common state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push common page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push common page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("commonBackgroundBlurStyle after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testcommonBackgroundBlurStyle0001
* @tc.desic acecommonBackgroundBlurStyleEtsTest0001
*/
it('testcommonBackgroundBlurStyle0001', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.width).assertEqual("320.00vp");
console.info("[testcommonBackgroundBlurStyle0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testcommonBackgroundBlurStyle0002
* @tc.desic acecommonBackgroundBlurStyleEtsTest0002
*/
it('testcommonBackgroundBlurStyle0002', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.height).assertEqual("50.00vp");
console.info("[testcommonBackgroundBlurStyle0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testcommonBackgroundBlurStyle0003
* @tc.desic acecommonBackgroundBlurStyleEtsTest0003
*/
it('testcommonBackgroundBlurStyle0003', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0003] component fontSize strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontSize).assertEqual("20.00fp");
console.info("[testcommonBackgroundBlurStyle0003] fontSize value :" + obj.$attrs.fontSize);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testcommonBackgroundBlurStyle0004
* @tc.desic acecommonBackgroundBlurStyleEtsTest0004
*/
it('testcommonBackgroundBlurStyle0004', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0004] component opacity strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.opacity).assertEqual(1);
console.info("[testcommonBackgroundBlurStyle0004] opacity value :" + obj.$attrs.opacity);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testcommonBackgroundBlurStyle0005
* @tc.desic acecommonBackgroundBlurStyleEtsTest0005
*/
it('testcommonBackgroundBlurStyle0005', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0005] component align strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.align).assertEqual("Alignment.TopStart");
console.info("[testcommonBackgroundBlurStyle0005] align value :" + obj.$attrs.align);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testcommonBackgroundBlurStyle0006
* @tc.desic acecommonBackgroundBlurStyleEtsTest0006
*/
it('testcommonBackgroundBlurStyle0006', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0006] component fontColor strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC");
console.info("[testcommonBackgroundBlurStyle0006] fontColor value :" + obj.$attrs.fontColor);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testcommonBackgroundBlurStyle0007
* @tc.desic acecommonBackgroundBlurStyleEtsTest0007
*/
it('testcommonBackgroundBlurStyle0007', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle0007 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0007] component lineHeight strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.lineHeight).assertEqual("25.00fp");
console.info("[testcommonBackgroundBlurStyle0007] lineHeight value :" + obj.$attrs.lineHeight);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testcommonBackgroundBlurStyle0009
* @tc.desic acecommonBackgroundBlurStyleEtsTest0009
*/
it('testcommonBackgroundBlurStyle0009', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0009] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.padding).assertEqual("10.00vp");
console.info("[testcommonBackgroundBlurStyle0009] padding value :" + obj.$attrs.padding);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testcommonBackgroundBlurStyle0010
* @tc.desic acecommonBackgroundBlurStyleEtsTest0010
*/
it('testcommonBackgroundBlurStyle0010', 0, async function (done) {
console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle0010 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('backgroundBlurStyleText');
console.info("[testcommonBackgroundBlurStyle0010] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left");
console.info("[testcommonBackgroundBlurStyle0010] textAlign value :" + obj.$attrs.textAlign);
done();
});
})
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function common_ts_ets_apiStaticClearJsunit() {
describe('common_ts_ets_apiStaticClearTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/common_ts_ets_api',
}
try {
router.clear();
let pages = router.getState();
console.info("get common_ts_ets_api state success " + JSON.stringify(pages));
if (!("common_ts_ets_api" == pages.name)) {
console.info("get common_ts_ets_api state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push common_ts_ets_api page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push common_ts_ets_api page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("common_ts_ets_apiStaticClear after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testcommon_ts_ets_apiStaticClear0001
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0001
*/
it('testcommon_ts_ets_apiStaticClear0001', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.width).assertEqual("320.00vp");
console.info("[testcommon_ts_ets_apiStaticClear0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testcommon_ts_ets_apiStaticClear0002
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0002
*/
it('testcommon_ts_ets_apiStaticClear0002', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.height).assertEqual("70.00vp");
console.info("[testcommon_ts_ets_apiStaticClear0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testcommon_ts_ets_apiStaticClear0003
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0003
*/
it('testcommon_ts_ets_apiStaticClear0003', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0003] component fontSize strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontSize).assertEqual("20.00fp");
console.info("[testcommon_ts_ets_apiStaticClear0003] fontSize value :" + obj.$attrs.fontSize);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testcommon_ts_ets_apiStaticClear0004
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0004
*/
it('testcommon_ts_ets_apiStaticClear0004', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0004] component opacity strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.opacity).assertEqual(1);
console.info("[testcommon_ts_ets_apiStaticClear0004] opacity value :" + obj.$attrs.opacity);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testcommon_ts_ets_apiStaticClear0005
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0005
*/
it('testcommon_ts_ets_apiStaticClear0005', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0005] component align strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.align).assertEqual("Alignment.TopStart");
console.info("[testcommon_ts_ets_apiStaticClear0005] align value :" + obj.$attrs.align);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testcommon_ts_ets_apiStaticClear0006
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0006
*/
it('testcommon_ts_ets_apiStaticClear0006', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0006] component fontColor strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC");
console.info("[testcommon_ts_ets_apiStaticClear0006] fontColor value :" + obj.$attrs.fontColor);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testcommon_ts_ets_apiStaticClear0007
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0007
*/
it('testcommon_ts_ets_apiStaticClear0007', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear0007 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0007] component lineHeight strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.lineHeight).assertEqual("25.00fp");
console.info("[testcommon_ts_ets_apiStaticClear0007] lineHeight value :" + obj.$attrs.lineHeight);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testcommon_ts_ets_apiStaticClear0009
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0009
*/
it('testcommon_ts_ets_apiStaticClear0009', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0009] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.padding).assertEqual("10.00vp");
console.info("[testcommon_ts_ets_apiStaticClear0009] padding value :" + obj.$attrs.padding);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testcommon_ts_ets_apiStaticClear0010
* @tc.desic acecommon_ts_ets_apiStaticClearEtsTest0010
*/
it('testcommon_ts_ets_apiStaticClear0010', 0, async function (done) {
console.info('common_ts_ets_apiStaticClear testcommon_ts_ets_apiStaticClear0010 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('staticClearText');
console.info("[testcommon_ts_ets_apiStaticClear0010] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left");
console.info("[testcommon_ts_ets_apiStaticClear0010] textAlign value :" + obj.$attrs.textAlign);
done();
});
})
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function curvesStepsJsunit() {
describe('curvesStepsTest', function () {
/**
* run before testcase
*/
beforeAll(async function (done) {
console.info('[curvesStepsTest] before each called')
let result;
let options = {
uri: 'pages/curves'
}
try {
result = router.push(options)
console.info("push curves page success " + JSON.stringify(result));
} catch (err) {
console.error("push curves page error " + JSON.stringify(result));
}
await Utils.sleep(4000)
done()
});
/**
* run after testcase
*/
afterAll(async function () {
console.info('[curvesStepsTest] after each called')
await Utils.sleep(1000)
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testcurvesSteps0001
* @tc.desic acecurvesStepsEtsTest0001
*/
it('testcurvesSteps0001', 0, async function (done) {
console.info('curvesSteps testcurvesSteps0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.width).assertEqual("100.00vp");
console.info("[testcurvesSteps0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testcurvesSteps0002
* @tc.desic acecurvesStepsEtsTest0002
*/
it('testcurvesSteps0002', 0, async function (done) {
console.info('curvesSteps testcurvesSteps0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.height).assertEqual("70.00vp");
console.info("[testcurvesSteps0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testcurvesSteps0003
* @tc.desic acecurvesStepsEtsTest0003
*/
it('testcurvesSteps0003', 0, async function (done) {
console.info('curvesSteps testcurvesSteps0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0003] component fontSize strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontSize).assertEqual("20.00fp");
console.info("[testcurvesSteps0003] fontSize value :" + obj.$attrs.fontSize);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testcurvesSteps0004
* @tc.desic acecurvesStepsEtsTest0004
*/
it('testcurvesSteps0004', 0, async function (done) {
console.info('curvesSteps testcurvesSteps0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0004] component opacity strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.opacity).assertEqual(1);
console.info("[testcurvesSteps0004] opacity value :" + obj.$attrs.opacity);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testcurvesSteps0005
* @tc.desic acecurvesStepsEtsTest0005
*/
it('testcurvesSteps0005', 0, async function (done) {
console.info('curvesSteps testcurvesSteps0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0005] component align strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.align).assertEqual("Alignment.TopStart");
console.info("[testcurvesSteps0005] align value :" + obj.$attrs.align);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testcurvesSteps0006
* @tc.desic acecurvesStepsEtsTest0006
*/
it('testcurvesSteps0006', 0, async function (done) {
console.info('curvesSteps testcurvesSteps0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0006] component fontColor strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC");
console.info("[testcurvesSteps0006] fontColor value :" + obj.$attrs.fontColor);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testcurvesSteps0007
* @tc.desic acecurvesStepsEtsTest0007
*/
it('testcurvesSteps0007', 0, async function (done) {
console.info('curvesSteps testcurvesSteps0007 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0007] component lineHeight strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.lineHeight).assertEqual("25.00fp");
console.info("[testcurvesSteps0007] lineHeight value :" + obj.$attrs.lineHeight);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testcurvesSteps0009
* @tc.desic acecurvesStepsEtsTest0009
*/
it('testcurvesSteps0009', 0, async function (done) {
console.info('curvesSteps testcurvesSteps009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0009] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.padding).assertEqual("10.00vp");
console.info("[testcurvesSteps0009] padding value :" + obj.$attrs.padding);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testcurvesSteps0010
* @tc.desic acecurvesStepsEtsTest0010
*/
it('testcurvesSteps0010', 0, async function (done) {
console.info('curvesSteps testcurvesSteps0010 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('stepsText');
console.info("[testcurvesSteps0010] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left");
console.info("[testcurvesSteps0010] textAlign value :" + obj.$attrs.textAlign);
done();
});
})
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function domCreateElementJsunit() {
describe('domCreateElementTest', function () {
beforeAll(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/dom',
}
try {
router.clear();
let pages = router.getState();
console.info("get dom state success " + JSON.stringify(pages));
if (!("dom" == pages.name)) {
console.info("get dom state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push dom page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push dom page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("domCreateElement after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0001
* @tc.name testdomCreateElement0001
* @tc.desic acedomCreateElementEtsTest0001
*/
it('testdomCreateElement0001', 0, async function (done) {
console.info('domCreateElement testdomCreateElement0001 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0001] component width strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.width).assertEqual("100.00vp");
console.info("[testdomCreateElement0001] width value :" + obj.$attrs.width);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0002
* @tc.name testdomCreateElement0002
* @tc.desic acedomCreateElementEtsTest0002
*/
it('testdomCreateElement0002', 0, async function (done) {
console.info('domCreateElement testdomCreateElement0002 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0002] component height strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.height).assertEqual("70.00vp");
console.info("[testdomCreateElement0002] height value :" + obj.$attrs.height);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0003
* @tc.name testdomCreateElement0003
* @tc.desic acedomCreateElementEtsTest0003
*/
it('testdomCreateElement0003', 0, async function (done) {
console.info('domCreateElement testdomCreateElement0003 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0003] component fontSize strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontSize).assertEqual("20.00fp");
console.info("[testdomCreateElement0003] fontSize value :" + obj.$attrs.fontSize);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0004
* @tc.name testdomCreateElement0004
* @tc.desic acedomCreateElementEtsTest0004
*/
it('testdomCreateElement0004', 0, async function (done) {
console.info('domCreateElement testdomCreateElement0004 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0004] component opacity strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.opacity).assertEqual(1);
console.info("[testdomCreateElement0004] opacity value :" + obj.$attrs.opacity);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0005
* @tc.name testdomCreateElement0005
* @tc.desic acedomCreateElementEtsTest0005
*/
it('testdomCreateElement0005', 0, async function (done) {
console.info('domCreateElement testdomCreateElement0005 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0005] component align strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.align).assertEqual("Alignment.TopStart");
console.info("[testdomCreateElement0005] align value :" + obj.$attrs.align);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0006
* @tc.name testdomCreateElement0006
* @tc.desic acedomCreateElementEtsTest0006
*/
it('testdomCreateElement0006', 0, async function (done) {
console.info('domCreateElement testdomCreateElement0006 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0006] component fontColor strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC");
console.info("[testdomCreateElement0006] fontColor value :" + obj.$attrs.fontColor);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0007
* @tc.name testdomCreateElement0007
* @tc.desic acedomCreateElementEtsTest0007
*/
it('testdomCreateElement0007', 0, async function (done) {
console.info('domCreateElement testdomCreateElement0007 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0007] component lineHeight strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.lineHeight).assertEqual("25.00fp");
console.info("[testdomCreateElement0007] lineHeight value :" + obj.$attrs.lineHeight);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0009
* @tc.name testdomCreateElement0009
* @tc.desic acedomCreateElementEtsTest0009
*/
it('testdomCreateElement0009', 0, async function (done) {
console.info('domCreateElement testdomCreateElement009 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0009] component padding strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.padding).assertEqual("10.00vp");
console.info("[testdomCreateElement0009] padding value :" + obj.$attrs.padding);
done();
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testdomCreateElement0010
* @tc.desic acedomCreateElementEtsTest0010
*/
it('testdomCreateElement0010', 0, async function (done) {
console.info('domCreateElement testdomCreateElement0010 START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('createElementText');
console.info("[testdomCreateElement0010] component textAlign strJson:" + strJson);
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left");
console.info("[testdomCreateElement0010] textAlign value :" + obj.$attrs.textAlign);
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册