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:
Shane Neuville 2021-03-01 19:25:14 -06:00 коммит произвёл GitHub
Родитель 31f4f9014b
Коммит 77d789ce7b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 20 добавлений и 27 удалений

Просмотреть файл

@ -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;