-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/9.0.1xx-preview7] Obsolete legacy measure calls (#23948)
* Obsolete legacy measure calls * - no warn * - fix more no warn * - more no warn --------- Co-authored-by: Shane Neuville <[email protected]>
- Loading branch information
1 parent
2317e1a
commit 62197f4
Showing
82 changed files
with
1,015 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/Compatibility/Core/tests/Compatibility.UnitTests/BaseTestFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Threading; | ||
using Microsoft.Maui.ApplicationModel; | ||
using Microsoft.Maui.Controls.Internals; | ||
using Microsoft.Maui.Devices; | ||
using Microsoft.Maui.Dispatching; | ||
using Microsoft.Maui.UnitTests; | ||
using Xunit; | ||
|
||
// By default, xUnit will run test collections (the tests in each class) in parallel | ||
// with other test collections. Unfortunately, a _ton_ of the Controls legacy tests | ||
// interact with properties on static classes (e.g., Application.Current), and if we | ||
// let them run in parallel they'll step on one another. So we tell xUnit to consider | ||
// the whole assembly as a single collection for now, so all the tests run in sequence. | ||
// (Hopefully in the future we can untangle some of the singletons and run these in parallel, | ||
// because it'll be a lot faster.) | ||
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] | ||
|
||
namespace Microsoft.Maui.Controls.Core.UnitTests | ||
{ | ||
public class BaseTestFixture : IDisposable | ||
{ | ||
CultureInfo _defaultCulture; | ||
CultureInfo _defaultUICulture; | ||
|
||
public BaseTestFixture() | ||
{ | ||
Microsoft.Maui.Controls.Hosting.CompatibilityCheck.UseCompatibility(); | ||
_defaultCulture = System.Threading.Thread.CurrentThread.CurrentCulture; | ||
_defaultUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture; | ||
DispatcherProvider.SetCurrent(new DispatcherProviderStub()); | ||
DeviceDisplay.SetCurrent(null); | ||
DeviceInfo.SetCurrent(null); | ||
AppInfo.SetCurrent(null); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
Dispose(true); | ||
GC.SuppressFinalize(this); | ||
} | ||
|
||
bool _disposed; | ||
|
||
protected virtual void Dispose(bool disposing) | ||
{ | ||
if (_disposed) | ||
{ | ||
return; | ||
} | ||
|
||
if (disposing) | ||
{ | ||
AppInfo.SetCurrent(null); | ||
DeviceDisplay.SetCurrent(null); | ||
DeviceInfo.SetCurrent(null); | ||
System.Threading.Thread.CurrentThread.CurrentCulture = _defaultCulture; | ||
System.Threading.Thread.CurrentThread.CurrentUICulture = _defaultUICulture; | ||
DispatcherProvider.SetCurrent(null); | ||
} | ||
|
||
_disposed = true; | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/Compatibility/Core/tests/Compatibility.UnitTests/FrameUnitTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Linq; | ||
using Microsoft.Maui.Graphics; | ||
using Xunit; | ||
|
||
|
||
namespace Microsoft.Maui.Controls.Core.UnitTests; | ||
|
||
public class FrameUnitTests : BaseTestFixture | ||
{ | ||
[Fact] | ||
public void TestPackWithoutChild() | ||
{ | ||
Frame frame = new Frame(); | ||
|
||
var parent = new NaiveLayout(); | ||
|
||
bool thrown = false; | ||
try | ||
{ | ||
parent.Children.Add(frame); | ||
} | ||
catch | ||
{ | ||
thrown = true; | ||
} | ||
|
||
Assert.False(thrown); | ||
} | ||
|
||
[Fact] | ||
public void TestPackWithChild() | ||
{ | ||
Frame frame = new Frame | ||
{ | ||
Content = new View() | ||
}; | ||
|
||
var parent = new NaiveLayout(); | ||
|
||
bool thrown = false; | ||
try | ||
{ | ||
parent.Children.Add(frame); | ||
} | ||
catch | ||
{ | ||
thrown = true; | ||
} | ||
|
||
Assert.False(thrown); | ||
} | ||
} |
Oops, something went wrong.