зеркало из https://github.com/DeGsoft/maui-linux.git
Break up legacy and Maui arrange code (#13908)
* Break up legacy and Maui arrange code * Re-enable the tests (#13906) Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
This commit is contained in:
Родитель
31f4f9014b
Коммит
77d789ce7b
|
@ -42,7 +42,7 @@ steps:
|
|||
displayName: 'XAML Unit Tests'
|
||||
inputs:
|
||||
testAssemblyVer2: |
|
||||
**/bin/$(BuildConfiguration)/**/Xamarin.Forms.Xaml.UnitTests.dll
|
||||
**/bin/$(BuildConfiguration)/**/Microsoft.Maui.Controls.Xaml.UnitTests.dll
|
||||
searchFolder: ${{ parameters.nunitTestFolder }}
|
||||
codeCoverageEnabled: true
|
||||
testRunTitle: '$(BuildConfiguration)_UnitTests'
|
||||
|
@ -55,9 +55,11 @@ steps:
|
|||
displayName: 'Unit Tests'
|
||||
inputs:
|
||||
command: test
|
||||
projects: |
|
||||
**/Xamarin.Forms.Core.UnitTests.csproj
|
||||
**/Xamarin.Platform.Handlers.UnitTests.csproj
|
||||
projects: |
|
||||
**/Controls.Core.UnitTests.csproj
|
||||
**/Core.UnitTests.csproj
|
||||
**/Essentials.UnitTests.csproj
|
||||
**/Resizetizer.UnitTests.csproj
|
||||
arguments: '--configuration $(BuildConfiguration)'
|
||||
|
||||
- task: CopyFiles@2
|
||||
|
|
|
@ -56,7 +56,20 @@ namespace Microsoft.Maui.Controls
|
|||
|
||||
var newRect = this.ComputeFrame(bounds);
|
||||
|
||||
Layout(newRect);
|
||||
Bounds = newRect;
|
||||
Handler?.SetFrame(Bounds);
|
||||
}
|
||||
|
||||
// TODO: MAUI
|
||||
// This is here to support layout calls from legacy code
|
||||
// This should go away once we get everything piping through
|
||||
// Maui based layout code
|
||||
public void Layout(Rectangle bounds)
|
||||
{
|
||||
Bounds = bounds;
|
||||
// If Layout is called without arrange getting called this ensures
|
||||
// all the necessary arranged parts are set so that handlers will layout
|
||||
IsArrangeValid = true;
|
||||
Handler?.SetFrame(Bounds);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,17 +69,6 @@ namespace Microsoft.Maui.Controls
|
|||
}
|
||||
}
|
||||
|
||||
// IFrameworkElement Measure
|
||||
Size IFrameworkElement.Measure(double widthConstraint, double heightConstraint)
|
||||
{
|
||||
if (!IsMeasureValid)
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
DesiredSize = OnSizeRequest(widthConstraint, heightConstraint).Request;
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
IsMeasureValid = true;
|
||||
return DesiredSize;
|
||||
}
|
||||
|
||||
[Obsolete("OnSizeRequest is obsolete as of version 2.2.0. Please use OnMeasure instead.")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
protected override SizeRequest OnSizeRequest(double widthConstraint, double heightConstraint)
|
||||
|
|
|
@ -777,17 +777,6 @@ namespace Microsoft.Maui.Controls
|
|||
return r;
|
||||
}
|
||||
|
||||
public void Layout(Rectangle bounds)
|
||||
{
|
||||
if (Bounds == bounds)
|
||||
return;
|
||||
|
||||
Bounds = bounds;
|
||||
// If Layout is called without arrange getting called this ensures
|
||||
// all the necessary arranged parts are set so that handlers will layout
|
||||
(this as IFrameworkElement).Arrange(bounds);
|
||||
}
|
||||
|
||||
public SizeRequest Measure(double widthConstraint, double heightConstraint, MeasureFlags flags = MeasureFlags.None)
|
||||
{
|
||||
bool includeMargins = (flags & MeasureFlags.IncludeMargins) != 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче