@@ -6,8 +6,6 @@ import * as helper from '../../ui-helper';
66
77const testDir = 'ui/label' ;
88
9- const expectLayoutRequest = __APPLE__ && Utils . SDK_VERSION >= 18 ;
10-
119export class LabelTest extends testModule . UITest < Label > {
1210 public create ( ) : Label {
1311 const label = new Label ( ) ;
@@ -603,7 +601,11 @@ export class LabelTest extends testModule.UITest<Label> {
603601
604602 let mainPage = helper . getCurrentPage ( ) ;
605603 mainPage . content = host ;
606- TKUnit . waitUntilReady ( ( ) => host . isLoaded ) ;
604+
605+ const nativeHostView = host . nativeViewProtected as UIView ;
606+
607+ // Check if native view layer is still marked as dirty before proceeding
608+ TKUnit . waitUntilReady ( ( ) => host . isLoaded && nativeHostView ?. layer && ! nativeHostView . layer . needsLayout ( ) ) ;
607609
608610 let called = false ;
609611 label . requestLayout = ( ) => ( called = true ) ;
@@ -618,7 +620,7 @@ export class LabelTest extends testModule.UITest<Label> {
618620 }
619621
620622 public test_SettingTextWhenInFixedSizeGridShouldNotRequestLayout ( ) {
621- this . requestLayoutFixture ( expectLayoutRequest , '' , ( label ) => {
623+ this . requestLayoutFixture ( false , '' , ( label ) => {
622624 label . textWrap = false ;
623625 let host = new GridLayout ( ) ;
624626 host . width = 100 ;
@@ -629,7 +631,7 @@ export class LabelTest extends testModule.UITest<Label> {
629631 }
630632
631633 public test_ChangingTextWhenInFixedSizeGridShouldNotRequestLayout ( ) {
632- this . requestLayoutFixture ( expectLayoutRequest , 'Hello World' , ( label ) => {
634+ this . requestLayoutFixture ( false , 'Hello World' , ( label ) => {
633635 label . textWrap = false ;
634636 let host = new GridLayout ( ) ;
635637 host . width = 100 ;
@@ -640,7 +642,7 @@ export class LabelTest extends testModule.UITest<Label> {
640642 }
641643
642644 public test_SettingTextWhenFixedWidthAndHeightDoesNotRequestLayout ( ) {
643- this . requestLayoutFixture ( expectLayoutRequest , '' , ( label ) => {
645+ this . requestLayoutFixture ( false , '' , ( label ) => {
644646 label . textWrap = false ;
645647 let host = new StackLayout ( ) ;
646648 label . width = 100 ;
@@ -651,7 +653,7 @@ export class LabelTest extends testModule.UITest<Label> {
651653 }
652654
653655 public test_ChangingTextWhenFixedWidthAndHeightDoesNotRequestLayout ( ) {
654- this . requestLayoutFixture ( expectLayoutRequest , 'Hello World' , ( label ) => {
656+ this . requestLayoutFixture ( false , 'Hello World' , ( label ) => {
655657 label . textWrap = false ;
656658 let host = new StackLayout ( ) ;
657659 label . width = 100 ;
@@ -692,7 +694,7 @@ export class LabelTest extends testModule.UITest<Label> {
692694 }
693695
694696 public test_ChangingTextOnSingleLineTextWhenWidthIsSizedToParentAndHeightIsSizedToContentShouldNotRequestLayout ( ) {
695- this . requestLayoutFixture ( expectLayoutRequest , 'Hello World' , ( label ) => {
697+ this . requestLayoutFixture ( false , 'Hello World' , ( label ) => {
696698 label . textWrap = false ;
697699 let host = new StackLayout ( ) ;
698700 host . width = 100 ;
0 commit comments