Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some test methods #14753

Merged
merged 4 commits into from
Apr 24, 2023
Merged

Improve some test methods #14753

merged 4 commits into from
Apr 24, 2023

Conversation

mattleibow
Copy link
Member

@mattleibow mattleibow commented Apr 24, 2023

Description of Change

Just improving some test methods.

Comment on lines -472 to +475
throw new XunitException($"Color {expectedColor} not found.");
throw new XunitException(CreateColorError(bitmap, $"Color {expectedColor} not found."));
Copy link
Member Author

Choose a reason for hiding this comment

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

Add the bitmap contents to the output.

Comment on lines -251 to +254
var window = view.GetParentOfType<Window>() ?? throw new InvalidOperationException("View was attached to a window but there was no window.");
// Window is not a XAML type so is never on the hierarchy
var window = view.GetParentOfType<TestWindowRoot>()?.Window ?? throw new InvalidOperationException("View was attached to a window but there was no window.");
Copy link
Member Author

Choose a reason for hiding this comment

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

This would never work as Window is not a Xaml object.

Comment on lines +368 to +371
public static Task<CanvasBitmap> AssertDoesNotContainColor(this CanvasBitmap bitmap, Graphics.Color unexpectedColor, Func<Graphics.RectF, Graphics.RectF>? withinRectModifier = null)
=> bitmap.AssertDoesNotContainColor(unexpectedColor.ToWindowsColor(), withinRectModifier);

public static async Task<CanvasBitmap> AssertDoesNotContainColor(this CanvasBitmap bitmap, WColor unexpectedColor, Func<Graphics.RectF, Graphics.RectF>? withinRectModifier = null)
Copy link
Member Author

Choose a reason for hiding this comment

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

Add this missing assert.

throw new XunitException($"Color {expectedColor} not found.");
throw new XunitException(CreateColorError(bitmap, $"Color {expectedColor} not found."));
Copy link
Member Author

Choose a reason for hiding this comment

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

Add the bitmap contents to the output.

@PureWeen PureWeen self-requested a review April 24, 2023 20:29
@PureWeen PureWeen enabled auto-merge (squash) April 24, 2023 20:46
@PureWeen PureWeen merged commit 3518fc0 into main Apr 24, 2023
29 checks passed
@PureWeen PureWeen deleted the dev/tests branch April 24, 2023 22:11
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants