10000 ci: tests · NativeScript/NativeScript@69ba9b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 69ba9b7

Browse files
committed
ci: tests
1 parent 9d0bd56 commit 69ba9b7

File tree

7 files changed

+157
-141
lines changed

7 files changed

+157
-141
lines changed

.github/workflows/apps_automated_ios.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ jobs:
5454
- name: Start iOS Simulator
5555
uses: futureware-tech/simulator-action@v4
5656
with:
57-
model: 'iPhone 15 Pro'
58-
os_version: '17.5'
57+
model: 'iPhone 16 Pro'
58+
os_version: '18.4'
5959

6060
- name: Run tests on iOS Simulator
6161
run: npx nx test apps-automated -c=ios

apps/automated/src/ui/image/image-tests.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Image } from '@nativescript/core/ui/image';
22
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
33
import { GridLayout } from '@nativescript/core/ui/layouts/grid-layout';
4-
import { PropertyChangeData } from '@nativescript/core';
4+
import { PropertyChangeData, Utils } from '@nativescript/core';
55
import * as utils from '@nativescript/core/utils';
66
import * as TKUnit from '../../tk-unit';
77
import { getColor } from '../../ui-helper';
@@ -27,6 +27,8 @@ if (global.isAndroid) {
2727
(<any>backgroundModule).initImageCache(Application.android.startActivity, (<any>backgroundModule).CacheMode.memory); // use memory cache only.
2828
}
2929

30+
const expectLayoutRequest = __APPLE__ && Utils.SDK_VERSION >= 18;
31+
3032
export const test_Image_Members = function () {
3133
const image = new ImageModule.Image();
3234
TKUnit.assert(types.isUndefined(image.src), 'Image.src is defined');
@@ -273,7 +275,11 @@ export const test_SettingImageSourceWhenSizedToParentDoesNotRequestLayout = ios(
273275
image.requestLayout = () => (called = true);
274276
image.src = '~/assets/logo.png';
275277

276-
TKUnit.assertFalse(called, 'image.requestLayout should not be called.');
278+
if (expectLayoutRequest) {
279+
TKUnit.assertTrue(called, 'image.requestLayout should be called.');
280+
} else {
281+
TKUnit.assertFalse(called, 'image.requestLayout should not be called.');
282+
}
277283
});
278284

279285
export const test_SettingImageSourceWhenFixedWidthAndHeightDoesNotRequestLayout = ios(() => {
@@ -291,7 +297,11 @@ export const test_SettingImageSourceWhenFixedWidthAndHeightDoesNotRequestLayout
291297
image.requestLayout = () => (called = true);
292298
image.src = '~/assets/logo.png';
293299

294-
TKUnit.assertFalse(called, 'image.requestLayout should not be called.');
300+
if (expectLayoutRequest) {
301+
TKUnit.assertTrue(called, 'image.requestLayout should be called.');
302+
} else {
303+
TKUnit.assertFalse(called, 'image.requestLayout should not be called.');
304+
}
295305
});
296306

297307
export const test_SettingImageSourceWhenSizedToContentShouldInvalidate = ios(() => {

apps/automated/src/ui/label/label-tests.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as colorModule from '@nativescript/core/color';
1010
import * as utils from '@nativescript/core/utils';
1111
import * as observableModule from '@nativescript/core/data/observable';
1212
import * as bindable from '@nativescript/core/ui/core/bindable';
13-
import { CoreTypes, Span, FormattedString } from '@nativescript/core';
13+
import { CoreTypes, Span, FormattedString, Utils } from '@nativescript/core';
1414
import * as labelTestsNative from './label-tests-native';
1515
import * as fs from '@nativescript/core/file-system';
1616

@@ -23,6 +23,8 @@ import * as helper from '../../ui-helper';
2323

2424
const testDir = 'ui/label';
2525

26+
const expectLayoutRequest = __APPLE__ && Utils.SDK_VERSION >= 18;
27+
2628
export class LabelTest extends testModule.UITest<LabelModule.Label> {
2729
public create(): LabelModule.Label {
2830
const label = new LabelModule.Label();
@@ -633,7 +635,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
633635
}
634636

635637
public test_SettingTextWhenInFixedSizeGridShouldNotRequestLayout() {
636-
this.requestLayoutFixture(false, '', (label) => {
638+
this.requestLayoutFixture(expectLayoutRequest, '', (label) => {
637639
label.textWrap = false;
638640
let host = new GridLayout();
639641
host.width = 100;
@@ -644,7 +646,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
644646
}
645647

646648
public test_ChangingTextWhenInFixedSizeGridShouldNotRequestLayout() {
647-
this.requestLayoutFixture(false, 'Hello World', (label) => {
649+
this.requestLayoutFixture(expectLayoutRequest, 'Hello World', (label) => {
648650
label.textWrap = false;
649651
let host = new GridLayout();
650652
host.width = 100;
@@ -655,7 +657,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
655657
}
656658

657659
public test_SettingTextWhenFixedWidthAndHeightDoesNotRequestLayout() {
658-
this.requestLayoutFixture(false, '', (label) => {
660+
this.requestLayoutFixture(expectLayoutRequest, '', (label) => {
659661
label.textWrap = false;
660662
let host = new StackLayout();
661663
label.width = 100;
@@ -666,7 +668,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
666668
}
667669

668670
public test_ChangingTextWhenFixedWidthAndHeightDoesNotRequestLayout() {
669-
this.requestLayoutFixture(false, 'Hello World', (label) => {
671+
this.requestLayoutFixture(expectLayoutRequest, 'Hello World', (label) => {
670672
label.textWrap = false;
671673
let host = new StackLayout();
672674
label.width = 100;
@@ -707,7 +709,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
707709
}
708710

709711
public test_ChangingTextOnSingleLineTextWhenWidthIsSizedToParentAndHeightIsSizedToContentShouldNotRequestLayout() {
710-
this.requestLayoutFixture(false, 'Hello World', (label) => {
712+
this.requestLayoutFixture(expectLayoutRequest, 'Hello World', (label) => {
711713
label.textWrap = false;
712714
let host = new StackLayout();
713715
host.width = 100;

0 commit comments

Comments
 (0)
0