Skip to content

Commit b03c54c

Browse files
authored
Merge branch 'master' into dev/fast-pass-rendering
2 parents 7621596 + 4a594a1 commit b03c54c

File tree

7 files changed

+63
-50
lines changed

7 files changed

+63
-50
lines changed

Microsoft.Toolkit.Uwp.UI.Animations/Extensions/StoryboardAnimations.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ public static Task BeginAsync(this Storyboard storyboard)
2323
{
2424
TaskCompletionSource<object?> taskCompletionSource = new TaskCompletionSource<object?>();
2525

26-
storyboard.Completed += (_, _) => taskCompletionSource.SetResult(null);
26+
void OnCompleted(object sender, object e)
27+
{
28+
((Storyboard)sender).Completed -= OnCompleted;
29+
30+
taskCompletionSource.SetResult(null);
31+
}
32+
33+
storyboard.Completed += OnCompleted;
2734

2835
storyboard.Begin();
2936

Microsoft.Toolkit.Uwp.UI.Controls.Core/TabbedCommandBar/TabbedCommandBar.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls">
3+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
4+
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)">
45

56
<ResourceDictionary.MergedDictionaries>
67
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.Core/TabbedCommandBar/TabbedCommandBarItem.xaml" />
@@ -88,7 +89,7 @@
8889
Visibility="{Binding TemplateSettings.OverflowButtonVisibility, RelativeSource={RelativeSource Mode=TemplatedParent}}">
8990
<Button.Flyout>
9091
<Flyout Placement="Bottom"
91-
ShouldConstrainToRootBounds="False">
92+
Windows10version1903:ShouldConstrainToRootBounds="False">
9293
<Flyout.FlyoutPresenterStyle>
9394
<Style TargetType="FlyoutPresenter">
9495
<Setter Property="Padding" Value="0,8" />

Microsoft.Toolkit.Uwp.UI.Controls.Core/TileControl/TileControl.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,21 @@ private async Task<bool> LoadImageBrushAsync(Uri uri)
173173
var loadCompletedSource = new TaskCompletionSource<bool>();
174174
_brushVisual = compositor.CreateSurfaceBrush(_imageSurface);
175175

176-
_imageSurface.LoadCompleted += (s, e) =>
176+
void LoadCompleted(LoadedImageSurface sender, LoadedImageSourceLoadCompletedEventArgs args)
177177
{
178-
if (e.Status == LoadedImageSourceLoadStatus.Success)
178+
sender.LoadCompleted -= LoadCompleted;
179+
180+
if (args.Status == LoadedImageSourceLoadStatus.Success)
179181
{
180182
loadCompletedSource.SetResult(true);
181183
}
182184
else
183185
{
184186
loadCompletedSource.SetException(new ArgumentException("Image loading failed."));
185187
}
186-
};
188+
}
189+
190+
_imageSurface.LoadCompleted += LoadCompleted;
187191

188192
await loadCompletedSource.Task;
189193
_imageSize = _imageSurface.DecodedPhysicalSize;

