-
Notifications
You must be signed in to change notification settings - Fork 691
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adjust frame coords for LayoutSlot in ListView/GridView
- Loading branch information
Showing
3 changed files
with
117 additions
and
4 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_GridView_Items.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,78 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Uno.UI.RuntimeTests.Helpers; | ||
using Windows.Foundation; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using static Private.Infrastructure.TestServices; | ||
|
||
namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls | ||
{ | ||
#if HAS_UNO | ||
[TestClass] | ||
[RunsOnUIThread] | ||
#if !__IOS__ | ||
[Ignore] | ||
#endif | ||
public class Given_GridView_Items | ||
{ | ||
[TestMethod] | ||
public async Task When_GridViewItems_LayoutSlots() | ||
{ | ||
var gridView = new GridView | ||
{ | ||
ItemContainerStyle = TestsResourceHelper.GetResource<Style>("MyGridViewItemStyle") | ||
}; | ||
|
||
var gvi = new GridViewItem(); | ||
var gvi2 = new GridViewItem(); | ||
|
||
gridView.ItemsSource = new[] { gvi, gvi2 }; | ||
|
||
WindowHelper.WindowContent = gridView; | ||
await WindowHelper.WaitForLoaded(gridView); | ||
await WindowHelper.WaitForIdle(); | ||
|
||
RectAssert.AreEqual(new Rect | ||
{ | ||
X = 0d, | ||
Y = 0d, | ||
Width = 104d, | ||
Height = 104d, | ||
}, | ||
gvi.LayoutSlot); | ||
|
||
RectAssert.AreEqual(new Rect | ||
{ | ||
X = 0d, | ||
Y = 0d, | ||
Width = 100d, | ||
Height = 100d, | ||
}, | ||
gvi.LayoutSlotWithMarginsAndAlignments); | ||
|
||
RectAssert.AreEqual(new Rect | ||
{ | ||
X = 104d, | ||
Y = 0d, | ||
Width = 104d, | ||
Height = 104d, | ||
}, | ||
gvi2.LayoutSlot); | ||
|
||
RectAssert.AreEqual(new Rect | ||
{ | ||
X = 104d, | ||
Y = 0d, | ||
Width = 100d, | ||
Height = 100d, | ||
}, | ||
gvi2.LayoutSlotWithMarginsAndAlignments); | ||
} | ||
} | ||
#endif | ||
} |
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