-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Consolidate handlertestbase #11021
Consolidate handlertestbase #11021
Conversation
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions.
@@ -150,52 +150,7 @@ public async Task FontDoesNotAffectHorizontalTextAlignment(double initialSize, d | |||
nameof(ILabel.Font), | |||
() => label.Font = Font.SystemFontOfSize(newSize)); | |||
} | |||
#if !WINDOWS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved these all into TextStyleHandlerTests
since they apply to anything that implements ITextStyle
7bcf664
to
f5773ca
Compare
d6630e0
to
5ad6384
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for the BlazorWebView device test changes.
var w = size.Width; | ||
var h = size.Height; | ||
|
||
if (double.IsPositiveInfinity(w)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hartez I added this code because all of the ScrollView
tests started failing due to view.Measure
returning infinite size.
I'm wondering if this is actually a bug with ScrollViewHandler
.
The GetDesiredSize
code inside ScrollViewHandler
just returns the constraints back if the ScrollView
has no content (which makes sense)
I wonder if for this scenario the ScrollViewHandler
on iOS should return a size of zero if the content is null and the constraints are infinite.
Something like
if (platformView == null || virtualView == null || virtualView.PresentedContent == null)
{
if (double.IsPositiveInfinity(widthConstraint))
widthConstraint = 0;
if (double.IsPositiveInfinity(heightConstraint))
heightConstraint= 0;
return new Size(widthConstraint, heightConstraint);
}
If this does seem like something we should fix on ScrollViewHandler
I'll do that in a different PR. I'd like this PR to not touch any actual sdk code just test code.
/backport to net7.0 |
Started backporting to net7.0: https://github.com/dotnet/maui/actions/runs/3489791409 |
Description of Change
Currently our
FrameRenderer
doesn't call any of the initial mapper properties that run through thebatch
update. All of the tests for this behavior currently exists insideCore.DeviceTest
on the base handler. The intent of this PR is to move all of that testing code into a re-usable place so thatFrameRenderer
(and other handlers inside Controls) can utilize the tests we have inCore.DeviceTest
to validate that all the defaultViewHandler
mappers. This PR also consolidates a bunch of helper methods that were duplicated betweenCore/Controls
I moved all of the code shared between
Controls/Core.DeviceTests
toCore.DeviceTests.Shared
. These don't seem like things we'd ever really package up and distribute. They are a bit specific to our tests. Anything we'd want to package up we should move toTestUtils
andAssertionExtensions
I tried to rename anything that was a repeated class name. So, now there's only one
HandlerTestBase
,ContextStubBase
, etc..This PR doesn't actually fix
Frame
yet it's mainly just the reorg part of the tests so that I can fixFrame
and add tests here https://github.com/dotnet/maui/pull/10751/files#diff-ad087c312304a6bb9d0b8d53ab57e6d941c1fa937885ad9f10922b1734f2f0d0R118Moved all the
ITextStyle
tests out ofHandlerTestBase
and into a specificTextStyleHandlerBase
so now instead of just having a bunch of noop tests related toTextStyle
they all just run for interfaces that implementITextStyle