未验证 提交 3fd36c98 编写于 作者: O openharmony_ci 提交者: Gitee

!3220 适配ace sys api

Merge pull request !3220 from zj/OpenHarmony-3.1-Release
......@@ -59,7 +59,6 @@
},
"pages": [
"pages/index",
"pages/calendar",
"pages/customDialogController",
"pages/dragEvent",
"pages/dragEvent2",
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import events_emitter from '@ohos.emitter';
@Entry
@Component
struct CalendarComponentExample {
calendarController: CalendarController = new CalendarController();
@State CalendarDayArray: CalendarDay[] = [{
index: 1,
lunarMonth: "five",
lunarDay: "6",
dayMark: "六",
dayMarkValue: "儿童节",
year: 2020,
month: 11,
day: 10,
isFirstOfLunar: false,
markLunarDay: false
}];
@State currentMonthday: MonthData = {
year: 2021,
month: 3,
data: this.CalendarDayArray
};
@State preMonthday: MonthData = {
year: 2021,
month: 2,
data: this.CalendarDayArray
};
@State nextMonthday: MonthData = {
year: 2021,
month: 4,
data: this.CalendarDayArray
};
@State colorValue: Color = Color.Blue;
@State calendarDay1: CalendarDay = {
index: 6,
lunarMonth: "111",
lunarDay: "222",
dayMark: "333",
dayMarkValue: "444",
year: 2022,
month: 3,
day: 11,
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
}
@State calendarDay2: CalendarDay = {
index: 6,
lunarMonth: "111",
lunarDay: "222",
dayMark: "333",
dayMarkValue: "444",
year: 2022,
month: 3,
day: 10,
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
}
@State calendarDay3: CalendarDay = {
index: 6,
lunarMonth: "111",
lunarDay: "222",
dayMark: "333",
dayMarkValue: "444",
year: 2022,
month: 3,
day: 12,
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
}
@State currentData_: MonthData = { year: 2022, month: 3, data: [this.calendarDay1] };
@State preData_: MonthData = { year: 2022, month: 3, data: [this.calendarDay2] };
@State nextData_: MonthData = { year: 2022, month: 3, data: [this.calendarDay3] };
@State colSpace: number = 5;
@State dailyFiveRowSpace: number = 4;
@State dailySixRowSpace: number = 5;
@State lunarHeight: number = 20;
@State underscoreWidth: number = 10;
@State underscoreLength: number = 6;
@State scheduleMarkerRadius: number = 3;
@State boundaryRowOffset: number = 3;
@State weekAndDayRowSpace: number = 3;
@State direction: Axis = Axis.Horizontal;
@State weekStyle: WeekStyle = {
weekColor: Color.black,
weekendDayColor: Color.red,
weekendLunarColor: Color.green,
weekFontSize: 1,
weekHeight: 2,
weekWidth: 3,
weekAndDayRowSpace: this.weekAndDayRowSpace
};
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Calendar page state change called:" + JSON.stringify(eventData));
if (eventData.data.colSpace != null) {
this.colSpace = eventData.data.colSpace;
console.log("Calendar page colSpace value" + this.colSpace);
}
if (eventData.data.dailyFiveRowSpace != null) {
this.dailyFiveRowSpace = eventData.data.dailyFiveRowSpace;
console.log("Calendar page dailyFiveRowSpace value" + this.dailyFiveRowSpace);
}
if (eventData.data.dailySixRowSpace != null) {
this.dailySixRowSpace = eventData.data.dailySixRowSpace;
console.log("Calendar page dailySixRowSpace value" + this.dailySixRowSpace);
}
if (eventData.data.underscoreWidth != null) {
this.underscoreWidth = eventData.data.underscoreWidth;
console.log("Calendar page underscoreWidth value" + this.underscoreWidth);
}
if (eventData.data.underscoreLength != null) {
this.underscoreLength = eventData.data.underscoreLength;
console.log("Calendar page underscoreLength value" + this.underscoreLength);
}
if (eventData.data.lunarHeight != null) {
this.lunarHeight = eventData.data.lunarHeight;
console.log("Calendar page lunarHeight value" + this.lunarHeight);
}
if (eventData.data.scheduleMarkerRadius != null) {
this.scheduleMarkerRadius = eventData.data.scheduleMarkerRadius;
console.log("Calendar page scheduleMarkerRadius value" + this.scheduleMarkerRadius);
}
if (eventData.data.boundaryRowOffset != null) {
this.boundaryRowOffset = eventData.data.boundaryRowOffset;
console.log("Calendar page boundaryRowOffset value" + this.boundaryRowOffset);
}
if (eventData.data.weekAndDayRowSpace != null) {
this.weekAndDayRowSpace = eventData.data.weekAndDayRowSpace;
console.log("Calendar page weekAndDayRowSpace value" + this.weekAndDayRowSpace);
}
if (eventData.data.direction != null) {
this.direction = eventData.data.direction;
console.log("Calendar page direction value" + this.direction);
}
}
}
onPageShow() {
console.info('Calendar page show called');
var stateChangeEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Calendar({
year: 2020,
month: 5,
day: 12
}, this.currentMonthday, this.preMonthday, this.nextMonthday, this.calendarController)
.currentDayStyle({
dayHeight: 30,
dayWidth: 30,
gregorianCalendarHeight: 30,
dayYAxisOffset: 1,
lunarDayYAxisOffset: 1,
underscoreXAxisOffset: 1,
underscoreYAxisOffset: 1,
scheduleMarkerXAxisOffset: 0,
scheduleMarkerYAxisOffset: 0,
colSpace: this.colSpace,
dailyFiveRowSpace: this.dailyFiveRowSpace,
dailySixRowSpace: this.dailySixRowSpace,
lunarHeight: this.lunarHeight,
underscoreWidth: this.underscoreWidth,
underscoreLength: this.underscoreLength,
scheduleMarkerRadius: this.scheduleMarkerRadius,
boundaryRowOffset: this.boundaryRowOffset
})
.weekStyle(this.weekStyle)
.direction(this.direction)
.backgroundColor(0x317aff)
.width(100)
.height(50)
.key('calender')
}.height(400).padding({ left: 35, right: 35, top: 35 })
}
}
\ No newline at end of file
......@@ -67,36 +67,6 @@ export default function AppStorageJsunit() {
done();
});
/**
* @tc.number stateManagement_Storage_setOrCreate_0100
* @tc.name stateManagement Storage validation
* @tc.desc Function test
*/
it('stateManagement_Storage_set_0100', 0, function (done) {
done();
return;
console.info('[stateManagement_Storage_set_0100] START');
let storage = new Storage();
console.info('[stateManagement_Storage_set_0100] 0000');
storage.set("key5", "value5");
storage.set("key6", "value6");
console.info('[stateManagement_Storage_set_0100] 1111');
let key5 = storage.get("key5");
let key6 = storage.get("key6");
console.info('[stateManagement_Storage_set_0100] 2222' + key5);
storage.delete("key5");
key5 = storage.get("key5");
console.info('[stateManagement_Storage_set_0100] 3333');
console.info('[stateManagement_Storage_set_0100] key5 =' + key5);
console.info('[stateManagement_Storage_set_0100] key6 =' + key6);
storage.clear();
key6 = storage.get("key6");
console.info('[stateManagement_Storage_set_0100] key6 =' + key6);
console.info('[stateManagement_Storage_set_0100] END');
done();
});
/**
* @tc.number stateManagement_Environment_EnvProp_0100
* @tc.name stateManagement Environment validation
......
// @ts-nocheck
/**
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
import events_emitter from '@ohos.events.emitter'
import Utils from './Utils';
export default function calendarJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("calendar beforeEach start");
let options = {
uri: 'pages/calendar',
}
let result;
try {
router.clear();
let pages = router.getState();
console.info("get calendar state pages: " + JSON.stringify(pages));
if (!("calendar" == pages.name)) {
console.info("get calendar state pages.name: " + JSON.stringify(pages.name));
result = await router.push(options);
await Utils.sleep(2000);
console.info("push calendar page result: " + JSON.stringify(result));
}
} catch (err) {
console.error("push calendar page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("calendar after each called");
})
it('ACE_calendar_CurrentDayStyle_colSpace', 0, async function (done) {
console.info('[ACE_calendar_CurrentDayStyle_colSpace] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"colSpace": 10,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CurrentDayStyle_colSpace] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CurrentDayStyle_colSpace] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_CurrentDayStyle_dailyFiveRowSpace', 0, async function (done) {
console.info('[ACE_calendar_CurrentDayStyle_dailyFiveRowSpace] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"dailyFiveRowSpace": 11,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CurrentDayStyle_dailyFiveRowSpace] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CurrentDayStyle_dailyFiveRowSpace] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_CurrentDayStyle_dailySixRowSpace', 0, async function (done) {
console.info('[ACE_calendar_CurrentDayStyle_dailySixRowSpace] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"dailySixRowSpace": 12,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CurrentDayStyle_dailySixRowSpace] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CurrentDayStyle_dailySixRowSpace] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_CurrentDayStyle_lunarHeight', 0, async function (done) {
console.info('[ACE_calendar_CurrentDayStyle_lunarHeight] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"lunarHeight": 13,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CurrentDayStyle_lunarHeight] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CurrentDayStyle_lunarHeight] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_CurrentDayStyle_underscoreWidth', 0, async function (done) {
console.info('[ACE_calendar_CurrentDayStyle_underscoreWidth] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"underscoreWidth": 14,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CurrentDayStyle_underscoreWidth] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CurrentDayStyle_underscoreWidth] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_CurrentDayStyle_underscoreLength', 0, async function (done) {
console.info('[ACE_calendar_CurrentDayStyle_underscoreLength] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"underscoreLength": 15,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CurrentDayStyle_underscoreLength] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CurrentDayStyle_underscoreLength] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_CurrentDayStyle_scheduleMarkerRadius', 0, async function (done) {
console.info('[ACE_calendar_CurrentDayStyle_scheduleMarkerRadius] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"scheduleMarkerRadius": 16,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CurrentDayStyle_scheduleMarkerRadius] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CurrentDayStyle_scheduleMarkerRadius] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_CurrentDayStyle_boundaryRowOffset', 0, async function (done) {
console.info('[ACE_calendar_CurrentDayStyle_boundaryRowOffset] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"boundaryRowOffset": 17,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CurrentDayStyle_boundaryRowOffset] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CurrentDayStyle_boundaryRowOffset] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_WeekStyle_weekAndDayRowSpace', 0, async function (done) {
console.info('[ACE_calendar_WeekStyle_weekAndDayRowSpace] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"weekAndDayRowSpace": 18,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_WeekStyle_weekAndDayRowSpace] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_WeekStyle_weekAndDayRowSpace] change component data error: " + err.message);
}
done();
});
it('ACE_calendar_CalendarAttribute_direction', 0, async function (done) {
console.info('[ACE_calendar_CalendarAttribute_direction] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"direction": Axis.Vertical,
}
}
var innerEvent = {
eventId: 74,
priority: events_emitter.EventPriority.LOW
}
console.info("[ACE_calendar_CalendarAttribute_direction] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ACE_calendar_CalendarAttribute_direction] change component data error: " + err.message);
}
done();
});
})
}
......@@ -22,10 +22,8 @@ import refreshJsunit from './RefreshJsunit.test.ets';
import richTextJsunit from './RichTextJsunit.test.ets';
import textPickerJsunit from './TextPickerJsunit.test.ets';
import textTimerJsunit from './TextTimerJsunit.test.ets';
import subscribedAbstractPropertyJsunit from './SubscribedAbstractPropertyJsunit.test.ets';
import contentStorageJsunit from './ContentStorage.test.ets';
import appStorageJsunit from './AppStorageJsunit.test.ets';
import subscribaleAbstractJsunit from './SubscribaleAbstractJsunit.test.ets';
import pathJsunit from './PathJsunit.test.ets';
import enumsLineCapStyleJsunit from './EnmusLineCapStyleJsunit.test.ets';
import enmusItemAlignJsunit from './EnmusItemAlignJsunit.test.ets';
......@@ -36,7 +34,6 @@ import basicJsunit from './BasicJsunit.test.ets';
import focusJsunit from './FocusJsunit.test.ets';
import textAreaJsunit from './TextAreaJsunit.test.ets';
import dragEventJsunit from './DragEventJsunit.test.ets';
import calendarJsunit from './CalendarJsunit.test.ets';
import geometryTransitionJsunit from './GeometryTransitionJsunit.test.ets';
import textClockJsunit from './TextClockJsunit.test.ets';
import textInputJsunit from './TextInputJsunit.test.ets';
......@@ -57,11 +54,9 @@ export default function testsuite() {
imageJsunit();
textPickerJsunit();
textTimerJsunit();
subscribedAbstractPropertyJsunit();
contentStorageJsunit();
textClockJsunit();
appStorageJsunit();
subscribaleAbstractJsunit();
pathJsunit();
enumsLineCapStyleJsunit();
playModeJsunit();
......@@ -71,7 +66,6 @@ export default function testsuite() {
textAreaJsunit();
textInputJsunit();
polylineJsunit();
calendarJsunit();
PanDirectionJsunit();
geometryTransitionJsunit();
systemRouterJsunit();
......
// @ts-nocheck
/**
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
export default function SubscribaleAbstractJsunit() {
describe('SubscribaleAbstract', function () {
/**
* @tc.number stateManagement_SubscribaleAbstract_setOrCreate_0100
* @tc.name stateManagement SubscribaleAbstract setOrCreate validation
* @tc.desc Function test
*/
it('stateManagement_SubscribaleAbstract_addOwningProperty_0100', 0, function (done) {
done();
return;
console.info('[stateManagement_SubscribaleAbstract_addOwningProperty_0100] START');
let subscriber = new IPropertySubscriber();
let abstract = new SubscribaleAbstract();
abstract.addOwningProperty(subscriber);
let numbers = abstract.owningProperties_;
abstract.removeOwningProperty(subscriber)
abstract.removeOwningPropertyById(1);
abstract.notifyPropertyHasChanged("key1", "value1");
expect(true).assertTrue();
console.info('[stateManagement_SubscribaleAbstract_addOwningProperty_0100] END');
done();
});
/**
* @tc.number stateManagement_ISinglePropertyChangeSubscriber_hasChanged_0100
* @tc.name stateManagement ISinglePropertyChangeSubscriber hasChanged validation
* @tc.desc Function test
*/
it('stateManagement_ISinglePropertyChangeSubscriber_hasChanged_0100', 0, function (done) {
done();
return;
console.info('[stateManagement_ISinglePropertyChangeSubscriber_hasChanged_0100] START');
let subscriber = new ISinglePropertyChangeSubscriber<string>(
(data) => {
console.info('[stateManagement_SubscribaleAbstract_addOwningProperty_0100] data = ' + data);
}
);
expect(true).assertTrue();
console.info('[stateManagement_ISinglePropertyChangeSubscriber_hasChanged_0100] END');
done();
});
/**
* @tc.number stateManagement_PersistentStorage_0100
* @tc.name stateManagement PersistentStorage validation
* @tc.desc Function test
*/
it('stateManagement_PersistentStorage_0100', 0, function (done) {
done();
return;
console.info('[stateManagement_PersistentStorage_0100] Start');
let persistentStorage = new PersistentStorage(AppStorage, new Storage());
persistentStorage.PersistProp<string>("key10", "value10");
let persistProp = {
"properties": [{
key: "colorMode", defaultValue: ColorMode.LIGHT
}, {
key: "layoutDirection", defaultValue: LayoutDirection.LTR
}]
};
persistentStorage.PersistProps(persistProp);IPropertySubscriber
persistentStorage.DeleteProp("colorMode");
expect(true).assertTrue();
console.info('[stateManagement_PersistentStorage_0100] END');
done();
});
/**
* @tc.number stateManagement_IPropertySubscriber_0100
* @tc.name stateManagement IPropertySubscriber validation
* @tc.desc Function test
*/
it('stateManagement_IPropertySubscriber_0100', 0, function (done) {
done();
return;
console.info('[stateManagement_IPropertySubscriber_0100] Start');
let iPropertySubscriber =new IPropertySubscriber();
let id = iPropertySubscriber.id();
let aboutToBeDeleted = iPropertySubscriber.aboutToBeDeleted();
expect(true).assertTrue();
console.info('[stateManagement_IPropertySubscriber_0100] END');
done();
});
/**
* @tc.number stateManagement_IPropertySubscriber_0100
* @tc.name stateManagement IPropertySubscriber validation
* @tc.desc Function test
*/
it('stateManagement_IPropertySubscriber_0100', 0, function (done) {
done();
return;
console.info('[stateManagement_IPropertySubscriber_0100] Start');
let iPropertySubscriber =new IPropertySubscriber();
let id = iPropertySubscriber.id();
let aboutToBeDeleted = iPropertySubscriber.aboutToBeDeleted();
expect(true).assertTrue();
console.info('[stateManagement_IPropertySubscriber_0100] END');
done();
});
/**
* @tc.number stateManagement_SyncedPropertyOneWay_0100
* @tc.name stateManagement stateManagement_SyncedPropertyOneWay_0100 validation
* @tc.desc Function test
*/
it('stateManagement_SyncedPropertyOneWay_0100', 0, function (done) {
done();
return;
console.info('[stateManagement_SyncedPropertyOneWay_0100] Start');
let oneWay = new SyncedPropertyOneWay(new SubscribedAbstractProperty<string>());
oneWay.set("key12");
let key12 = oneWay.get();
oneWay.hasChanged("key12");
oneWay.aboutToBeDeleted(new SubscribedAbstractProperty<string>());
let source_ = oneWay.source_;
let wrappedValue_ = oneWay.oneWay;
expect(true).assertTrue();
console.info('[stateManagement_SyncedPropertyOneWay_0100] END');
done();
});
/**
* @tc.number stateManagement_SyncedPropertyTwoWay_0100
* @tc.name stateManagement SyncedPropertyTwoWay validation
* @tc.desc Function test
*/
it('stateManagement_SyncedPropertyTwoWay_0100', 0, function (done) {
done();
return;
console.info('[stateManagement_SyncedPropertyTwoWay_0100] Start');
let twoWay = new SyncedPropertyTwoWay(new SubscribedAbstractProperty<string>());
twoWay.set("key12");
let key12 = twoWay.get();
twoWay.hasChanged("key12");
twoWay.aboutToBeDeleted(new SubscribedAbstractProperty<string>());
let source_ = twoWay.source_;
let wrappedValue_ = twoWay.oneWay;
expect(true).assertTrue();
console.info('[stateManagement_SyncedPropertyTwoWay_0100] END');
done();
});
})
}
// @ts-nocheck
/**
* 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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
export default function subscribedAbstractPropertyJsunit() {
describe('appInfoTest', function () {
it('subscribedAbstractProperty0100', 0, async function (done) {
console.info('[subscribedAbstractProperty0100] START');
if(true){
done();
return;
}
const subscribedAbstractProperty = new SubscribedAbstractProperty('subscribtest');
let number = subscribedAbstractProperty.numberOfSubscrbers();
subscribedAbstractProperty.notifyPropertyRead();
subscribedAbstractProperty.notifyHasChanged('subscribtest');
subscribedAbstractProperty.unlinkSuscriber(0);
subscribedAbstractProperty.createOneWaySync('subscribtest');
subscribedAbstractProperty.createTwoWaySync('subscribtest');
subscribedAbstractProperty.set('subscribtest');
subscribedAbstractProperty.get();
subscribedAbstractProperty.info();
subscribedAbstractProperty.info_ = "subscribtest";
subscribedAbstractProperty.subscribers_ = 'subscribtest';
console.info('[subscribedAbstractProperty0100] END');
done();
});
})
}
......@@ -47,18 +47,6 @@ export default function systemAppJsunit() {
done();
});
it('systemAppTest_0400', 0, async function (done) {
console.info('systemAppTest_0400 START');
try {
var a = 2000;
app.requestFullWindow(a);
} catch (err) {
console.log("systemAppTest_0400 error: " + err);
}
console.info('systemAppTest_0400 END');
done();
});
it('systemAppTest_0500', 0, async function (done) {
console.info('systemAppTest_0500 START');
try {
......
......@@ -70,7 +70,6 @@
"pages/Row",
"pages/Swiper",
"pages/Tab",
"pages/Calendar",
"pages/AlertDialog",
"pages/Prop",
"pages/Link",
......@@ -86,8 +85,6 @@
"pages/components/Select",
"pages/components/Shape",
"pages/components/Sidebar",
"pages/components/FormComponentPage",
"pages/components/XComponentPage",
"pages/components/WebPage"
],
"name": ".MainAbility",
......
/*
* 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 calendar {
@State curMonth: MonthData = { year: 0, month: 0, data: [] };
@State preMonth: MonthData = { year: 0, month: 0, data: [] };
@State nextMonth: MonthData = { year: 0, month: 0, data: [] }
@State year: number = 0
@State month: number = 0
Controller: CalendarController = new CalendarController();
private lunarMonthDays: string[] = [
'初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十',
'十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十',
'廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '三十']
private lunarMonthNames: string[] = ['正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月']
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Start
}) {
Row() {
Text(`${this.year} 年 ${this.month + 1} 月`)
.fontSize(20)
.fontWeight(FontWeight.Bold)
}
Calendar({
date: { year: 2021, month: 8, day: 35 },
currentData: this.curMonth,
preData: this.preMonth,
nextData: this.nextMonth,
controller: this.Controller
})
.showLunar(true)
.showHoliday(true)
.needSlide(true)
.offDays(Week.Tue | Week.Wed)
.startOfWeek(Week.Sun)
.direction(Axis.Horizontal)
.currentDayStyle({
dayColor: Color.Black,
lunarColor: Color.Gray,
markLunarColor: Color.Black,
dayFontSize: 15,
lunarDayFontSize: 10,
boundaryColOffset: 10,
})
.nonCurrentDayStyle({
nonCurrentMonthDayColor: Color.Black,
nonCurrentMonthLunarColor: Color.Gray,
nonCurrentMonthWorkDayMarkColor: Color.Green,
nonCurrentMonthOffDayMarkColor: Color.Brown,
})
.todayStyle({
focusedDayColor: Color.Red,
focusedLunarColor: Color.Orange,
focusedAreaBackgroundColor: Color.Blue,
focusedAreaRadius: 20
})
.weekStyle({
weekColor: Color.Black,
weekendDayColor: Color.Orange,
weekendLunarColor: Color.Blue,
weekFontSize: 20,
weekHeight: 5,
weekWidth: 48,
})
.workStateStyle({
workDayMarkColor: Color.Red,
offDayMarkColor: Color.Orange,
workDayMarkSize: 10,
offDayMarkSize: 2,
workStateWidth: 12,
workStateHorizontalMovingDistance: 0,
workStateVerticalMovingDistance: 12,
})
.onRequestData((request) => {
switch (request.monthState) {
case 0:
this.year = request.currentYear;
this.month = request.currentMonth;
this.curMonth.year = request.year;
this.curMonth.month = request.month;
this.curMonth.data = [];
for (var i = 0; i < 35; ++i) {
this.curMonth.data.push({
index: i,
lunarMonth: this.lunarMonthNames[i%12],
lunarDay: this.lunarMonthDays[i % 30],
dayMark: "work",
dayMarkValue: "",
year: request.year,
month: request.month,
day: i + 1,
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
});
if (i % 7 == 0 || i % 7 == 6) {
this.curMonth.data[i].dayMarkValue = "休"
}
}
break;
case 1:
this.year = request.currentYear;
this.month = request.currentMonth;
this.preMonth.year = request.year;
this.preMonth.month = request.month
this.preMonth.data = [];
for (var i = 0; i < 35; ++i) {
this.preMonth.data.push({
index: i,
lunarMonth: this.lunarMonthNames[i%12],
lunarDay: this.lunarMonthDays[i % 30],
dayMark: "work",
dayMarkValue: "",
year: request.year,
month: request.month,
day: i + 1,
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
});
if (i % 7 == 0 || i % 7 == 6) {
this.preMonth.data[i].dayMarkValue = "休"
}
}
break;
case 2:
this.year = request.currentYear;
this.month = request.currentMonth;
this.nextMonth.year = request.year;
this.nextMonth.month = request.month;
this.nextMonth.data = [];
for (var i = 0; i < 35; ++i) {
this.nextMonth.data.push({
index: i,
lunarMonth: this.lunarMonthNames[i%12],
lunarDay: this.lunarMonthDays[i % 30],
dayMark: "work",
dayMarkValue: "",
year: request.year,
month: request.month,
day: i + 1,
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
});
if (i % 7 == 0 || i % 7 == 6) {
this.nextMonth.data[i].dayMarkValue = "休"
}
}
break;
}
})
.onSelectChange((request) => {
this.year = request.year;
this.month = request.month;
console.info('On Select change: ' + this.year + '/' + this.month)
})
Row() {
Button("back To Today").onClick(() => {
this.Controller.backToToday();
console.info("back To Today")
});
Button("go To").onClick(() => {
this.Controller.goTo({ year: 2021, month: 9, day: 10 });
console.info("go To : 2021/9/10")
});
}
}.margin({ bottom: 10, right: 20, left: 20, top: 0 })
.height("50%")
}
}
\ No newline at end of file
/*
* 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 FormComponentPage {
@State dimension:FormDimension = FormDimension.Dimension_2_2
build() {
Column(){
FormComponent({
id:0,
name:"four_four",
bundle:"com.example.myapplication",
ability:"com.example.myapplication.MainAbility",
module:"fa_widget",
dimension:this.dimension,
temporary:true
})
.size({width:100,height:100})
.moduleName("fa_widget")
.dimension(this.dimension)
.allowUpdate(true)
.visibility(Visibility.Visible)
.onAcquired((e)=>{
console.log('onAcquired id : '+ e.id)
})
.onRouter(()=>{
console.log('onRouter : ')
})
.onError((error)=>{
console.log('error code :'+error.errcode);
console.log('error msg :'+error.msg);
})
Text('卡片格式 :')
.fontSize(15)
.width('100%')
.backgroundColor(0xFAEEE0)
.height(40)
.textAlign(TextAlign.Start)
.fontWeight(FontWeight.Bolder)
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start }) {
Button('1X2')
.margin({ right: 10 })
.fontSize(15)
.width(150)
.onClick(() => {
this.dimension = FormDimension.Dimension_1_2
})
Button('2X2')
.margin({ right: 10 })
.fontSize(15)
.width(150)
.onClick(() => {
this.dimension = FormDimension.Dimension_2_2
})
Button('2X4')
.margin({ right: 10 })
.fontSize(15)
.width(150)
.onClick(() => {
this.dimension = FormDimension.Dimension_2_4
})
Button('4X4')
.margin({ right: 10 })
.fontSize(15)
.width(150)
.onClick(() => {
this.dimension = FormDimension.Dimension_4_4
})
}
.width('90%')
.margin({ top: 5, bottom: 5, left: 10, right: 10 })
}
}
}
\ No newline at end of file
/*
* 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 XComponentPage {
xComponentController: XComponentController = new XComponentController()
build() {
Column() {
Button('getXComponentSurfaceId')
.onClick(() => {
this.xComponentController.getXComponentSurfaceId()
console.log('getXComponentSurfaceId ...')
})
XComponent({ id: '1', type: '2', libraryname: '3', controller: this.xComponentController })
.onLoad((e) => {
console.log('onLoad ...' + JSON.stringify(e))
})
.onDestroy(() => {
console.log('onDestroy ...')
})
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册