Skip to content

Fixed Test case failure in PR 28867#28964

Merged
PureWeen merged 4 commits intodotnet:inflight/candidatefrom
Ahamed-Ali:TestFailure28530
Apr 15, 2025
Merged

Fixed Test case failure in PR 28867#28964
PureWeen merged 4 commits intodotnet:inflight/candidatefrom
Ahamed-Ali:TestFailure28530

Conversation

@Ahamed-Ali
Copy link
Copy Markdown
Contributor

To fix the flaky ReorderBetweenGroupsShouldNotOccurWhenCanMixGroupsIsFalse test on iOS, I noticed a slight difference between cv1 and cv2. I have now used cv2 to resolve the test case issue.

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Apr 14, 2025
@Ahamed-Ali Ahamed-Ali marked this pull request as ready for review April 14, 2025 06:19
@Ahamed-Ali Ahamed-Ali requested a review from a team as a code owner April 14, 2025 06:19
@Ahamed-Ali Ahamed-Ali requested review from jfversluis and jsuarezruiz and removed request for a team April 14, 2025 06:19

<VerticalStackLayout Padding="10">
<CollectionView
<local:CollectionView2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you share more details about the differences found? Is it necessary to open an issue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While manually testing this drag-and-drop test of CollectionView items locally, we didn't observe any visible differences between CV1 and CV2. However, in CV1, the test consistently fails due to slight differences in the snapshot, even after applying a delay before capturing the image. Therefore, we are adding the test only for CV2 @jsuarezruiz

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ahamed-Ali can you compare these results to main?

The main thing that would be useful to determine here is if the candidate branch has a different behavior from the main branch.

Once we know that we can figure out if we want to

  1. fix this on candidate it there is a difference
  2. just take what you have here and fix on inflight/current at a later point in time.

Copy link
Copy Markdown
Contributor

@albyrock87 albyrock87 Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ahamed-Ali there's a bug in MauiLabel

RectangleF AlignVertical(RectangleF rect)
{
	var frameSize = Frame.Size;
	var height = Lines == 1 ? Font.LineHeight : SizeThatFits(frameSize).Height;
    // ----------------------------------------- ^^^^^^^^ bug here ^^^^^^^^

	if (height < frameSize.Height)

Font.LineHeight does not account for padding, but SizeThatFits does, so that generates a rendering issue under some conditions.

To fix this, we just have to remove the padding on SizeThatFits:

RectangleF AlignVertical(RectangleF rect)
{
	var frameSize = Frame.Size;
	var height = Lines == 1 ? Font.LineHeight : SizeThatFits(frameSize).Height - TextInsets.Top - TextInsets.Bottom;

	if (height < frameSize.Height)

If you do this, you'll see that screenshot will work fine and we also solve a long standing bug.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that would also fix #28180

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will someone open a PR to fix the MauiLabel bug or should I do that?

Copy link
Copy Markdown
Contributor

@MartyIX MartyIX Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will someone open a PR to fix the MauiLabel bug or should I do that?

Please do so :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even after including your fix from #29031, Cv1 still fails when setting the font size on the label @albyrock87

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ahamed-Ali may you expand on this topic?
I clearly remember trying it out in this branch and the vertical alignment of the text was finally right.
So what's failing precisely?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Issue28530 test, a FontSize was previously set for the Label inside the CollectionView template. Due to this, the test consistently failed because of slight differences in the snapshot comparison between cv1 and cv2, as discussed earlier - discussion

I have now removed the FontSize from the Label inside the CollectionView, and the test passes successfully.

However, based on your comment in this discussion, I re-tested the Issue28530 with the FontSize added back in the Label, along with the changes from your PR #29031. The same slight differences between cv1 and cv2 in the snapshot still occur after applying the changes from your PR. @albyrock87

@PureWeen
Copy link
Copy Markdown
Member

/azp run MAUI-UITests-public

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@PureWeen
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen merged commit 04e2982 into dotnet:inflight/candidate Apr 15, 2025
19 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 15, 2025
* Resolved the flakey 28530 test

* Resolved the test failures

* Removed unwanted changes

* Committed the Android image for the modified test
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

collectionview-cv2 community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios test-flight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants