/
FlexOrderTests.cs
44 lines (39 loc) · 1.2 KB
/
FlexOrderTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using NUnit.Framework;
using System;
using System.Globalization;
using System.Threading;
namespace Xamarin.Forms.Core.UnitTests
{
[TestFixture]
public class FlexOrderTests : BaseTestFixture
{
[Test]
public void TestOrderingElements()
{
var label0 = new Label { IsPlatformEnabled = true };
var label1 = new Label { IsPlatformEnabled = true };
var label2 = new Label { IsPlatformEnabled = true };
var label3 = new Label { IsPlatformEnabled = true };
FlexLayout.SetOrder(label3, 0);
FlexLayout.SetOrder(label2, 1);
FlexLayout.SetOrder(label1, 2);
FlexLayout.SetOrder(label0, 3);
var layout = new FlexLayout {
IsPlatformEnabled = true,
Direction = FlexDirection.Column,
Children = {
label0,
label1,
label2,
label3
}
};
layout.Layout(new Rectangle(0, 0, 912, 912));
Assert.That(layout.Bounds, Is.EqualTo(new Rectangle(0, 0, 912, 912)));
Assert.That(label3.Bounds, Is.EqualTo(new Rectangle(0, 0, 912, 20)));
Assert.That(label2.Bounds, Is.EqualTo(new Rectangle(0, 20, 912, 20)));
Assert.That(label1.Bounds, Is.EqualTo(new Rectangle(0, 40, 912, 20)));
Assert.That(label0.Bounds, Is.EqualTo(new Rectangle(0, 60, 912, 20)));
}
}
}