From d31663d568d672c58a0e6003601c8ed1dd2ed3c6 Mon Sep 17 00:00:00 2001 From: bayanxing Date: Mon, 26 Sep 2022 16:59:59 +0800 Subject: [PATCH] code check Signed-off-by: bayanxing --- .../src/main/ets/MainAbility/pages/common.ets | 57 ++++++++++++++++++- .../entry/src/main/ets/test/List.test.ets | 5 +- .../src/main/ets/test/configuration.test.ets | 51 +++++++++++++++++ 3 files changed, 107 insertions(+), 6 deletions(-) create mode 100644 arkui/ace_ets_component_attrlack/entry/src/main/ets/test/configuration.test.ets diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets index b413cc63f..ee39670a2 100644 --- a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets @@ -14,7 +14,7 @@ */ import Log from '../common/Log.ets'; - +import events_emitter from '@ohos.events.emitter'; const TAG = 'ets_apiLack_add'; @Entry @@ -118,7 +118,26 @@ export default struct CommonColorMode { .textOverflow({ overflow: TextOverflow.None }) .key("areaText") .onClick((event) => { - Log.showInfo(TAG, 'area: ' + JSON.stringify(event.target.area)) + Log.showInfo(TAG, 'JSON.stringify area : ' + JSON.stringify(event.target.area)) + const area = JSON.stringify(event.target.area) + console.info("area value is: " + area) + console.info("area.position value is: " + area.position) + console.info("area.position value is: " + area.position.x) + try { + var backData = { + data: { + "STATUS": area + } + } + let backEvent = { + eventId: 60312, + priority: events_emitter.EventPriority.LOW + } + console.info("areaValue start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("areaValue emit action state err: " + JSON.stringify(err.message)) + } }) Text("common-Repeat") .width(320) @@ -263,6 +282,23 @@ export default struct CommonColorMode { .key("touchesText") .onTouch((event) => { Log.showInfo(TAG, 'touches: ' + JSON.stringify(event.touches)) + const touches = JSON.stringify(event.touches) + const touchesValue = JSON.parse(touches) + try { + var backData1 = { + data: { + "STATUS": touchesValue + } + } + let backEvent1 = { + eventId: 60313, + priority: events_emitter.EventPriority.LOW + } + console.info("touchesValue start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (err) { + console.info("touchesValue emit action state err: " + JSON.stringify(err.message)) + } }) Text("common-ChangedTouches") @@ -280,6 +316,23 @@ export default struct CommonColorMode { .key("changedTouchesText") .onTouch((event) => { Log.showInfo(TAG, 'changedTouches: ' + JSON.stringify(event.changedTouches)) + const changedTouches = JSON.stringify(event.changedTouches) + const changedTouchesValue = JSON.parse(changedTouches) + try { + var backData2 = { + data: { + "STATUS": changedTouches + } + } + let backEvent2 = { + eventId: 60314, + priority: events_emitter.EventPriority.LOW + } + console.info("touchesValue start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (err) { + console.info("touchesValue emit action state err: " + JSON.stringify(err.message)) + } }) Text("common-KeyCode") diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets index 45ccbfd33..674ff335a 100644 --- a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets @@ -23,6 +23,7 @@ import canvasActualBoundingBoxAscentJsunit from './canvas.test.ets'; import checkBoxGroupJsunit from './checkBox.test.ets'; import checkBoxGroupPartJsunit from './checkBoxGroup.test.ets'; import commonColorModeJsunit from './common.test.ets'; +import configurationApiTest from './configuration.test.ets' import datePickerLunarJsunit from './datePicker.test.ets'; import enumsCancelJsunit from './enums.test.ets'; import gestureParallelJsunit from './gesture.test.ets'; @@ -45,9 +46,7 @@ import copyOptionJsunit from './copyOption.test.ets'; export default function testsuite() { animatorOnframeJsunit() - curvesEaseOutJsunit() routerStandardJsunit() - uiAppearanceALWAYS_DARKJsunit() appVersionCodeJsunit() alertDialogCenterStartJsunit() canvasActualBoundingBoxAscentJsunit() @@ -55,13 +54,11 @@ export default function testsuite() { checkBoxGroupPartJsunit() commonColorModeJsunit() datePickerLunarJsunit() - enumsCancelJsunit() gestureParallelJsunit() listtestIdleJsunit() loadingProgressCircularJsunit() progressScaleCountJsunit() radioGroupJsunit() - refreshDragJsunit() sidebarIconsJsunit() sliderMovingJsunit() stateManagementDARKJsunit() diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/configuration.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/configuration.test.ets new file mode 100644 index 000000000..64aaffafe --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/configuration.test.ets @@ -0,0 +1,51 @@ +// @ts-nocheck +/** + * 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 configuration from '@system.configuration'; +import router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets' + +export default function configurationApiTest() { + describe('configurationApiTest', function () { + beforeEach(async function (done) { + await Utils.sleep(1000); + console.info("appVersionCode after each called"); + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("appVersionCode after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name colorMode001 + * @tc.desic aceColorMode001EtsTest0001 + */ + it('colorMode001', 0, async function (done) { + console.info('colorMode001 test START'); + const localeInfo = configuration.getLocale(); + console.info("[configuration.getLocale] localeInfo: " + JSON.stringify(localeInfo)); + console.info("[configuration.getLocale] colorMode: " + localeInfo.colorMode); + console.info("[configuration.getLocale] fontScale: " + localeInfo.fontScale); + expect(localeInfo.colorMode).assertEqual('COLOR_MODE_LIGHT'); + expect(localeInfo.fontScale).assertEqual('ltr'); + console.info('testConfigurationGetLocale END'); + }); + }) +} -- GitLab