Skip to content

[iOS] Fix Issue23377ItemSpacing test failure on candidate branch#34750

Merged
kubaflo merged 1 commit intodotnet:inflight/candidatefrom
Vignesh-SF3580:fix-34493Failure
Mar 31, 2026
Merged

[iOS] Fix Issue23377ItemSpacing test failure on candidate branch#34750
kubaflo merged 1 commit intodotnet:inflight/candidatefrom
Vignesh-SF3580:fix-34493Failure

Conversation

@Vignesh-SF3580
Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Root Cause

PR #34493 correctly reduced UpdateLayout() from N calls to a single call per layout-property change, but it exposed a UIKit behavior where SetCollectionViewLayout(layout, animated: false) can shift the contentOffset on a UICollectionViewCompositionalLayout with estimated item sizes. This causes the scroll position to jump after an ItemSpacing change.

Test name: Issue23377ItemSpacing

Description of change

This PR resolves the Issue23377ItemSpacing test failure on the candidate branch. In ItemsViewController2.UpdateLayout(), the contentOffset is saved before calling SetCollectionViewLayout and explicitly restored afterward, ensuring the scroll position is preserved across layout updates on both iOS and MacCatalyst.

Cause PR: #34493

Test result

Before Issue Fix After Issue Fix

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Mar 31, 2026
@Vignesh-SF3580 Vignesh-SF3580 changed the title Fix Issue23377ItemSpacing test failure on candidate branch [iOS] Fix Issue23377ItemSpacing test failure on candidate branch Mar 31, 2026
@sheiksyedm sheiksyedm marked this pull request as ready for review March 31, 2026 08:01
@sheiksyedm sheiksyedm added area-testing Unit tests, device tests community ✨ Community Contribution labels Mar 31, 2026
@sheiksyedm sheiksyedm requested a review from kubaflo March 31, 2026 08:01
@sheiksyedm
Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@kubaflo kubaflo merged commit d964aeb into dotnet:inflight/candidate Mar 31, 2026
37 of 64 checks passed
Vignesh-SF3580 added a commit to Vignesh-SF3580/maui that referenced this pull request Apr 2, 2026
Vignesh-SF3580 added a commit to Vignesh-SF3580/maui that referenced this pull request Apr 2, 2026
Vignesh-SF3580 added a commit to Vignesh-SF3580/maui that referenced this pull request Apr 2, 2026
Vignesh-SF3580 added a commit to Vignesh-SF3580/maui that referenced this pull request Apr 2, 2026
TamilarasanSF4853 added a commit to TamilarasanSF4853/maui that referenced this pull request Apr 2, 2026
kubaflo pushed a commit that referenced this pull request Apr 3, 2026
…4760)

This pull request primarily introduces platform-specific test handling
and improvements to test reliability and maintainability in the MAUI
test suite. The main changes include adding conditional compilation to
skip or modify tests for specific platforms where features are
unsupported or behave differently, refactoring test code for clarity,
and adjusting data setup for scrolling feature tests.

**Platform-specific test handling:**

