|
@@ -187,35 +187,29 @@ public class DimAutoTests {
|
|
|
Height = 10
|
|
|
};
|
|
|
|
|
|
- superView.Add (subView);
|
|
|
+ Assert.Throws<InvalidOperationException> (() => superView.Add (subView));
|
|
|
|
|
|
+ subView.Width = 10;
|
|
|
+ superView.Add (subView);
|
|
|
superView.BeginInit ();
|
|
|
superView.EndInit ();
|
|
|
superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
-
|
|
|
- subView.Width = 10;
|
|
|
- subView.Height = Dim.Fill ();
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ superView.LayoutSubviews (); // no throw
|
|
|
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Width = Dim.Fill ());
|
|
|
subView.Width = 10;
|
|
|
- subView.Height = Dim.Percent(50);
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
|
|
|
- subView.Width = 10;
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Height = Dim.Fill ());
|
|
|
subView.Height = 10;
|
|
|
- subView.X = Pos.Center();
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
|
|
|
- subView.Width = 10;
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Height = Dim.Percent (50));
|
|
|
subView.Height = 10;
|
|
|
+
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.X = Pos.Center ());
|
|
|
subView.X = 0;
|
|
|
- subView.Y = Pos.Center ();
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Y = Pos.Center ());
|
|
|
+ subView.Y = 0;
|
|
|
|
|
|
subView.Width = 10;
|
|
|
subView.Height = 10;
|
|
@@ -258,27 +252,21 @@ public class DimAutoTests {
|
|
|
superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
superView.LayoutSubviews (); // no throw
|
|
|
|
|
|
- subView.Height = Dim.Fill () + 3;
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Height = Dim.Fill () + 3);
|
|
|
+ subView.Height = 0;
|
|
|
|
|
|
- subView.Height = 3 + Dim.Fill ();
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Height = 3 + Dim.Fill ());
|
|
|
+ subView.Height = 0;
|
|
|
|
|
|
- subView.Height = 3 + 5 + Dim.Fill ();
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Height = 3 + 5 + Dim.Fill ());
|
|
|
+ subView.Height = 0;
|
|
|
|
|
|
- subView.Height = 3 + 5 + Dim.Percent (10);
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Height = 3 + 5 + Dim.Percent (10));
|
|
|
+ subView.Height = 0;
|
|
|
|
|
|
// Tests nested Combine
|
|
|
- subView.Height = 5 + new Dim.DimCombine (true, 3, new Dim.DimCombine (true, Dim.Percent(10), 9));
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.Height = 5 + new Dim.DimCombine (true, 3, new Dim.DimCombine (true, Dim.Percent (10), 9)));
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -309,18 +297,13 @@ public class DimAutoTests {
|
|
|
superView.Add (subView, subView2);
|
|
|
superView.BeginInit ();
|
|
|
superView.EndInit ();
|
|
|
-
|
|
|
superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
superView.LayoutSubviews (); // no throw
|
|
|
|
|
|
- subView.X = Pos.Right(subView2);
|
|
|
+ subView.X = Pos.Right (subView2);
|
|
|
superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
superView.LayoutSubviews (); // no throw
|
|
|
|
|
|
- subView.X = 3 + Pos.Right (subView2);
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0)); // no throw
|
|
|
- superView.LayoutSubviews (); // no throw
|
|
|
-
|
|
|
subView.X = Pos.Right (subView2) + 3;
|
|
|
superView.SetRelativeLayout (new Rect (0, 0, 0, 0)); // no throw
|
|
|
superView.LayoutSubviews (); // no throw
|
|
@@ -328,31 +311,24 @@ public class DimAutoTests {
|
|
|
subView.X = new Pos.PosCombine (true, Pos.Right (subView2), new Pos.PosCombine (true, 7, 9));
|
|
|
superView.SetRelativeLayout (new Rect (0, 0, 0, 0)); // no throw
|
|
|
|
|
|
- subView.X = Pos.Center () + 3;
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.X = Pos.Center () + 3);
|
|
|
+ subView.X = 0;
|
|
|
|
|
|
- subView.X = 3 + Pos.Center ();
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.X = 3 + Pos.Center ());
|
|
|
+ subView.X = 0;
|
|
|
|
|
|
- subView.X = 3 + 5 + Pos.Center ();
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.X = 3 + 5 + Pos.Center ());
|
|
|
+ subView.X = 0;
|
|
|
|
|
|
- subView.X = 3 + 5 + Pos.Percent (10);
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.X = 3 + 5 + Pos.Percent (10));
|
|
|
+ subView.X = 0;
|
|
|
|
|
|
- subView.X = Pos.Percent (10) + Pos.Center();
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.X = Pos.Percent (10) + Pos.Center ());
|
|
|
+ subView.X = 0;
|
|
|
|
|
|
// Tests nested Combine
|
|
|
- subView.X = 5 + new Pos.PosCombine (true, Pos.Right (subView2), new Pos.PosCombine (true, Pos.Center (), 9));
|
|
|
- superView.SetRelativeLayout (new Rect (0, 0, 0, 0));
|
|
|
- Assert.Throws<InvalidOperationException> (() => superView.LayoutSubviews ());
|
|
|
-
|
|
|
+ Assert.Throws<InvalidOperationException> (() => subView.X = 5 + new Pos.PosCombine (true, Pos.Right (subView2), new Pos.PosCombine (true, Pos.Center (), 9)));
|
|
|
+ subView.X = 0;
|
|
|
}
|
|
|
|
|
|
// Test min - ensure that if min is specified in the DimAuto constructor it is honored
|