-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
SliceLayouts.CreateColumnLayout
creating a row layout (#1039)
The tests previously succeeded because: - the `SliceLayoutEngine` record didn't expose the root area, which meant they were not included in the generated `record` `Equals` - apparently casting `ILayoutEngine` to `SliceLayoutEngine` matters 🤷
- Loading branch information
Showing
8 changed files
with
246 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Whim.SliceLayout.Tests; | ||
|
||
public class AreaTests | ||
{ | ||
[Fact] | ||
public void ParentArea_Equals() | ||
{ | ||
// Given | ||
ParentArea area1 = new(isRow: true, (1, new OverflowArea(isRow: true))); | ||
ParentArea area2 = new(isRow: true, (1, new OverflowArea(isRow: true))); | ||
|
||
// Then | ||
area1.Should().BeEquivalentTo(area2); | ||
} | ||
|
||
public static TheoryData<ParentArea, ParentArea> ParentArea_NotEqual => | ||
new() | ||
{ | ||
{ | ||
new(isRow: true, (1, new OverflowArea(isRow: true))), | ||
new(isRow: false, (1, new OverflowArea(isRow: true))) | ||
}, | ||
{ | ||
new(isRow: true, (1, new OverflowArea(isRow: true))), | ||
new(isRow: true, (1, new OverflowArea(isRow: false))) | ||
}, | ||
{ | ||
new(isRow: true, (1, new OverflowArea(isRow: true))), | ||
new(isRow: true, (1, new OverflowArea(isRow: true)), (1, new OverflowArea(isRow: true))) | ||
}, | ||
{ | ||
new(isRow: true, (1, new OverflowArea(isRow: true))), | ||
new(isRow: true, (1, new SliceArea(order: 0, maxChildren: 0))) | ||
}, | ||
}; | ||
|
||
[Theory, MemberData(nameof(ParentArea_NotEqual))] | ||
public void ParentArea_Equals_NotEqual(ParentArea area1, ParentArea area2) | ||
{ | ||
// Then | ||
Assert.NotEqual(area1, area2); | ||
area1.Should().NotBeEquivalentTo(area2); | ||
} | ||
} |
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
Oops, something went wrong.