* Added `#if TEST_FAILS_ON_WINDOWS` and similar directives to multiple
test files (such as `Issue12131.cs`, `Issue21240.cs`, `Issue31109.cs`,
`Issue32995.cs`, and `TabbedPageFeatureTests.cs`) to skip or adjust
tests on Windows and other platforms where certain features are
unsupported or have known issues. Explanatory comments and links to
relevant GitHub issues are included for context.
[[1]](diffhunk://#diff-4967cd1d24b2578402405e12108feb36d6dbb4cec8fb530dd04da61e6a342abbR1-R3)
[[2]](diffhunk://#diff-6e55c1524ac32eaeddbb0a8804fffb7a6d5ef5127753f194d76c10e77595064cR1-R3)
[[3]](diffhunk://#diff-792c457903e89a20bbebff9ac8872d63fae0b25ba8ce42c16a5339c3d20a7970R1-R2)
[[4]](diffhunk://#diff-60deaf8f74a387042becb5819cac24e499abcca8242abe7f1efb507ddfaa5607R1)
[[5]](diffhunk://#diff-0c14bbbf93a322dc932f523b25c7fcb1e3fb98e6309edc283ec06b074464ca47R322-R323)

* Updated test methods in `Issue13537.cs` to explicitly verify the
triggering of `ApplyQueryAttributes` and simplified navigation
assertions, improving test clarity and reliability.
[[1]](diffhunk://#diff-8a0b88fd536529b3cd914be70ca2a1445f3fb833feaee2c0cba13c2cae76028eL26-R30)
[[2]](diffhunk://#diff-8a0b88fd536529b3cd914be70ca2a1445f3fb833feaee2c0cba13c2cae76028eL40-R49)

**Test reliability and maintainability:**

* Refactored navigation logic in `Issue28722.cs` to use a new
`NavigateBack()` helper method, which handles platform-specific
navigation differences and improves test robustness.

* Adjusted the test for the scrolling feature in
`CollectionView_ScrollingFeatureTests.cs` to include an extra scroll
gesture for Mac Catalyst, addressing platform-specific UI behavior.

**Test data setup improvements:**

* Modified the `CollectionViewViewModel` and related test pages to
accept a new `isScrollingFeatureTest` parameter, allowing for dynamic
adjustment of test data size depending on the test scenario (e.g., more
items for scrolling tests).
[[1]](diffhunk://#diff-df6d5b58c124d80e1fee4d941cdb6e46d17a052ca91274dd76ff2f5b0c495ff3L126-R128)
[[2]](diffhunk://#diff-df6d5b58c124d80e1fee4d941cdb6e46d17a052ca91274dd76ff2f5b0c495ff3L643-R643)
[[3]](diffhunk://#diff-df6d5b58c124d80e1fee4d941cdb6e46d17a052ca91274dd76ff2f5b0c495ff3L679-R680)
[[4]](diffhunk://#diff-df6d5b58c124d80e1fee4d941cdb6e46d17a052ca91274dd76ff2f5b0c495ff3L692-R693)
[[5]](diffhunk://#diff-9bdc032101814c121101794f70453396c96ad8b935758b14b5ee45bebd66b41dL11-R18)

**Test organization:**

* Added or updated conditional compilation blocks to ensure tests are
only compiled and run on supported platforms, reducing noise from known
failures and improving the accuracy of test results.
[[1]](diffhunk://#diff-5cd9b0108cf3bb480e3acc7d1a670c9b55e32c0b5c1fe89de1092e01d34311feR16-R24)
[[2]](diffhunk://#diff-0c14bbbf93a322dc932f523b25c7fcb1e3fb98e6309edc283ec06b074464ca47R350)
[[3]](diffhunk://#diff-4967cd1d24b2578402405e12108feb36d6dbb4cec8fb530dd04da61e6a342abbR36)
[[4]](diffhunk://#diff-6e55c1524ac32eaeddbb0a8804fffb7a6d5ef5127753f194d76c10e77595064cR33)
[[5]](diffhunk://#diff-792c457903e89a20bbebff9ac8872d63fae0b25ba8ce42c16a5339c3d20a7970R76)
[[6]](diffhunk://#diff-60deaf8f74a387042becb5819cac24e499abcca8242abe7f1efb507ddfaa5607R26)

**Test image resaving:**
* Resaved the valid images on the Android, iOS, macOS, and Windows
platforms

These changes collectively improve the reliability, maintainability, and
clarity of the MAUI test suite across different platforms.

Reverted this PR ##34750 changes that
is added for one test failures, but its not need.

Fixes: #34617

---------

Co-authored-by: NafeelaNazhir <nafeela.nazhirhussain@syncfusion.com>
Co-authored-by: HarishKumarSF4517 <harish.kumar@syncfusion.com>
Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: LogishaSelvarajSF4525 <logisha.selvaraj@syncfusion.com>
Co-authored-by: Ahamed-Ali <102580874+Ahamed-Ali@users.noreply.github.com>
sheiksyedm pushed a commit that referenced this pull request Apr 4, 2026
)

> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Root Cause
PR #34493 correctly reduced UpdateLayout() from N calls to a single call
per layout-property change, but it exposed a UIKit behavior where
SetCollectionViewLayout(layout, animated: false) can shift the
contentOffset on a UICollectionViewCompositionalLayout with estimated
item sizes. This causes the scroll position to jump after an ItemSpacing
change.

**Test name:** Issue23377ItemSpacing
 
### Description of change
This PR resolves the `Issue23377ItemSpacing` test failure on the
candidate branch. In ItemsViewController2.UpdateLayout(), the
contentOffset is saved before calling SetCollectionViewLayout and
explicitly restored afterward, ensuring the scroll position is preserved
across layout updates on both iOS and MacCatalyst.

**Cause PR:** #34493

### Test result
| Before Issue Fix | After Issue Fix |
|----------|----------|
| <img width="300" height="600"
src="https://github.com/user-attachments/assets/d3e7d730-07ec-4987-bb4e-bd5b7c39897b">
| <img width="300" height="600"
src="https://github.com/user-attachments/assets/115e8518-3ae2-40f8-ae3b-e82f8079a5da">
|
sheiksyedm pushed a commit that referenced this pull request Apr 4, 2026
…4760)

This pull request primarily introduces platform-specific test handling
and improvements to test reliability and maintainability in the MAUI
test suite. The main changes include adding conditional compilation to
skip or modify tests for specific platforms where features are
unsupported or behave differently, refactoring test code for clarity,
and adjusting data setup for scrolling feature tests.

**Platform-specific test handling:**

* Added `#if TEST_FAILS_ON_WINDOWS` and similar directives to multiple
test files (such as `Issue12131.cs`, `Issue21240.cs`, `Issue31109.cs`,
`Issue32995.cs`, and `TabbedPageFeatureTests.cs`) to skip or adjust
tests on Windows and other platforms where certain features are
unsupported or have known issues. Explanatory comments and links to
relevant GitHub issues are included for context.
[[1]](diffhunk://#diff-4967cd1d24b2578402405e12108feb36d6dbb4cec8fb530dd04da61e6a342abbR1-R3)
[[2]](diffhunk://#diff-6e55c1524ac32eaeddbb0a8804fffb7a6d5ef5127753f194d76c10e77595064cR1-R3)
[[3]](diffhunk://#diff-792c457903e89a20bbebff9ac8872d63fae0b25ba8ce42c16a5339c3d20a7970R1-R2)
[[4]](diffhunk://#diff-60deaf8f74a387042becb5819cac24e499abcca8242abe7f1efb507ddfaa5607R1)
[[5]](diffhunk://#diff-0c14bbbf93a322dc932f523b25c7fcb1e3fb98e6309edc283ec06b074464ca47R322-R323)

* Updated test methods in `Issue13537.cs` to explicitly verify the
triggering of `ApplyQueryAttributes` and simplified navigation
assertions, improving test clarity and reliability.
[[1]](diffhunk://#diff-8a0b88fd536529b3cd914be70ca2a1445f3fb833feaee2c0cba13c2cae76028eL26-R30)
[[2]](diffhunk://#diff-8a0b88fd536529b3cd914be70ca2a1445f3fb833feaee2c0cba13c2cae76028eL40-R49)

**Test reliability and maintainability:**

* Refactored navigation logic in `Issue28722.cs` to use a new
`NavigateBack()` helper method, which handles platform-specific
navigation differences and improves test robustness.

* Adjusted the test for the scrolling feature in
`CollectionView_ScrollingFeatureTests.cs` to include an extra scroll
gesture for Mac Catalyst, addressing platform-specific UI behavior.

**Test data setup improvements:**

* Modified the `CollectionViewViewModel` and related test pages to
accept a new `isScrollingFeatureTest` parameter, allowing for dynamic
adjustment of test data size depending on the test scenario (e.g., more
items for scrolling tests).
[[1]](diffhunk://#diff-df6d5b58c124d80e1fee4d941cdb6e46d17a052ca91274dd76ff2f5b0c495ff3L126-R128)
[[2]](diffhunk://#diff-df6d5b58c124d80e1fee4d941cdb6e46d17a052ca91274dd76ff2f5b0c495ff3L643-R643)
[[3]](diffhunk://#diff-df6d5b58c124d80e1fee4d941cdb6e46d17a052ca91274dd76ff2f5b0c495ff3L679-R680)
[[4]](diffhunk://#diff-df6d5b58c124d80e1fee4d941cdb6e46d17a052ca91274dd76ff2f5b0c495ff3L692-R693)
[[5]](diffhunk://#diff-9bdc032101814c121101794f70453396c96ad8b935758b14b5ee45bebd66b41dL11-R18)

**Test organization:**

* Added or updated conditional compilation blocks to ensure tests are
only compiled and run on supported platforms, reducing noise from known
failures and improving the accuracy of test results.
[[1]](diffhunk://#diff-5cd9b0108cf3bb480e3acc7d1a670c9b55e32c0b5c1fe89de1092e01d34311feR16-R24)
[[2]](diffhunk://#diff-0c14bbbf93a322dc932f523b25c7fcb1e3fb98e6309edc283ec06b074464ca47R350)
[[3]](diffhunk://#diff-4967cd1d24b2578402405e12108feb36d6dbb4cec8fb530dd04da61e6a342abbR36)
[[4]](diffhunk://#diff-6e55c1524ac32eaeddbb0a8804fffb7a6d5ef5127753f194d76c10e77595064cR33)
[[5]](diffhunk://#diff-792c457903e89a20bbebff9ac8872d63fae0b25ba8ce42c16a5339c3d20a7970R76)
[[6]](diffhunk://#diff-60deaf8f74a387042becb5819cac24e499abcca8242abe7f1efb507ddfaa5607R26)

**Test image resaving:**
* Resaved the valid images on the Android, iOS, macOS, and Windows
platforms

These changes collectively improve the reliability, maintainability, and
clarity of the MAUI test suite across different platforms.

Reverted this PR ##34750 changes that
is added for one test failures, but its not need.

Fixes: #34617

---------

Co-authored-by: NafeelaNazhir <nafeela.nazhirhussain@syncfusion.com>
Co-authored-by: HarishKumarSF4517 <harish.kumar@syncfusion.com>
Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: LogishaSelvarajSF4525 <logisha.selvaraj@syncfusion.com>
Co-authored-by: Ahamed-Ali <102580874+Ahamed-Ali@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-testing Unit tests, device tests community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants