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

!8154 XTS Arkui swiper xts 代码提交

Merge pull request !8154 from 张海霖/zhl_10
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperItemMarginTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperItemMargin onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemMargin01').margin(20)
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemMargin02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemMargin03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemMargin04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemMargin05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemMargin06')
}
.key('swiperItemMargin')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
.index(0)
}.alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperItemPadMarTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperItemPadMar onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemPadMar01').padding(20).margin(20)
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemPadMar02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemPadMar03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemPadMar04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemPadMar05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemPadMar06')
}
.key('swiperItemPadMar')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
.index(0)
}.alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperItemPaddingTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperItemPadding onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemPadding01').padding(20)
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemPadding02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemPadding03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemPadding04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperItemPadding05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperItemPadding06')
}
.key('swiperItemPadding')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
.index(0)
}.alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperItemSizeTest {
@State testHeight: number = 150
@State testWidth: number = 150
@State testIndex: number = 0
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperItemSize onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'height') {
this.testHeight = message.value;
}
if (message.name == 'width') {
this.testWidth = message.value;
}
if (message.name == 'index') {
this.testIndex = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width(this.testWidth).height(this.testHeight).backgroundColor(0xF5DEB3).key('itemSizekey01')
Column(){Text ('2')}.width(this.testWidth).height(this.testHeight).backgroundColor(0xD2B48C).key('itemSizekey02')
Column(){Text ('3')}.width(this.testWidth).height(this.testHeight).backgroundColor(0xF5DEB3).key('itemSizekey03')
Column(){Text ('4')}.width(this.testWidth).height(this.testHeight).backgroundColor(0xD2B48C)
Column(){Text ('5')}.width(this.testWidth).height(this.testHeight).backgroundColor(0xF5DEB3)
Column(){Text ('6')}.width(this.testWidth).height(this.testHeight).backgroundColor(0xD2B48C)
}
.key('itemSizekey')
.height(300)
.width(300)
.index(this.testIndex)
.indicator(true)
.loop(true)
.displayCount(1)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperItemVisibilityTest {
@State testVisibility1: number = Visibility.Visible
@State testVisibility2: number = Visibility.Visible
@State testVisibility3: number = Visibility.Visible
@State testIndex: number = 0
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperItemVisibility onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'visibility1') {
this.testVisibility1 = message.value;
}
if (message.name == 'visibility2') {
this.testVisibility2 = message.value;
}
if (message.name == 'visibility3') {
this.testVisibility3 = message.value;
}
if (message.name == 'index') {
this.testIndex = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('visiblekey01').visibility(this.testVisibility1)
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('visiblekey02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('visiblekey03').visibility(this.testVisibility2)
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('visiblekey04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('visiblekey05').visibility(this.testVisibility3)
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('visiblekey06')
}
.index(this.testIndex)
.key('visiblekey')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
}
.margin({ top: 5 })
.alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperAutoPlay_1Test {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperAutoPlay onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay01_1')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay01_2')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay01_3')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay01_4')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay01_5')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay01_6')
}
.key('autoPlay01')
.height(300)
.width(300)
.index(0)
.autoPlay(true)
.indicator(true)
.loop(true)
.interval(1000)
.itemSpace(0)
.displayCount(1)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperAutoPlay_2Test {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperAutoPlay onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay02_1')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay02_2')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay02_3')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay02_4')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay02_5')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay02_6')
}
.key('autoPlay02')
.height(300)
.width(300)
.index(0)
.autoPlay(false)
.indicator(true)
.loop(true)
.interval(1000)
.itemSpace(0)
.displayCount(1)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperAutoPlay_3Test {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperAutoPlay onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay03_1')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay03_2')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay03_3')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay03_4')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay03_5')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay03_6')
}
.key('autoPlay03')
.height(300)
.width(300)
.index(0)
.autoPlay(true)
.indicator(true)
.loop(true)
.itemSpace(0)
.displayCount(1)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperAutoPlay_4Test {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperAutoPlay onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay04_1')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay04_2')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay04_3')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay04_4')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('autoPlay04_5')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('autoPlay04_6')
}
.key('autoPlay04')
.height(300)
.width(300)
.index(0)
.autoPlay(true)
.indicator(true)
.loop(true)
.interval(-1000)
.itemSpace(0)
.displayCount(1)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperDisableSwipeFalseTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('DisableSwipe onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('disableFalse01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('disableFalse02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('disableFalse03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('disableFalse04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('disableFalse05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('disableFalse06')
}
.key('disableFalse')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
.disableSwipe(false)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperDisableSwipeTrueTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('DisableSwipe onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('disableTrue01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('disableTrue02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('disableTrue03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('disableTrue04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('disableTrue05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('disableTrue06')
}
.key('disableTrue')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
.disableSwipe(true)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperIndexTest {
@State testSwiperIndex: number = 0
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('swiperIndex onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'swiperIndex') {
this.testSwiperIndex = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('ckey01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('ckey02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('ckey03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('ckey04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('ckey05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('ckey06')
}
.key('swiperkey')
.height(300)
.width(300)
.index(this.testSwiperIndex)
.autoPlay(false)
.indicator(true)
.loop(true)
.itemSpace(0)
.displayCount(1)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperItemSpaceTest {
@State test_itemspace: number = 0
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperItemSpace onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'itemspace') {
this.test_itemspace = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('itemspacekey01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('itemspacekey02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('itemspacekey03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('itemspacekey04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('itemspacekey05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('itemspacekey06')
}
.key('itemspacekey')
.index(0)
.height(300)
.width(300)
.indicator(true)
.loop(true)
.itemSpace(this.test_itemspace)
.displayCount(2)
}.margin({ top: 5 }).alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperLoopFalseTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperLoop onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('loopFalse01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('loopFalse02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('loopFalse03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('loopFalse04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('loopFalse05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('loopFalse06')
}
.key('loopFalse')
.height(300)
.width(300)
.index(5)
.autoPlay(true)
.indicator(true)
.loop(false)
.itemSpace(0)
.displayCount(1)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperLoopTrueTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperLoop onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('loopTrue01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('loopTrue02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('loopTrue03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('loopTrue04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('loopTrue05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('loopTrue06')
}
.key('loopTrue')
.height(300)
.width(300)
.index(5)
.autoPlay(true)
.indicator(true)
.loop(true)
.itemSpace(0)
.displayCount(1)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperMarPadTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperMarPad onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperMarPad01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperMarPad02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperMarPad03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperMarPad04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperMarPad05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperMarPad06')
}
.key('swiperMarPad')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
.margin(20)
.padding(20)
}.alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperMarginTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwiperMargin onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperMargin01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperMargin02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperMargin03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperMargin04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperMargin05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperMargin06')
}
.key('swiperMargin')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
.margin(20)
}.alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwipePaddingTest {
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('SwipePadding onPageShow');
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperPadding01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperPadding02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperPadding03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperPadding04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('swiperPadding05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('swiperPadding06')
}
.key('swiperPadding')
.height(300)
.width(300)
.indicator(true)
.loop(true)
.displayCount(1)
.padding(20)
}.alignItems(HorizontalAlign.Start)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 {MessageManager,Callback} from '../../../common/MessageManager';
@Entry
@Component
struct SwiperVerticalTest {
@State testVertical: boolean = false
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('swiperVertical onPageShow');
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value);
if (message.name == 'swiperVertical') {
this.testVertical = message.value;
}
}
this.messageManager.registerCallback(callback);
}
build() {
Column({ space: 5 }) {
Swiper() {
Column(){Text ('1')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('verticalkey01')
Column(){Text ('2')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('verticalkey02')
Column(){Text ('3')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('verticalkey03')
Column(){Text ('4')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('verticalkey04')
Column(){Text ('5')}.width('100%').height('100%').backgroundColor(0xF5DEB3).key('verticalkey05')
Column(){Text ('6')}.width('100%').height('100%').backgroundColor(0xD2B48C).key('verticalkey06')
}
.key('verticalkey')
.height(300)
.width(300)
.index(0)
.autoPlay(false)
.indicator(true)
.loop(true)
.itemSpace(0)
.displayCount(1)
.vertical(this.testVertical)
}.margin({ top: 5 })
}
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperItemMargin() {
describe('swiperItemPadMarTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ItemChange/swiperItemMargin',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperItemPadMar state success " + JSON.stringify(pages));
if (!("swiperItemPadMar" == pages.name)) {
console.info("get swiperItemPadMar state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperItemPadMar page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperItemPadMar page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'index', value: 0});
globalThis.value.message.notify({name:'margin', value: 0});
globalThis.value.message.notify({name:'padding', value: 0});
console.info("swiperItemPadMar after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_ITEMPADMARCHANGED_0200
* @tc.name testSwiperItemSetMargin.
* @tc.desc Set swiper's first item's margin value ' 20 '.
*/
it('testSwiperItemSetMargin', 0, async function (done) {
console.info('new testSwiperItemSetMargin START');
let strJson = getInspectorByKey('swiperItemMargin');
let obj = JSON.parse(strJson);
let swiperItemMargin = CommonFunc.getComponentRect('swiperItemMargin');
let swiperItemMargin01 = CommonFunc.getComponentRect('swiperItemMargin01');
let swiperItemMargin02 = CommonFunc.getComponentRect('swiperItemMargin02');
let swiperItemMargin03 = CommonFunc.getComponentRect('swiperItemMargin03');
let swiperItemMargin04 = CommonFunc.getComponentRect('swiperItemMargin04');
let swiperItemMargin05 = CommonFunc.getComponentRect('swiperItemMargin05');
let swiperItemMargin06 = CommonFunc.getComponentRect('swiperItemMargin06');
// Before flipping the page
console.info("Before page turningsizepmkey01.left - swiperItemMargin.left value is " + JSON.stringify(swiperItemMargin01.left - swiperItemMargin.left));
expect(Math.round(swiperItemMargin01.left - swiperItemMargin.left)).assertEqual(vp2px(20));
expect(Math.round(swiperItemMargin.right - swiperItemMargin01.right)).assertEqual(vp2px(20));
expect(Math.round(swiperItemMargin01.top - swiperItemMargin.top)).assertEqual(vp2px(20));
expect(Math.round(swiperItemMargin.bottom - swiperItemMargin01.bottom)).assertEqual(vp2px(20));
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
swiperItemMargin = CommonFunc.getComponentRect('swiperItemMargin');
swiperItemMargin01 = CommonFunc.getComponentRect('swiperItemMargin01');
swiperItemMargin02 = CommonFunc.getComponentRect('swiperItemMargin02');
swiperItemMargin03 = CommonFunc.getComponentRect('swiperItemMargin03');
swiperItemMargin04 = CommonFunc.getComponentRect('swiperItemMargin04');
swiperItemMargin05 = CommonFunc.getComponentRect('swiperItemMargin05');
swiperItemMargin06 = CommonFunc.getComponentRect('swiperItemMargin06');
// After flipping the page.
console.info("After page turning, the swiperItemMargin.left value is " + JSON.stringify(swiperItemMargin.left));
console.info("After page turning,the swiperItemMargin02.left.left value is " + JSON.stringify(swiperItemMargin02.left));
expect(swiperItemMargin.left).assertEqual(swiperItemMargin02.left);
expect(swiperItemMargin.right).assertEqual(swiperItemMargin02.right);
expect(swiperItemMargin.top).assertEqual(swiperItemMargin02.top);
expect(swiperItemMargin.bottom).assertEqual(swiperItemMargin02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperItemSetMargin END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperItemPadMar() {
describe('swiperItemPadMarTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ItemChange/swiperItemPadMar',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperItemPadMar state success " + JSON.stringify(pages));
if (!("swiperItemPadMar" == pages.name)) {
console.info("get swiperItemPadMar state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperItemPadMar page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperItemPadMar page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'index', value: 0});
globalThis.value.message.notify({name:'margin', value: 0});
globalThis.value.message.notify({name:'padding', value: 0});
console.info("swiperItemPadMar after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_ITEMPADMARCHANGED_0300
* @tc.name testSwiperItemSetPaddingMargin.
* @tc.desc Set swiper's first item's margin and padding both values ' 20 '.
*/
it('testSwiperItemSetPaddingMargin', 0, async function (done) {
console.info('new testSwiperItemSetPaddingMargin START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('swiperItemPadMar');
let obj = JSON.parse(strJson);
let swiperItemPadMar = CommonFunc.getComponentRect('swiperItemPadMar');
let swiperItemPadMar01 = CommonFunc.getComponentRect('swiperItemPadMar01');
let swiperItemPadMar02 = CommonFunc.getComponentRect('swiperItemPadMar02');
let swiperItemPadMar03 = CommonFunc.getComponentRect('swiperItemPadMar03');
let swiperItemPadMar04 = CommonFunc.getComponentRect('swiperItemPadMar04');
let swiperItemPadMar05 = CommonFunc.getComponentRect('swiperItemPadMar05');
let swiperItemPadMar06 = CommonFunc.getComponentRect('swiperItemPadMar06');
// Before flipping the page
console.info("Before page turning , swiperItemPadMar01.left - swiperItemPadMar.left value is " + JSON.stringify(swiperItemPadMar01.left - swiperItemPadMar.left));
expect(Math.round(swiperItemPadMar01.left - swiperItemPadMar.left)).assertEqual(vp2px(20));
expect(Math.round(swiperItemPadMar.right - swiperItemPadMar01.right)).assertEqual(vp2px(20));
expect(Math.round(swiperItemPadMar01.top - swiperItemPadMar.top)).assertEqual(vp2px(20));
expect(Math.round(swiperItemPadMar.bottom - swiperItemPadMar01.bottom)).assertEqual(vp2px(20));
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
swiperItemPadMar = CommonFunc.getComponentRect('swiperItemPadMar');
swiperItemPadMar01 = CommonFunc.getComponentRect('swiperItemPadMar01');
swiperItemPadMar02 = CommonFunc.getComponentRect('swiperItemPadMar02');
swiperItemPadMar03 = CommonFunc.getComponentRect('swiperItemPadMar03');
swiperItemPadMar04 = CommonFunc.getComponentRect('swiperItemPadMar04');
swiperItemPadMar05 = CommonFunc.getComponentRect('swiperItemPadMar05');
swiperItemPadMar06 = CommonFunc.getComponentRect('swiperItemPadMar06');
// After flipping the page.
console.info("After page turning, the swiperItemPadMar.left value is " + JSON.stringify(swiperItemPadMar.left));
console.info("After page turning,the swiperItemPadMar02.left.left value is " + JSON.stringify(swiperItemPadMar02.left));
expect(swiperItemPadMar.left).assertEqual(swiperItemPadMar02.left);
expect(swiperItemPadMar.right).assertEqual(swiperItemPadMar02.right);
expect(swiperItemPadMar.top).assertEqual(swiperItemPadMar02.top);
expect(swiperItemPadMar.bottom).assertEqual(swiperItemPadMar02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperItemSetPaddingMargin END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperItemPadding() {
describe('swiperItemPadMarTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ItemChange/swiperItemPadding',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperItemPadMar state success " + JSON.stringify(pages));
if (!("swiperItemPadMar" == pages.name)) {
console.info("get swiperItemPadMar state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperItemPadMar page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperItemPadMar page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'index', value: 0});
globalThis.value.message.notify({name:'margin', value: 0});
globalThis.value.message.notify({name:'padding', value: 0});
console.info("swiperItemPadMar after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_ITEMPADMARCHANGED_0100
* @tc.name testSwiperItemSetPadding.
* @tc.desc Set swiper's first item's padding value ' 20 '.
*/
it('testSwiperItemSetPadding', 0, async function (done) {
console.info('new testSwiperItemSetPadding START');
let strJson = getInspectorByKey('swiperItemPadding');
let obj = JSON.parse(strJson);
let swiperItemPadding = CommonFunc.getComponentRect('swiperItemPadding');
let swiperItemPadding01 = CommonFunc.getComponentRect('swiperItemPadding01');
let swiperItemPadding02 = CommonFunc.getComponentRect('swiperItemPadding02');
let swiperItemPadding03 = CommonFunc.getComponentRect('swiperItemPadding03');
let swiperItemPadding04 = CommonFunc.getComponentRect('swiperItemPadding04');
let swiperItemPadding05 = CommonFunc.getComponentRect('swiperItemPadding05');
let swiperItemPadding06 = CommonFunc.getComponentRect('swiperItemPadding06');
// Before flipping the page
console.info("Before page turning, the swiperItemPadding.left value is " + JSON.stringify(swiperItemPadding.left));
console.info("Before page turning,the swiperItemPadding01.left.left value is " + JSON.stringify(swiperItemPadding01.left));
expect(swiperItemPadding.left).assertEqual(swiperItemPadding01.left);
expect(swiperItemPadding.right).assertEqual(swiperItemPadding01.right);
expect(swiperItemPadding.top).assertEqual(swiperItemPadding01.top);
expect(swiperItemPadding.bottom).assertEqual(swiperItemPadding01.bottom);
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
swiperItemPadding = CommonFunc.getComponentRect('swiperItemPadding');
swiperItemPadding01 = CommonFunc.getComponentRect('swiperItemPadding01');
swiperItemPadding02 = CommonFunc.getComponentRect('swiperItemPadding02');
swiperItemPadding03 = CommonFunc.getComponentRect('swiperItemPadding03');
swiperItemPadding04 = CommonFunc.getComponentRect('swiperItemPadding04');
swiperItemPadding05 = CommonFunc.getComponentRect('swiperItemPadding05');
swiperItemPadding06 = CommonFunc.getComponentRect('swiperItemPadding06');
// After flipping the page.
console.info("After page turning, the swiperItemPadding.left value is " + JSON.stringify(swiperItemPadding.left));
console.info("After page turning,the swiperItemPadding02.left.left value is " + JSON.stringify(swiperItemPadding02.left));
expect(swiperItemPadding.left).assertEqual(swiperItemPadding02.left);
expect(swiperItemPadding.right).assertEqual(swiperItemPadding02.right);
expect(swiperItemPadding.top).assertEqual(swiperItemPadding02.top);
expect(swiperItemPadding.bottom).assertEqual(swiperItemPadding02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperItemSetPadding END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperItemSize() {
describe('swiperItemSizeTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ItemChange/swiperItemSize',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperItemSize state success " + JSON.stringify(pages));
if (!("swiperItemSize" == pages.name)) {
console.info("get swiperItemSize state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperItemSize page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperItemSize page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("swiperItemSize after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_ITEMCHANGED_0100
* @tc.name testSwiperItemSize
* @tc.desc Set item's height and width values '150*150'.
*/
it('testSwiperItemSize', 0, async function (done) {
console.info('new testSwiperItemSize START');
let strJson = getInspectorByKey('itemSizekey');
let obj = JSON.parse(strJson);
let itemSizekey = CommonFunc.getComponentRect('itemSizekey');
let itemSizekey01 = CommonFunc.getComponentRect('itemSizekey01');
let itemSizekey02 = CommonFunc.getComponentRect('itemSizekey02');
let itemSizekey03 = CommonFunc.getComponentRect('itemSizekey03');
// Before flipping the page.
console.info("Before page turning , the itemSizekey.left value is " + JSON.stringify(itemSizekey.left));
console.info("Before page turning , the itemSizekey01.left value is " + JSON.stringify(itemSizekey01.left));
expect(itemSizekey.left).assertEqual(itemSizekey01.left);
expect(itemSizekey.top).assertEqual(itemSizekey01.top);
expect(Math.round(itemSizekey.right - itemSizekey01.right)).assertEqual(vp2px(150));
expect(Math.round(itemSizekey.bottom - itemSizekey01.bottom)).assertEqual(vp2px(150));
// Flipping.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
// After flipping the page.
itemSizekey = CommonFunc.getComponentRect('itemSizekey');
itemSizekey01 = CommonFunc.getComponentRect('itemSizekey01');
itemSizekey02 = CommonFunc.getComponentRect('itemSizekey02');
itemSizekey03 = CommonFunc.getComponentRect('itemSizekey03');
console.info("After page turning , the itemSizekey.left value is " + JSON.stringify(itemSizekey.left));
console.info("After page turning , the itemSizekey02.left value is " + JSON.stringify(itemSizekey02.left));
expect(itemSizekey.left).assertEqual(itemSizekey02.left);
expect(itemSizekey.top).assertEqual(itemSizekey02.top);
expect(Math.round(itemSizekey.right - itemSizekey01.right)).assertEqual(vp2px(150));
expect(Math.round(itemSizekey.bottom - itemSizekey01.bottom)).assertEqual(vp2px(150));
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperItemSize END');
done();
});
/**
* @tc.number SUB_ACE_SWIPER_ITEMCHANGED_0200
* @tc.name testSwiperItemSizeExceed.
* @tc.desc Set item's height and width values '350*350'.
*/
it('testSwiperItemSizeExceed', 0, async function (done) {
console.info('new testSwiperItemSizeExceed START');
globalThis.value.message.notify({name:'index', value: 0});
globalThis.value.message.notify({name:'height', value: 350});
globalThis.value.message.notify({name:'width', value: 350});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('itemSizekey');
let obj = JSON.parse(strJson);
let itemSizekey = CommonFunc.getComponentRect('itemSizekey');
let itemSizekey01 = CommonFunc.getComponentRect('itemSizekey01');
let itemSizekey02 = CommonFunc.getComponentRect('itemSizekey02');
let itemSizekey03 = CommonFunc.getComponentRect('itemSizekey03');
// Before flipping the page.
console.info("Before page turning , the itemSizekey.left value is " + JSON.stringify(itemSizekey.left));
console.info("Before page turning , the itemSizekey01.left value is " + JSON.stringify(itemSizekey01.left));
expect(itemSizekey.left).assertEqual(itemSizekey01.left);
expect(itemSizekey.right).assertEqual(itemSizekey01.right);
expect(itemSizekey.top).assertEqual(itemSizekey01.top);
expect(itemSizekey.bottom).assertEqual(itemSizekey01.bottom);
// Flipping.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
// After flipping the page.
itemSizekey = CommonFunc.getComponentRect('itemSizekey');
itemSizekey01 = CommonFunc.getComponentRect('itemSizekey01');
itemSizekey02 = CommonFunc.getComponentRect('itemSizekey02');
itemSizekey03 = CommonFunc.getComponentRect('itemSizekey03');
console.info("After page turning , the itemSizekey.left value is " + JSON.stringify(itemSizekey.left));
console.info("After page turning , the itemSizekey02.left value is " + JSON.stringify(itemSizekey02.left));
expect(itemSizekey.left).assertEqual(itemSizekey02.left);
expect(itemSizekey.right).assertEqual(itemSizekey02.right);
expect(itemSizekey.top).assertEqual(itemSizekey02.top);
expect(itemSizekey.bottom).assertEqual(itemSizekey02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperItemSizeExceed END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperItemVisibility() {
describe('swiperVisbleTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ItemChange/swiperItemVisibility',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperItemVisibility state success " + JSON.stringify(pages));
if (!("swiperItemVisibility" == pages.name)) {
console.info("get swiperItemVisibility state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperItemVisibility page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperItemVisibility page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'index', value: 0});
globalThis.value.message.notify({name:'visibility', value: Visibility.Visible});
console.info("swiperItemVisibility after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_VISIBLECHANGED_0100
* @tc.name Swiper_VisibleChanged_SetVisibility
* @tc.desc Set swiper's first items visiblity value ' Visible '.
*/
it('SUB_ACE_SWIPER_VISIBLECHANGED_0100', 0, async function (done) {
console.info('new SUB_ACE_SWIPER_VISIBLECHANGED_0100 START');
globalThis.value.message.notify({name:'index', value: 0});
let strJson = getInspectorByKey('visiblekey');
let obj = JSON.parse(strJson);
let strJson1 = getInspectorByKey('visiblekey01');
let obj1 = JSON.parse(strJson1);
let visiblekey = CommonFunc.getComponentRect('visiblekey');
let visiblekey01 = CommonFunc.getComponentRect('visiblekey01');
// 翻页前子组件1大小及位置与父组件一致
console.info("Before page turning , the visiblekey.left value is " + JSON.stringify(visiblekey.left));
console.info("Before page turning , the visiblekey01.left value is " + JSON.stringify(visiblekey01.left));
expect(visiblekey.left).assertEqual(visiblekey01.left);
expect(visiblekey.right).assertEqual(visiblekey01.right);
expect(visiblekey.top).assertEqual(visiblekey01.top);
expect(visiblekey.bottom).assertEqual(visiblekey01.bottom);
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
// 翻页后子组件2大小及位置与父组件一致,翻页成功
visiblekey = CommonFunc.getComponentRect('visiblekey');
let visiblekey02 = CommonFunc.getComponentRect('visiblekey02');
console.info("After page turning , the visiblekey.left value is " + JSON.stringify(visiblekey.left));
console.info("After page turning , the visiblekey02.left value is " + JSON.stringify(visiblekey02.left));
expect(visiblekey.left).assertEqual(visiblekey02.left);
expect(visiblekey.right).assertEqual(visiblekey02.right);
expect(visiblekey.top).assertEqual(visiblekey02.top);
expect(visiblekey.bottom).assertEqual(visiblekey02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The indicator value is " + JSON.stringify(obj.$attrs.indicator));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
console.info("The visibility value is " + JSON.stringify(obj.$attrs.visibility));
expect(obj.$type).assertEqual('Swiper');
// expect(obj.$attrs.indicator).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
expect(obj1.$attrs.visibility).assertEqual('Visibility.Visible');
console.info('new SUB_ACE_SWIPER_VISIBLECHANGED_0100 END');
done();
});
/**
* @tc.number SUB_ACE_SWIPER_VISIBLECHANGED_0200
* @tc.name Swiper_VisibleChanged_SetVisibility
* @tc.desc Set swiper's first items visiblity value ' hidden '.
*/
it('SUB_ACE_SWIPER_VISIBLECHANGED_0200', 0, async function (done) {
console.info('new SUB_ACE_SWIPER_VISIBLECHANGED_0200 START');
globalThis.value.message.notify({name:'visibility3', value: Visibility.Hidden});
globalThis.value.message.notify({name:'index', value: 4});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('visiblekey');
let obj = JSON.parse(strJson);
let strJson1 = getInspectorByKey('visiblekey05');
let obj1 = JSON.parse(strJson1);
let visiblekey = CommonFunc.getComponentRect('visiblekey');
let visiblekey05 = CommonFunc.getComponentRect('visiblekey05');
// 翻页前子组件5大小及位置与父组件一致
console.info("Before page turning , the visiblekey.left value is " + JSON.stringify(visiblekey.left));
console.info("Before page turning , the visiblekey05.left value is " + JSON.stringify(visiblekey05.left));
expect(visiblekey.left).assertEqual(visiblekey05.left);
expect(visiblekey.right).assertEqual(visiblekey05.right);
expect(visiblekey.top).assertEqual(visiblekey05.top);
expect(visiblekey.bottom).assertEqual(visiblekey05.bottom);
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
// 翻页后子组件6大小及位置与父组件一致,翻页成功
visiblekey = CommonFunc.getComponentRect('visiblekey');
let visiblekey06 = CommonFunc.getComponentRect('visiblekey06');
console.info("After page turning , the visiblekey.left value is " + JSON.stringify(visiblekey.left));
console.info("After page turning , the visiblekey06.left value is " + JSON.stringify(visiblekey06.left));
expect(visiblekey.left).assertEqual(visiblekey06.left);
expect(visiblekey.right).assertEqual(visiblekey06.right);
expect(visiblekey.top).assertEqual(visiblekey06.top);
expect(visiblekey.bottom).assertEqual(visiblekey06.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The indicator value is " + JSON.stringify(obj.$attrs.indicator));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
console.info("The visibility value is " + JSON.stringify(obj.$attrs.visibility));
expect(obj.$type).assertEqual('Swiper');
// expect(obj.$attrs.indicator).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
expect(obj1.$attrs.visibility).assertEqual('Visibility.Hidden');
console.info('new SUB_ACE_SWIPER_VISIBLECHANGED_0200 END');
done();
});
/**
* @tc.number SUB_ACE_SWIPER_VISIBLECHANGED_0300
* @tc.name Swiper_VisibleChanged_SetVisibility
* @tc.desc Set swiper's first items visiblity value ' None '.
*/
it('SUB_ACE_SWIPER_VISIBLECHANGED_0300', 0, async function (done) {
console.info('new SUB_ACE_SWIPER_VISIBLECHANGED_0300 START');
globalThis.value.message.notify({name:'visibility2', value: Visibility.None});
globalThis.value.message.notify({name:'index', value: 2});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('visiblekey');
let obj = JSON.parse(strJson);
let strJson1 = getInspectorByKey('visiblekey03');
let obj1 = JSON.parse(strJson1);
let visiblekey = CommonFunc.getComponentRect('visiblekey');
let visiblekey03 = CommonFunc.getComponentRect('visiblekey03');
// 翻页前子组件3隐藏不占位
console.info("Before page turning , the visiblekey03.left value is " + JSON.stringify(visiblekey03.left));
console.info("Before page turning , the visiblekey03.right value is " + JSON.stringify(visiblekey03.right));
expect(visiblekey03.left).assertEqual(visiblekey03.right)
expect(visiblekey03.top).assertEqual(visiblekey03.bottom)
visiblekey = CommonFunc.getComponentRect('visiblekey');
visiblekey03 = CommonFunc.getComponentRect('visiblekey03');
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
// 翻页后子组件4大小及位置与父组件一致,翻页成功
visiblekey = CommonFunc.getComponentRect('visiblekey');
let visiblekey04 = CommonFunc.getComponentRect('visiblekey04');
console.info("After page turning , the visiblekey.left value is " + JSON.stringify(visiblekey.left));
console.info("After page turning , the visiblekey04.left value is " + JSON.stringify(visiblekey04.left));
expect(visiblekey.left).assertEqual(visiblekey04.left);
expect(visiblekey.right).assertEqual(visiblekey04.right);
expect(visiblekey.top).assertEqual(visiblekey04.top);
expect(visiblekey.bottom).assertEqual(visiblekey04.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The indicator value is " + JSON.stringify(obj.$attrs.indicator));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
console.info("The visibility value is " + JSON.stringify(obj.$attrs.visibility));
expect(obj.$type).assertEqual('Swiper');
// expect(obj.$attrs.indicator).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
expect(obj1.$attrs.visibility).assertEqual('Visibility.None');
console.info('new SUB_ACE_SWIPER_VISIBLECHANGED_0300 END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperAutoPlay_1() {
describe('swiperAutoPlayTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperAutoPlay_1',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperAutoPlay_1 state success " + JSON.stringify(pages));
if (!("swiperAutoPlay_1" == pages.name)) {
console.info("get swiperAutoPlay_1 state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperAutoPlay_1 page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperAutoPlay_1 page error " + JSON.stringify(err));
}
});
afterEach(async function () {
console.info("swiperAutoPlay_1 after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_AUTOPLAYCHANGED_0100
* @tc.name testSwiperAutoPlaySetting_1
* @tc.desc Set swiper's AutoPlay value ' true ' and interval values '1000'.
*/
it('testSwiperAutoPlaySetting_1', 0, async function (done) {
console.info('new testSwiperAutoPlaySetting_1 START');
let strJson = getInspectorByKey('autoPlay01');
let obj = JSON.parse(strJson);
let autoPlay01 = CommonFunc.getComponentRect('autoPlay01');
let autoPlay01_1 = CommonFunc.getComponentRect('autoPlay01_1');
let autoPlay01_2 = CommonFunc.getComponentRect('autoPlay01_2');
let autoPlay01_3 = CommonFunc.getComponentRect('autoPlay01_3');
let autoPlay01_4 = CommonFunc.getComponentRect('autoPlay01_4');
let autoPlay01_5 = CommonFunc.getComponentRect('autoPlay01_5');
let autoPlay01_6 = CommonFunc.getComponentRect('autoPlay01_6');
// Automatically flip to page six.
console.info("Autoplay page turning , the autoPlay01.left value is " + JSON.stringify(autoPlay01.left));
console.info("Autoplay page turning , the autoPlay01_4.left value is " + JSON.stringify(autoPlay01_4.left));
expect(autoPlay01.left).assertEqual(autoPlay01_4.left);
expect(autoPlay01.right).assertEqual(autoPlay01_4.right);
expect(autoPlay01.top).assertEqual(autoPlay01_4.top);
expect(autoPlay01.bottom).assertEqual(autoPlay01_4.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The indicator value is " + JSON.stringify(obj.$attrs.indicator));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
console.info("The interval value is " + JSON.stringify(obj.$attrs.interval));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('3');
expect(obj.$attrs.autoPlay).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
expect(obj.$attrs.interval).assertEqual('1000');
console.info('new testSwiperAutoPlaySetting_1 END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperAutoPlay_2() {
describe('swiperAutoPlayTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperAutoPlay_2',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperAutoPlay_2 state success " + JSON.stringify(pages));
if (!("swiperAutoPlay_2" == pages.name)) {
console.info("get swiperAutoPlay_2 state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperAutoPlay_2 page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperAutoPlay_2 page error " + JSON.stringify(err));
}
});
afterEach(async function () {
console.info("swiperAutoPlay_2 after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_VERTICALCHANGED_0200
* @tc.name testSwiperAutoPlaySetting_2
* @tc.desc Set swiper's AutoPlay value ' false ' and interval values '1000'.
*/
it('testSwiperAutoPlaySetting_2', 0, async function (done) {
console.info('new testSwiperAutoPlaySetting_2 START');
let strJson = getInspectorByKey('autoPlay02');
let obj = JSON.parse(strJson);
let autoPlay02 = CommonFunc.getComponentRect('autoPlay02');
let autoPlay02_1 = CommonFunc.getComponentRect('autoPlay02_1');
let autoPlay02_2 = CommonFunc.getComponentRect('autoPlay02_2');
let autoPlay02_3 = CommonFunc.getComponentRect('autoPlay02_3');
let autoPlay02_4 = CommonFunc.getComponentRect('autoPlay02_4');
let autoPlay02_5 = CommonFunc.getComponentRect('autoPlay02_5');
let autoPlay02_6 = CommonFunc.getComponentRect('autoPlay02_6');
// Automatic page flipping failed.
console.info("Autoplay page turning , the autoPlay02.left value is " + JSON.stringify(autoPlay02.left));
console.info("Autoplay page turning , the autoPlay02_1.left value is " + JSON.stringify(autoPlay02_1.left));
expect(autoPlay02.left).assertEqual(autoPlay02_1.left);
expect(autoPlay02.right).assertEqual(autoPlay02_1.right);
expect(autoPlay02.top).assertEqual(autoPlay02_1.top);
expect(autoPlay02.bottom).assertEqual(autoPlay02_1.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
console.info("The interval value is " + JSON.stringify(obj.$attrs.interval));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('0');
expect(obj.$attrs.autoPlay).assertEqual('false');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
expect(obj.$attrs.interval).assertEqual('1000');
console.info('new testSwiperAutoPlaySetting_2 END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperAutoPlay_3() {
describe('swiperAutoPlayTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperAutoPlay_3',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperAutoPlay_3 state success " + JSON.stringify(pages));
if (!("swiperAutoPlay_3" == pages.name)) {
console.info("get swiperAutoPlay_3 state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperAutoPlay_3 page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperAutoPlay_3 page error " + JSON.stringify(err));
}
});
afterEach(async function () {
console.info("swiperAutoPlay_3 after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_VERTICALCHANGED_0300
* @tc.name testSwiperAutoPlaySetting_3
* @tc.desc Set swiper's AutoPlay value ' true '.
*/
it('testSwiperAutoPlaySetting_3', 0, async function (done) {
console.info('new testSwiperAutoPlaySetting_3 START');
let strJson = getInspectorByKey('autoPlay03');
let obj = JSON.parse(strJson);
let autoPlay03 = CommonFunc.getComponentRect('autoPlay03');
let autoPlay03_1 = CommonFunc.getComponentRect('autoPlay03_1');
let autoPlay03_2 = CommonFunc.getComponentRect('autoPlay03_2');
let autoPlay03_3 = CommonFunc.getComponentRect('autoPlay03_3');
let autoPlay03_4 = CommonFunc.getComponentRect('autoPlay03_4');
let autoPlay03_5 = CommonFunc.getComponentRect('autoPlay03_5');
let autoPlay03_6 = CommonFunc.getComponentRect('autoPlay03_6');
// Automatically flip to the second page.
console.info("Autoplay page turning , the autoPlay03.left value is " + JSON.stringify(autoPlay03.left));
console.info("Autoplay page turning , the autoPlay03_2.left value is " + JSON.stringify(autoPlay03_2.left));
expect(autoPlay03.left).assertEqual(autoPlay03_2.left);
expect(autoPlay03.right).assertEqual(autoPlay03_2.right);
expect(autoPlay03.top).assertEqual(autoPlay03_2.top);
expect(autoPlay03.bottom).assertEqual(autoPlay03_2.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
console.info("The interval value is " + JSON.stringify(obj.$attrs.interval));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('1');
expect(obj.$attrs.autoPlay).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
expect(obj.$attrs.interval).assertEqual('3000');
console.info('new testSwiperAutoPlaySetting_3 END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperAutoPlay_4() {
describe('swiperAutoPlayTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperAutoPlay_4',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperAutoPlay_4 state success " + JSON.stringify(pages));
if (!("swiperAutoPlay_4" == pages.name)) {
console.info("get swiperAutoPlay_4 state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperAutoPlay_4 page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperAutoPlay_4 page error " + JSON.stringify(err));
}
});
afterEach(async function () {
console.info("swiperAutoPlay_4 after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_VERTICALCHANGED_0400
* @tc.name testSwiperAutoPlaySetting_4
* @tc.desc Set swiper's AutoPlay value ' false ' and interval values '-1000'.
*/
it('testSwiperAutoPlaySetting_4', 0, async function (done) {
console.info('new testSwiperAutoPlaySetting_4 START');
let strJson = getInspectorByKey('autoPlay04');
let obj = JSON.parse(strJson);
let autoPlay04 = CommonFunc.getComponentRect('autoPlay04');
let autoPlay04_1 = CommonFunc.getComponentRect('autoPlay04_1');
let autoPlay04_2 = CommonFunc.getComponentRect('autoPlay04_2');
let autoPlay04_3 = CommonFunc.getComponentRect('autoPlay04_3');
let autoPlay04_4 = CommonFunc.getComponentRect('autoPlay04_4');
let autoPlay04_5 = CommonFunc.getComponentRect('autoPlay04_5');
let autoPlay04_6 = CommonFunc.getComponentRect('autoPlay04_6');
// Automatically flip to the second page.
console.info("Autoplay page turning , the autoPlay04.left value is " + JSON.stringify(autoPlay04.left));
console.info("Autoplay page turning , the autoPlay04_2.left value is " + JSON.stringify(autoPlay04_2.left));
expect(autoPlay04.left).assertEqual(autoPlay04_2.left);
expect(autoPlay04.right).assertEqual(autoPlay04_2.right);
expect(autoPlay04.top).assertEqual(autoPlay04_2.top);
expect(autoPlay04.bottom).assertEqual(autoPlay04_2.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
console.info("The interval value is " + JSON.stringify(obj.$attrs.interval));
expect(obj.$type).assertEqual('Swiper')
expect(obj.$attrs.index).assertEqual('1')
expect(obj.$attrs.autoPlay).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
expect(obj.$attrs.interval).assertEqual('3000');
console.info('new testSwiperAutoPlaySetting_4 END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperDisableSwipeFalse() {
describe('swiperDisableSwipeTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperDisableSwipeFalse',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get DisableSwipe state success " + JSON.stringify(pages));
if (!("DisableSwipe" == pages.name)) {
console.info("get DisableSwipe state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push DisableSwipe page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push DisableSwipe page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("DisableSwipe after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_DISABLESWIPE_0200
* @tc.name testSwiperDisableSwipeFalse.
* @tc.desc Set swiper's disableSwipe values 'false'.
*/
it('testSwiperDisableSwipeFalse', 0, async function (done) {
console.info('new testSwiperDisableSwipeFalse START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('disableFalse');
let obj = JSON.parse(strJson);
let disableFalse = CommonFunc.getComponentRect('disableFalse');
let disableFalse01 = CommonFunc.getComponentRect('disableFalse01');
let disableFalse02 = CommonFunc.getComponentRect('disableFalse02');
let disableFalse03 = CommonFunc.getComponentRect('disableFalse03');
let disableFalse04 = CommonFunc.getComponentRect('disableFalse04');
let disableFalse05 = CommonFunc.getComponentRect('disableFalse05');
let disableFalse06 = CommonFunc.getComponentRect('disableFalse06');
// Before flipping the page.
console.info("Before page turning , the disableFalse.left value is " + JSON.stringify(disableFalse.left));
console.info("Before page turning , the disableFalse01.left value is " + JSON.stringify(disableFalse01.left));
expect(disableFalse.left).assertEqual(disableFalse01.left);
expect(disableFalse.right).assertEqual(disableFalse01.right);
expect(disableFalse.top).assertEqual(disableFalse01.top);
expect(disableFalse.bottom).assertEqual(disableFalse01.bottom);
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
// After flipping the page.
disableFalse = CommonFunc.getComponentRect('disableFalse');
disableFalse01 = CommonFunc.getComponentRect('disableFalse01');
disableFalse02 = CommonFunc.getComponentRect('disableFalse02');
disableFalse03 = CommonFunc.getComponentRect('disableFalse03');
disableFalse04 = CommonFunc.getComponentRect('disableFalse04');
disableFalse05 = CommonFunc.getComponentRect('disableFalse05');
disableFalse06 = CommonFunc.getComponentRect('disableFalse06');
console.info("After page turning , the disableFalse.left value is " + JSON.stringify(disableFalse.left));
console.info("After page turning , the disableFalse02.left value is " + JSON.stringify(disableFalse02.left));
expect(disableFalse.left).assertEqual(disableFalse02.left);
expect(disableFalse.right).assertEqual(disableFalse02.right);
expect(disableFalse.top).assertEqual(disableFalse02.top);
expect(disableFalse.bottom).assertEqual(disableFalse02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The disableSwipe value is " + JSON.stringify(obj.$attrs.disableSwipe));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.disableSwipe).assertEqual('false');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperDisableSwipeFalse END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperDisableSwipeTrue() {
describe('swiperDisableSwipeTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperDisableSwipeTrue',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperDisableSwipeTrue state success " + JSON.stringify(pages));
if (!("swiperDisableSwipeTrue" == pages.name)) {
console.info("get swiperDisableSwipeTrue state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperDisableSwipeTrue page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperDisableSwipeTrue page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("DisableSwipe after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_DISABLESWIPE_0100
* @tc.name testSwiperDisableSwipeTrue.
* @tc.desc Set swiper's disableSwipe values 'true'.
*/
it('testSwiperDisableSwipeTrue', 0, async function (done) {
console.info('new testSwiperDisableSwipeTrue START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('disableTrue');
let obj = JSON.parse(strJson);
let disableTrue = CommonFunc.getComponentRect('disableTrue');
let disableTrue01 = CommonFunc.getComponentRect('disableTrue01');
let disableTrue02 = CommonFunc.getComponentRect('disableTrue02');
let disableTrue03 = CommonFunc.getComponentRect('disableTrue03');
let disableTrue04 = CommonFunc.getComponentRect('disableTrue04');
let disableTrue05 = CommonFunc.getComponentRect('disableTrue05');
let disableTrue06 = CommonFunc.getComponentRect('disableTrue06');
// Before flipping the page.
console.info("Before page turning , the disableTrue.left value is " + JSON.stringify(disableTrue.left));
console.info("Before page turning , the disableTrue01.left value is " + JSON.stringify(disableTrue01.left));
expect(disableTrue.left).assertEqual(disableTrue01.left);
expect(disableTrue.right).assertEqual(disableTrue01.right);
expect(disableTrue.top).assertEqual(disableTrue01.top);
expect(disableTrue.bottom).assertEqual(disableTrue01.bottom);
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
disableTrue01 = CommonFunc.getComponentRect('disableTrue01');
disableTrue02 = CommonFunc.getComponentRect('disableTrue02');
disableTrue03 = CommonFunc.getComponentRect('disableTrue03');
disableTrue04 = CommonFunc.getComponentRect('disableTrue04');
disableTrue05 = CommonFunc.getComponentRect('disableTrue05');
disableTrue06 = CommonFunc.getComponentRect('disableTrue06');
// After flipping the page.
console.info("After page turning , the disableTrue.left value is " + JSON.stringify(disableTrue.left));
console.info("After page turning , the disableTrue01.left value is " + JSON.stringify(disableTrue01.left));
expect(disableTrue.left).assertEqual(disableTrue01.left);
expect(disableTrue.right).assertEqual(disableTrue01.right);
expect(disableTrue.top).assertEqual(disableTrue01.top);
expect(disableTrue.bottom).assertEqual(disableTrue01.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The disableSwipe value is " + JSON.stringify(obj.$attrs.disableSwipe));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.disableSwipe).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperDisableSwipeTrue END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperIndex() {
describe('swiperIndexTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperIndex',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperIndex state success " + JSON.stringify(pages));
if (!("swiperIndex" == pages.name)) {
console.info("get swiperIndex state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperIndex page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperIndex page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'swiperIndex', value: 0});
console.info("swiperIndex after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_INDEXCHANGED_0100
* @tc.name Swiper_IndexChanged_SetIndexValue
* @tc.desc Set swiper's index normal value.
*/
it('SUB_ACE_SWIPER_INDEXCHANGED_0100', 0, async function (done) {
console.info('new SUB_ACE_SWIPER_INDEXCHANGED_0100 START');
globalThis.value.message.notify({name:'swiperIndex', value: 3});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('swiperkey');
let obj = JSON.parse(strJson);
let swiperkey = CommonFunc.getComponentRect('swiperkey');
let ckey04 = CommonFunc.getComponentRect('ckey04');
let ckey05 = CommonFunc.getComponentRect('ckey05');
// Before flipping the page.
expect(swiperkey.left).assertEqual(ckey04.left);
expect(swiperkey.right).assertEqual(ckey04.right);
expect(swiperkey.top).assertEqual(ckey04.top);
expect(swiperkey.bottom).assertEqual(ckey04.bottom);
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
ckey04 = CommonFunc.getComponentRect('ckey04');
ckey05 = CommonFunc.getComponentRect('ckey05');
// After flipping the page.
expect(swiperkey.left).assertEqual(ckey05.left);
expect(swiperkey.right).assertEqual(ckey05.right);
expect(swiperkey.top).assertEqual(ckey05.top);
expect(swiperkey.bottom).assertEqual(ckey05.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('3');
expect(obj.$attrs.autoPlay).assertEqual('false');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new SUB_ACE_SWIPER_INDEXCHANGED_0100 END');
done();
});
/**
* @tc.number SUB_ACE_SWIPER_INDEXCHANGED_0200
* @tc.name Swiper_IndexChanged_SetIndexValue
* @tc.desc Set swiper's index value ' -1 '.
*/
it('SUB_ACE_SWIPER_INDEXCHANGED_0200', 0, async function (done) {
console.info('new SUB_ACE_SWIPER_INDEXCHANGED_0200 START');
globalThis.value.message.notify({name:'swiperIndex', value: -1});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('swiperkey');
let obj = JSON.parse(strJson);
let swiperkey = CommonFunc.getComponentRect('swiperkey');
let ckey01 = CommonFunc.getComponentRect('ckey01');
let ckey02 = CommonFunc.getComponentRect('ckey02');
// Before flipping the page.
console.info("Before page turning , the swiperkey.left value is " + JSON.stringify(swiperkey.left));
console.info("Before page turning , the ckey01.left value is " + JSON.stringify(ckey01.left));
expect(swiperkey.left).assertEqual(ckey01.left)
expect(swiperkey.right).assertEqual(ckey01.right)
expect(swiperkey.top).assertEqual(ckey01.top)
expect(swiperkey.bottom).assertEqual(ckey01.bottom)
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
ckey01 = CommonFunc.getComponentRect('ckey01');
ckey02 = CommonFunc.getComponentRect('ckey02');
// After flipping the page.
console.info("After page turning , the swiperkey.left value is " + JSON.stringify(swiperkey.left));
console.info("After page turning , the ckey02.left value is " + JSON.stringify(ckey02.left));
expect(swiperkey.left).assertEqual(ckey02.left);
expect(swiperkey.right).assertEqual(ckey02.right);
expect(swiperkey.top).assertEqual(ckey02.top);
expect(swiperkey.bottom).assertEqual(ckey02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('0');
expect(obj.$attrs.autoPlay).assertEqual('false');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new SUB_ACE_SWIPER_INDEXCHANGED_0200 END');
done();
});
/**
* @tc.number SUB_ACE_SWIPER_INDEXCHANGED_0300
* @tc.name Swiper_IndexChanged_SetIndexValue
* @tc.desc Set swiper's index value ' 11 '.
*/
it('SUB_ACE_SWIPER_INDEXCHANGED_0300', 0, async function (done) {
console.info('new SUB_ACE_SWIPER_INDEXCHANGED_0300 START');
globalThis.value.message.notify({name:'swiperIndex', value: 11});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('swiperkey');
let obj = JSON.parse(strJson);
let swiperkey = CommonFunc.getComponentRect('swiperkey');
let ckey01 = CommonFunc.getComponentRect('ckey01');
let ckey02 = CommonFunc.getComponentRect('ckey02');
// Before flipping the page.
console.info("Before page turning , the swiperkey.left value is " + JSON.stringify(swiperkey.left));
console.info("Before page turning , the ckey01.left value is " + JSON.stringify(ckey01.left));
expect(swiperkey.left).assertEqual(ckey01.left);
expect(swiperkey.right).assertEqual(ckey01.right);
expect(swiperkey.top).assertEqual(ckey01.top);
expect(swiperkey.bottom).assertEqual(ckey01.bottom);
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
ckey01 = CommonFunc.getComponentRect('ckey01');
ckey02 = CommonFunc.getComponentRect('ckey02');
// After flipping the page.
console.info("After page turning , the swiperkey.left value is " + JSON.stringify(swiperkey.left));
console.info("After page turning , the ckey02.left value is " + JSON.stringify(ckey02.left));
expect(swiperkey.left).assertEqual(ckey02.left);
expect(swiperkey.right).assertEqual(ckey02.right);
expect(swiperkey.top).assertEqual(ckey02.top);
expect(swiperkey.bottom).assertEqual(ckey02.bottom);
expect(obj.$type).assertEqual('Swiper');
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$attrs.index).assertEqual('11');
expect(obj.$attrs.autoPlay).assertEqual('false');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new SUB_ACE_SWIPER_INDEXCHANGED_0300 END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperItemSpace() {
describe('swiperItemSpaceTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperItemSpace',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperItemSpace state success " + JSON.stringify(pages));
if (!("swiperItemSpace" == pages.name)) {
console.info("get swiperItemSpace state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperItemSpace page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperItemSpace page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("swiperItemSpace after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_ITEMSPACECHANGED_0100
* @tc.name testSwiperSetItemSpace
* @tc.desc Set swiper's ItemSpace value ' 20 '.
*/
it('testSwiperSetItemSpace', 0, async function (done) {
console.info('new testSwiperSetItemSpace START');
globalThis.value.message.notify({name:'itemspace', value: 20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('itemspacekey');
let obj = JSON.parse(strJson);
let itemspacekey = CommonFunc.getComponentRect('itemspacekey');
let itemspacekey01 = CommonFunc.getComponentRect('itemspacekey01');
let itemspacekey02 = CommonFunc.getComponentRect('itemspacekey02');
let itemspacekey03 = CommonFunc.getComponentRect('itemspacekey03');
let itemspacekey04 = CommonFunc.getComponentRect('itemspacekey04');
let itemspacekey05 = CommonFunc.getComponentRect('itemspacekey05');
let itemspacekey06 = CommonFunc.getComponentRect('itemspacekey06');
// Before flipping the page.
console.info("Before page turning , the itemspacekey.left value is " + JSON.stringify(itemspacekey.left));
console.info("Before page turning , the itemspacekey01.left value is " + JSON.stringify(itemspacekey01.left));
expect(itemspacekey.left).assertEqual(itemspacekey01.left)
expect(itemspacekey.top).assertEqual(itemspacekey01.top)
expect(itemspacekey.bottom).assertEqual(itemspacekey01.bottom)
// Page turning.
expect(itemspacekey.top).assertEqual(itemspacekey02.top)
expect(itemspacekey.bottom).assertEqual(itemspacekey02.bottom)
expect(Math.round(itemspacekey02.left - itemspacekey01.right)).assertEqual(vp2px(20))
expect(itemspacekey.right).assertEqual(itemspacekey02.right)
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
itemspacekey = CommonFunc.getComponentRect('itemspacekey');
itemspacekey01 = CommonFunc.getComponentRect('itemspacekey01');
itemspacekey02 = CommonFunc.getComponentRect('itemspacekey02');
itemspacekey03 = CommonFunc.getComponentRect('itemspacekey03');
itemspacekey04 = CommonFunc.getComponentRect('itemspacekey04');
itemspacekey05 = CommonFunc.getComponentRect('itemspacekey05');
itemspacekey06 = CommonFunc.getComponentRect('itemspacekey06');
// After flipping the page.
console.info("After page turning , the itemspacekey.left value is " + JSON.stringify(itemspacekey.left));
console.info("After page turning , the itemspacekey02.left value is " + JSON.stringify(itemspacekey02.left));
expect(itemspacekey.left).assertEqual(itemspacekey02.left);
expect(itemspacekey.top).assertEqual(itemspacekey02.top);
expect(itemspacekey.bottom).assertEqual(itemspacekey02.bottom);
expect(itemspacekey.top).assertEqual(itemspacekey03.top);
expect(itemspacekey.bottom).assertEqual(itemspacekey03.bottom);
expect(Math.round(itemspacekey03.left - itemspacekey02.right)).assertEqual(vp2px(20));
expect(itemspacekey.right).assertEqual(itemspacekey03.right)
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('20.00vp');
expect(obj.$attrs.displayCount).assertEqual(2);
console.info('new testSwiperSetItemSpace END');
done();
});
/**
* @tc.number SUB_ACE_SWIPER_ITEMSPACECHANGED_0200
* @tc.name testSwiperSetItemSpaceInvalid
* @tc.desc Set swiper's ItemSpace value ' -20 '.
*/
it('testSwiperSetItemSpaceInvalid', 0, async function (done) {
console.info('new testSwiperSetItemSpaceInvalid START');
globalThis.value.message.notify({name:'itemspace', value: -20});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('itemspacekey');
let obj = JSON.parse(strJson);
let itemspacekey = CommonFunc.getComponentRect('itemspacekey');
let itemspacekey01 = CommonFunc.getComponentRect('itemspacekey01');
let itemspacekey02 = CommonFunc.getComponentRect('itemspacekey02');
let itemspacekey03 = CommonFunc.getComponentRect('itemspacekey03');
let itemspacekey04 = CommonFunc.getComponentRect('itemspacekey04');
let itemspacekey05 = CommonFunc.getComponentRect('itemspacekey05');
let itemspacekey06 = CommonFunc.getComponentRect('itemspacekey06');
// Before flipping the page.
console.info("Before page turning , the itemspacekey.left value is " + JSON.stringify(itemspacekey.left));
console.info("Before page turning , the itemspacekey01.left value is " + JSON.stringify(itemspacekey01.left));
expect(itemspacekey.left).assertEqual(itemspacekey01.left);
expect(itemspacekey.top).assertEqual(itemspacekey01.top);
expect(itemspacekey.bottom).assertEqual(itemspacekey01.bottom);
expect(itemspacekey.top).assertEqual(itemspacekey02.top);
expect(itemspacekey.bottom).assertEqual(itemspacekey02.bottom);
expect(itemspacekey02.left).assertEqual(itemspacekey01.right);
expect(itemspacekey02.right).assertEqual(itemspacekey.right);
// After flipping the page.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
itemspacekey = CommonFunc.getComponentRect('itemspacekey');
itemspacekey01 = CommonFunc.getComponentRect('itemspacekey01');
itemspacekey02 = CommonFunc.getComponentRect('itemspacekey02');
itemspacekey03 = CommonFunc.getComponentRect('itemspacekey03');
itemspacekey04 = CommonFunc.getComponentRect('itemspacekey04');
itemspacekey05 = CommonFunc.getComponentRect('itemspacekey05');
itemspacekey06 = CommonFunc.getComponentRect('itemspacekey06');
console.info("After page turning , the itemspacekey.left value is " + JSON.stringify(itemspacekey.left));
console.info("After page turning , the itemspacekey02.left value is " + JSON.stringify(itemspacekey02.left));
expect(itemspacekey.left).assertEqual(itemspacekey02.left);
expect(itemspacekey.top).assertEqual(itemspacekey02.top);
expect(itemspacekey.bottom).assertEqual(itemspacekey02.bottom);
expect(itemspacekey.top).assertEqual(itemspacekey03.top);
expect(itemspacekey.bottom).assertEqual(itemspacekey03.bottom);
expect(itemspacekey03.left).assertEqual(itemspacekey02.right);
expect(itemspacekey03.right).assertEqual(itemspacekey.right);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(2);
console.info('new testSwiperSetItemSpaceInvalid END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperLoopFalse() {
describe('swiperLoopTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperLoopFalse',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperLoopFalse state success " + JSON.stringify(pages));
if (!("swiperLoopFalse" == pages.name)) {
console.info("get swiperLoopFalse state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperLoopFalse page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperLoopFalse page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'swiperLoop', value: true});
globalThis.value.message.notify({name:'index', value: 0});
console.info("swiperVertical after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_LOOPCHANGED_0200
* @tc.name testSwiperSetLoopFalse
* @tc.desc Set swiper's Loop value ' false '.
*/
it('testSwiperSetLoopFalse', 0, async function (done) {
console.info('new testSwiperSetLoopFalse START');
await CommonFunc.sleep(2000);
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
let loopFalse = CommonFunc.getComponentRect('loopFalse');
let strJson = getInspectorByKey('loopFalse');
let obj = JSON.parse(strJson);
let loopFalse01 = CommonFunc.getComponentRect('loopFalse01');
let loopFalse02 = CommonFunc.getComponentRect('loopFalse02');
let loopFalse03 = CommonFunc.getComponentRect('loopFalse03');
let loopFalse04 = CommonFunc.getComponentRect('loopFalse04');
let loopFalse05 = CommonFunc.getComponentRect('loopFalse05');
let loopFalse06 = CommonFunc.getComponentRect('loopFalse06');
// After flipping the page
console.info("After page turning , the loopFalse.left value is " + JSON.stringify(loopFalse.left));
console.info("After page turning , the loopFalse06.left value is " + JSON.stringify(loopFalse06.left));
expect(loopFalse.left).assertEqual(loopFalse06.left);
expect(loopFalse.right).assertEqual(loopFalse06.right);
expect(loopFalse.top).assertEqual(loopFalse06.top);
expect(loopFalse.bottom).assertEqual(loopFalse06.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('5');
expect(obj.$attrs.autoPlay).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('false');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperSetLoopFalse END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperLoopTrue() {
describe('swiperLoopTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperLoopTrue',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperLoopTrue state success " + JSON.stringify(pages));
if (!("swiperLoopTrue" == pages.name)) {
console.info("get swiperLoopTrue state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperLoopTrue page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperLoopTrue page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'swiperLoop', value: true});
globalThis.value.message.notify({name:'index', value: 0});
console.info("swiperVertical after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_LOOPCHANGED_0100
* @tc.name testSwiperSetLoopTrue
* @tc.desc Set swiper's Loop value ' true '.
*/
it('testSwiperSetLoopTrue', 0, async function (done) {
console.info('new testSwiperSetLoopTrue START');
await CommonFunc.sleep(1000);
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
let loopTrue = CommonFunc.getComponentRect('loopTrue');
let strJson = getInspectorByKey('loopTrue');
let obj = JSON.parse(strJson);
let loopTrue01 = CommonFunc.getComponentRect('loopTrue01');
let loopTrue02 = CommonFunc.getComponentRect('loopTrue02');
let loopTrue03 = CommonFunc.getComponentRect('loopTrue03');
let loopTrue04 = CommonFunc.getComponentRect('loopTrue04');
let loopTrue05 = CommonFunc.getComponentRect('loopTrue05');
let loopTrue06 = CommonFunc.getComponentRect('loopTrue06');
// After flipping the page
console.info("After page turning , the loopTrue.left value is " + JSON.stringify(loopTrue.left));
console.info("After page turning , the loopTrue02.left value is " + JSON.stringify(loopTrue02.left));
expect(loopTrue.left).assertEqual(loopTrue02.left);
expect(loopTrue.right).assertEqual(loopTrue02.right);
expect(loopTrue.top).assertEqual(loopTrue02.top);
expect(loopTrue.bottom).assertEqual(loopTrue02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('1');
expect(obj.$attrs.autoPlay).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperSetLoopTrue END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperMarPad() {
describe('swiperMarPadTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperMarPad',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperMarPad state success " + JSON.stringify(pages));
if (!("swiperMarPad" == pages.name)) {
console.info("get swiperMarPad state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperMarPad page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperMarPad page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("swiperVertical after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_MARPAD_0300
* @tc.name testSwiperSetPaddingMargin.
* @tc.desc Set swiper's padding and margin both values '20'.
*/
it('testSwiperSetPaddingMargin', 0, async function (done) {
console.info('new testSwiperSetPaddingMargin START');
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('swiperMarPad');
let obj = JSON.parse(strJson);
let swiperMarPad = CommonFunc.getComponentRect('swiperMarPad');
let swiperMarPad01= CommonFunc.getComponentRect('swiperMarPad01');
let swiperMarPad02 = CommonFunc.getComponentRect('swiperMarPad02');
let swiperMarPad03= CommonFunc.getComponentRect('swiperMarPad03');
let swiperMarPad04 = CommonFunc.getComponentRect('swiperMarPad04');
let swiperMarPad05= CommonFunc.getComponentRect('swiperMarPad05');
let swiperMarPad06 = CommonFunc.getComponentRect('swiperMarPad06');
// Before flipping the page
console.info("Before page turning , swiperMarPad01.left - swiperMarPad.left value is " + JSON.stringify(swiperMarPad01.left - swiperMarPad.left));
expect(swiperMarPad01.left - swiperMarPad.left).assertEqual(vp2px(20));
expect(swiperMarPad.right - swiperMarPad01.right).assertEqual(vp2px(20));
expect(swiperMarPad01.top - swiperMarPad.top).assertEqual(vp2px(20));
expect(swiperMarPad.bottom - swiperMarPad01.bottom).assertEqual(vp2px(20));
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
swiperMarPad = CommonFunc.getComponentRect('swiperMarPad');
swiperMarPad01 = CommonFunc.getComponentRect('swiperMarPad01');
swiperMarPad02 = CommonFunc.getComponentRect('swiperMarPad02');
swiperMarPad03 = CommonFunc.getComponentRect('swiperMarPad03');
swiperMarPad04 = CommonFunc.getComponentRect('swiperMarPad04');
swiperMarPad05 = CommonFunc.getComponentRect('swiperMarPad05');
swiperMarPad06 = CommonFunc.getComponentRect('swiperMarPad06');
// After flipping the page.
console.info("After page turning, swiperMarPad02.left - swiperMarPad.left value is " + JSON.stringify(swiperMarPad02.left - swiperMarPad.left));
expect(swiperMarPad02.left - swiperMarPad.left).assertEqual(vp2px(20));
expect(swiperMarPad.right - swiperMarPad02.right).assertEqual(vp2px(20));
expect(swiperMarPad02.top - swiperMarPad.top).assertEqual(vp2px(20));
expect(swiperMarPad.bottom - swiperMarPad02.bottom).assertEqual(vp2px(20));
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The indicator value is " + JSON.stringify(obj.$attrs.indicator));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperSetPaddingMargin END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperMargin() {
describe('swiperMarPadTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperMargin',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperMargin state success " + JSON.stringify(pages));
if (!("swiperMargin" == pages.name)) {
console.info("get swiperMargin state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperMargin page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperMargin page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("swiperVertical after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_MARPAD_0200
* @tc.name testSwiperSetMargin.
* @tc.desc Set swiper's margin values '20'.
*/
it('testSwiperSetMargin', 0, async function (done) {
console.info('new testSwiperSetMargin START');
let strJson = getInspectorByKey('swiperMargin');
let obj = JSON.parse(strJson);
await CommonFunc.sleep(1000);
let swiperMargin = CommonFunc.getComponentRect('swiperMargin');
let swiperMargin01= CommonFunc.getComponentRect('swiperMargin01');
let swiperMargin02 = CommonFunc.getComponentRect('swiperMargin02');
let swiperMargin03= CommonFunc.getComponentRect('swiperMargin03');
let swiperMargin04 = CommonFunc.getComponentRect('swiperMargin04');
let swiperMargin05= CommonFunc.getComponentRect('swiperMargin05');
let swiperMargin06 = CommonFunc.getComponentRect('swiperMargin06');
// Before flipping the page
console.info("Before page turning , the swiperMargin.left value is " + JSON.stringify(swiperMargin.left));
console.info("Before page turning , the swiperMargin01.left value is " + JSON.stringify(swiperMargin01.left));
expect(swiperMargin.left).assertEqual(swiperMargin01.left);
expect(swiperMargin.right).assertEqual(swiperMargin01.right);
expect(swiperMargin.top).assertEqual(swiperMargin01.top);
expect(swiperMargin.bottom).assertEqual(swiperMargin01.bottom);
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
swiperMargin = CommonFunc.getComponentRect('swiperMargin');
swiperMargin01 = CommonFunc.getComponentRect('swiperMargin01');
swiperMargin02 = CommonFunc.getComponentRect('swiperMargin02');
swiperMargin03 = CommonFunc.getComponentRect('swiperMargin03');
swiperMargin04 = CommonFunc.getComponentRect('swiperMargin04');
swiperMargin05 = CommonFunc.getComponentRect('swiperMargin05');
swiperMargin06 = CommonFunc.getComponentRect('swiperMargin06');
// After flipping the page.
console.info("After page turning , the swiperMargin.left value is " + JSON.stringify(swiperMargin.left));
console.info("After page turning , the swiperMargin02.left value is " + JSON.stringify(swiperMargin02.left));
expect(swiperMargin.left).assertEqual(swiperMargin02.left);
expect(swiperMargin.right).assertEqual(swiperMargin02.right);
expect(swiperMargin.top).assertEqual(swiperMargin02.top);
expect(swiperMargin.bottom).assertEqual(swiperMargin02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The indicator value is " + JSON.stringify(obj.$attrs.indicator));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperSetMargin END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperPadding() {
describe('swiperMarPadTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperPadding',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperPadding state success " + JSON.stringify(pages));
if (!("swiperPadding" == pages.name)) {
console.info("get swiperPadding state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperPadding page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperPadding page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
console.info("swiperVertical after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_MARPAD_0100
* @tc.name testSwiperSetPadding.
* @tc.desc Set swiper's padding values '20'.
*/
it('testSwiperSetPadding', 0, async function (done) {
console.info('new testSwiperSetPadding START');
let strJson = getInspectorByKey('swiperPadding');
let obj = JSON.parse(strJson);
await CommonFunc.sleep(1000);
let swiperPadding = CommonFunc.getComponentRect('swiperPadding');
let swiperPadding01= CommonFunc.getComponentRect('swiperPadding01');
let swiperPadding02 = CommonFunc.getComponentRect('swiperPadding02');
let swiperPadding03= CommonFunc.getComponentRect('swiperPadding03');
let swiperPadding04 = CommonFunc.getComponentRect('swiperPadding04');
let swiperPadding05= CommonFunc.getComponentRect('swiperPadding05');
let swiperPadding06 = CommonFunc.getComponentRect('swiperPadding06');
// Before flipping the page
console.info("Before page turning , swiperPadding01.left - swiperPadding.left value is " + JSON.stringify(swiperPadding01.left - swiperPadding.left));
expect(swiperPadding01.left - swiperPadding.left).assertEqual(vp2px(20))
expect(swiperPadding.right - swiperPadding01.right).assertEqual(vp2px(20))
expect(swiperPadding01.top - swiperPadding.top).assertEqual(vp2px(20))
expect(swiperPadding.bottom - swiperPadding01.bottom).assertEqual(vp2px(20))
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
swiperPadding = CommonFunc.getComponentRect('swiperPadding');
swiperPadding01 = CommonFunc.getComponentRect('swiperPadding01');
swiperPadding02 = CommonFunc.getComponentRect('swiperPadding02');
swiperPadding03 = CommonFunc.getComponentRect('swiperPadding03');
swiperPadding04 = CommonFunc.getComponentRect('swiperPadding04');
swiperPadding05 = CommonFunc.getComponentRect('swiperPadding05');
swiperPadding06 = CommonFunc.getComponentRect('swiperPadding06');
// After flipping the page.
console.info("After page turning, swiperPadding02.left - swiperPadding.left value is " + JSON.stringify(swiperPadding02.left - swiperPadding.left));
expect(swiperPadding02.left - swiperPadding.left).assertEqual(vp2px(20));
expect(swiperPadding.right - swiperPadding02.right).assertEqual(vp2px(20));
expect(swiperPadding02.top - swiperPadding.top).assertEqual(vp2px(20));
expect(swiperPadding.bottom - swiperPadding02.bottom).assertEqual(vp2px(20));
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The indicator value is " + JSON.stringify(obj.$attrs.indicator));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwiperSetPadding END');
done();
});
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 "@ohos/hypium";
import router from '@system.router';
import CommonFunc from "../../../MainAbility/common/Common";
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton } from '@ohos.UiTest';
export default function swiperVertical() {
describe('swiperVerticalTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'MainAbility/pages/Swiper/Swiper_ParmsChange/swiperVertical',
}
try {
router.clear();
await CommonFunc.sleep(1000);
let pages = router.getState();
console.info("get swiperVertical state success " + JSON.stringify(pages));
if (!("swiperVertical" == pages.name)) {
console.info("get swiperVertical state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push swiperVertical page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiperVertical page error " + JSON.stringify(err));
}
});
afterEach(async function () {
await CommonFunc.sleep(1000);
globalThis.value.message.notify({name:'swiperVertical', value: false});
console.info("swiperVertical after each called");
});
/**
* @tc.number SUB_ACE_SWIPER_VERTICALCHANGED_0100
* @tc.name testSwipeSetVerticalFalse
* @tc.desc Set swiper's vertical value ' false '.
*/
it('testSwipeSetVerticalFalse', 0, async function (done) {
console.info('new testSwipeSetVerticalFalse START');
let strJson = getInspectorByKey('verticalkey');
let obj = JSON.parse(strJson);
let verticalkey = CommonFunc.getComponentRect('verticalkey');
let verticalkey01 = CommonFunc.getComponentRect('verticalkey01');
let verticalkey02 = CommonFunc.getComponentRect('verticalkey02');
// Before flipping the page.
console.info("Before page turning , the verticalkey.left value is " + JSON.stringify(verticalkey.left));
console.info("Before page turning , the verticalkey01.left value is " + JSON.stringify(verticalkey01.left));
expect(verticalkey.left).assertEqual(verticalkey01.left);
expect(verticalkey.right).assertEqual(verticalkey01.right);
expect(verticalkey.top).assertEqual(verticalkey01.top);
expect(verticalkey.bottom).assertEqual(verticalkey01.bottom);
// Page turning.
let driver = await Driver.create();
await driver.swipe(250, 230, 200, 230);
await CommonFunc.sleep(1000);
verticalkey01 = CommonFunc.getComponentRect('verticalkey01');
verticalkey02 = CommonFunc.getComponentRect('verticalkey02');
// After flipping the page.
console.info("After page turning , the verticalkey.left value is " + JSON.stringify(verticalkey.left));
console.info("After page turning , the verticalkey02.left value is " + JSON.stringify(verticalkey02.left));
expect(verticalkey.left).assertEqual(verticalkey02.left);
expect(verticalkey.right).assertEqual(verticalkey02.right);
expect(verticalkey.top).assertEqual(verticalkey02.top);
expect(verticalkey.bottom).assertEqual(verticalkey02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The vertical value is " + JSON.stringify(obj.$attrs.vertical));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('0');
expect(obj.$attrs.autoPlay).assertEqual('false');
expect(obj.$attrs.vertical).assertEqual('false');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwipeSetVerticalFalse END');
done();
});
/**
* @tc.number SUB_ACE_SWIPER_VERTICALCHANGED_0200
* @tc.name testSwipeSetVerticalTrue
* @tc.desc Set swiper's vertical value ' true '.
*/
it('testSwipeSetVerticalTrue', 0, async function (done) {
console.info('new testSwipeSetVerticalTrue START');
globalThis.value.message.notify({name:'swiperVertical', value: true});
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('verticalkey');
let obj = JSON.parse(strJson);
let verticalkey = CommonFunc.getComponentRect('verticalkey');
let verticalkey01 = CommonFunc.getComponentRect('verticalkey01');
let verticalkey02 = CommonFunc.getComponentRect('verticalkey02');
// Before flipping the page.
console.info("Before page turning , the verticalkey.left value is " + JSON.stringify(verticalkey.left));
console.info("Before page turning , the verticalkey01.left value is " + JSON.stringify(verticalkey01.left));
expect(verticalkey.left).assertEqual(verticalkey01.left);
expect(verticalkey.right).assertEqual(verticalkey01.right);
expect(verticalkey.top).assertEqual(verticalkey01.top);
expect(verticalkey.bottom).assertEqual(verticalkey01.bottom);
// Page turning.
let driver = await Driver.create();
await driver.swipe(230, 250, 230, 200);
await CommonFunc.sleep(1000);
verticalkey01 = CommonFunc.getComponentRect('verticalkey01');
verticalkey02 = CommonFunc.getComponentRect('verticalkey02');
// After flipping the page.
console.info("After page turning , the verticalkey.left value is " + JSON.stringify(verticalkey.left));
console.info("After page turning , the verticalkey02.left value is " + JSON.stringify(verticalkey02.left));
expect(verticalkey.left).assertEqual(verticalkey02.left);
expect(verticalkey.right).assertEqual(verticalkey02.right);
expect(verticalkey.top).assertEqual(verticalkey02.top);
expect(verticalkey.bottom).assertEqual(verticalkey02.bottom);
console.info("The type value is " + JSON.stringify(obj.$type));
console.info("The index value is " + JSON.stringify(obj.$attrs.index));
console.info("The autoPlay value is " + JSON.stringify(obj.$attrs.autoPlay));
console.info("The vertical value is " + JSON.stringify(obj.$attrs.vertical));
console.info("The loop value is " + JSON.stringify(obj.$attrs.loop));
console.info("The itemSpace value is " + JSON.stringify(obj.$attrs.itemSpace));
console.info("The displayCount value is " + JSON.stringify(obj.$attrs.displayCount));
expect(obj.$type).assertEqual('Swiper');
expect(obj.$attrs.index).assertEqual('0');
expect(obj.$attrs.autoPlay).assertEqual('false');
expect(obj.$attrs.vertical).assertEqual('true');
expect(obj.$attrs.loop).assertEqual('true');
expect(obj.$attrs.itemSpace).assertEqual('0.00vp');
expect(obj.$attrs.displayCount).assertEqual(1);
console.info('new testSwipeSetVerticalTrue END');
done();
});
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册