-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[net7.0] Make CollectionView on iOS measure to content size (#15652)
* Make CollectionView on iOS measure to content size (#14951) * Make CollectionView on iOS measure to content size Fixes #9135 * Make tests work when device is in landscape * Auto-format source code * Removed extra local variable * Update src/Controls/src/Core/Handlers/Items/ItemsViewHandler.iOS.cs Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * Handle height/width invalidation checks independently --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com> Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> * Remove unused member * Fix alignment check --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com> Co-authored-by: Pedro Jesus <pedrojesus.cefet@gmail.com> Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
- Loading branch information
1 parent
17c7d6c
commit 20097e8
Showing
6 changed files
with
257 additions
and
0 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
44 changes: 44 additions & 0 deletions
44
src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewSizingTestCase.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,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Maui.Controls; | ||
using Xunit.Abstractions; | ||
|
||
namespace Microsoft.Maui.DeviceTests | ||
{ | ||
public class CollectionViewSizingTestCase : IXunitSerializable | ||
{ | ||
public LayoutOptions LayoutOptions { get; private set; } | ||
public LinearItemsLayout ItemsLayout { get; private set; } | ||
|
||
public CollectionViewSizingTestCase() { } | ||
|
||
public CollectionViewSizingTestCase(LayoutOptions layoutOptions, LinearItemsLayout linearItemsLayout) | ||
{ | ||
LayoutOptions = layoutOptions; | ||
ItemsLayout = linearItemsLayout; | ||
} | ||
|
||
public void Deserialize(IXunitSerializationInfo info) | ||
{ | ||
var orientationString = info.GetValue<string>(nameof(ItemsLayout)); | ||
var orientation = (ItemsLayoutOrientation)Enum.Parse(typeof(ItemsLayoutOrientation), orientationString); | ||
ItemsLayout = new LinearItemsLayout(orientation); | ||
|
||
var alignmentString = info.GetValue<string>(nameof(LayoutOptions)); | ||
var alignment = (LayoutAlignment)Enum.Parse(typeof(LayoutAlignment), alignmentString); | ||
LayoutOptions = new LayoutOptions(alignment, false); | ||
} | ||
|
||
public void Serialize(IXunitSerializationInfo info) | ||
{ | ||
info.AddValue(nameof(LayoutOptions), LayoutOptions.Alignment.ToString(), typeof(string)); | ||
info.AddValue(nameof(ItemsLayout), ItemsLayout.Orientation.ToString(), typeof(string)); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
var optionsString = LayoutOptions.Alignment.ToString(); | ||
return $"{ItemsLayout.Orientation}, {optionsString}"; | ||
} | ||
} | ||
} |
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