UnitTests/UnitTests.UWP/Extensions/Test_PointExtensions.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,51 @@ public class Test_PointExtensions
1313
{
1414
[TestCategory("PointExtensions")]
1515
[TestMethod]
16-
[DataRow(0d, 0d, 0, 0)]
17-
[DataRow(0d, 0d, 22, 6.89d)]
16+
[DataRow(0d, 0d, 0d, 0d)]
17+
[DataRow(0d, 0d, 22d, 6.89d)]
1818
[DataRow(3.14d, 6.55f, 3838d, 3.24724928d)]
19-
[DataRow(double.MinValue, double.Epsilon, 22, 0.3248d)]
20-
public static void Test_PointExtensions_ToRect_FromWidthHeight(double width, double height, int x, int y)
19+
[DataRow(double.MaxValue / 2, double.Epsilon, 22d, 0.3248d)]
20+
public void Test_PointExtensions_ToRect_FromWidthHeight(double width, double height, double x, double y)
2121
{
22-
Point p = new Point(x, y);
22+
Point p = new(x, y);
2323
Rect
2424
a = p.ToRect(width, height),
25-
b = new Rect(x, y, width, height);
25+
b = new(x, y, width, height);
2626

2727
Assert.AreEqual(a, b);
2828
}
2929

3030
[TestCategory("SizeExtensions")]
3131
[TestMethod]
32-
[DataRow(0d, 0d, 0, 0)]
33-
[DataRow(0d, 0d, 22, 6.89d)]
32+
[DataRow(0d, 0d, 0d, 0d)]
33+
[DataRow(0d, 0d, 22d, 6.89d)]
3434
[DataRow(3.14d, 6.55f, 3838d, 3.24724928d)]
35-
[DataRow(double.MinValue, double.Epsilon, 22, 0.3248d)]
36-
public static void Test_PointExtensions_ToRect_FromPoint(double width, double height, int x, int y)
35+
[DataRow(double.MaxValue / 2, double.Epsilon, 22, 0.3248d)]
36+
public void Test_PointExtensions_ToRect_FromPoint(double width, double height, double x, double y)
3737
{
3838
Point
39-
p1 = new Point(x, y),
40-
p2 = new Point(x + width, y + height);
39+
p1 = new(x, y),
40+
p2 = new(x + width, y + height);
4141
Rect
4242
a = p1.ToRect(p2),
43-
b = new Rect(p1, p2);
43+
b = new(p1, p2);
4444

4545
Assert.AreEqual(a, b);
4646
}
4747

4848
[TestCategory("SizeExtensions")]
4949
[TestMethod]
50-
[DataRow(0d, 0d, 0, 0)]
51-
[DataRow(0d, 0d, 22, 6.89d)]
50+
[DataRow(0d, 0d, 0d, 0d)]
51+
[DataRow(0d, 0d, 22d, 6.89d)]
5252
[DataRow(3.14d, 6.55f, 3838d, 3.24724928d)]
53-
[DataRow(double.MinValue, double.Epsilon, 22, 0.3248d)]
54-
public static void Test_PointExtensions_ToRect_FromSize(double width, double height, int x, int y)
53+
[DataRow(double.MaxValue / 2, double.Epsilon, 22, 0.3248d)]
54+
public void Test_PointExtensions_ToRect_FromSize(double width, double height, double x, double y)
5555
{
56-
Point p = new Point(x, y);
57-
Size s = new Size(width, height);
56+
Point p = new(x, y);
57+
Size s = new(width, height);
5858
Rect
5959
a = p.ToRect(s),
60-
b = new Rect(p, s);
60+
b = new(p, s);
6161

6262
Assert.AreEqual(a, b);
6363
}

UnitTests/UnitTests.UWP/Extensions/Test_RectExtensions.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ public class Test_RectExtensions
2626
[DataRow(0, 0, 2, 2, -2, 2, 2, 2, true)]// Left bottom corner(0, 2) intersection.
2727
[DataRow(0, 0, 2, 2, 3, 0, 2, 2, false)]// No intersection.
2828
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1117:Parameters should be on same line or separate lines", Justification = "Put the parameters of the same rectangle on the same line is clearer.")]
29-
public static void Test_RectExtensions_IntersectsWith(
29+
public void Test_RectExtensions_IntersectsWith(
3030
double rect1X, double rect1Y, double rect1Width, double rect1Height,
3131
double rect2X, double rect2Y, double rect2Width, double rect2Height,
3232
bool shouldIntersectsWith)
3333
{
34-
var rect1 = new Rect(rect1X, rect1Y, rect1Width, rect1Height);
35-
var rect2 = new Rect(rect2X, rect2Y, rect2Width, rect2Height);
36-
var isIntersectsWith = rect1.IntersectsWith(rect2);
34+
Rect rect1 = new(rect1X, rect1Y, rect1Width, rect1Height);
35+
Rect rect2 = new(rect2X, rect2Y, rect2Width, rect2Height);
36+
bool isIntersectsWith = rect1.IntersectsWith(rect2);
37+
3738
Assert.IsTrue(isIntersectsWith == shouldIntersectsWith);
3839
}
3940
}

UnitTests/UnitTests.UWP/Extensions/Test_SizeExtensions.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,47 @@ public class Test_SizeExtensions
1414
[TestCategory("SizeExtensions")]
1515
[TestMethod]
1616
[DataRow(0d, 0d)]
17-
[DataRow(3.14d, 6.55f)]
18-
[DataRow(double.MinValue, double.Epsilon)]
19-
public static void Test_SizeExtensions_ToRect_FromSize(double width, double height)
17+
[DataRow(3.14d, 6.55d)]
18+
[DataRow(double.MaxValue / 2, double.Epsilon)]
19+
public void Test_SizeExtensions_ToRect_FromSize(double width, double height)
2020
{
21-
Size s = new Size(width, height);
21+
Size s = new(width, height);
2222
Rect
2323
a = s.ToRect(),
24-
b = new Rect(0, 0, s.Width, s.Height);
24+
b = new(0, 0, s.Width, s.Height);
2525

2626
Assert.AreEqual(a, b);
2727
}
2828

2929
[TestCategory("SizeExtensions")]
3030
[TestMethod]
31-
[DataRow(0d, 0d, 0, 0)]
32-
[DataRow(0d, 0d, 22, 6.89d)]
31+
[DataRow(0d, 0d, 0d, 0d)]
32+
[DataRow(0d, 0d, 22d, 6.89d)]
3333
[DataRow(3.14d, 6.55f, 3838d, 3.24724928d)]
34-
[DataRow(double.MinValue, double.Epsilon, 22, 0.3248d)]
35-
public static void Test_SizeExtensions_ToRect_FromSizeAndPosition(double width, double height, int x, int y)
34+
[DataRow(double.MaxValue / 2, double.Epsilon, 22, 0.3248d)]
35+
public void Test_SizeExtensions_ToRect_FromSizeAndPosition(double width, double height, double x, double y)
3636
{
37-
Size s = new Size(width, height);
37+
Size s = new(width, height);
3838
Rect
3939
a = s.ToRect(x, y),
40-
b = new Rect(x, y, s.Width, s.Height);
40+
b = new(x, y, s.Width, s.Height);
4141

4242
Assert.AreEqual(a, b);
4343
}
4444

4545
[TestCategory("SizeExtensions")]
4646
[TestMethod]
47-
[DataRow(0d, 0d, 0, 0)]
48-
[DataRow(0d, 0d, 22, 6.89d)]
47+
[DataRow(0d, 0d, 0d, 0d)]
48+
[DataRow(0d, 0d, 22d, 6.89d)]
4949
[DataRow(3.14d, 6.55f, 3838d, 3.24724928d)]
50-
[DataRow(double.MinValue, double.Epsilon, 22, 0.3248d)]
51-
public static void Test_SizeExtensions_ToRect_FromSizeAndPoint(double width, double height, int x, int y)
50+
[DataRow(double.MaxValue / 2, double.Epsilon, 22d, 0.3248d)]
51+
public void Test_SizeExtensions_ToRect_FromSizeAndPoint(double width, double height, double x, double y)
5252
{
53-
Point p = new Point(x, y);
54-
Size s = new Size(width, height);
53+
Point p = new(x, y);
54+
Size s = new(width, height);
5555
Rect
5656
a = s.ToRect(p),
57-
b = new Rect(p, s);
57+
b = new(p, s);
5858

5959
Assert.AreEqual(a, b);
6060
}

UnitTests/UnitTests.XamlIslands.UWPApp/XamlIslandsTest_StringExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task StringExtensions_GetViewLocalized()
2323
await App.Dispatcher.EnqueueAsync(() =>
2424
{
2525
var xamlRoot = App.XamlRoot;
26-
var str = StringExtensions.GetViewLocalized("abc", xamlRoot.UIContext);
26+
var str = "abc".GetViewLocalized(xamlRoot.UIContext);
2727
Assert.AreEqual("ABCDEF", str);
2828
});
2929
}
@@ -136,4 +136,4 @@ await App.Dispatcher.EnqueueAsync(async () =>
136136
});
137137
}
138138
}
139-
}
139+
}

0 commit comments

Comments
 (0)