mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Dim.Sized -> Dim.Absolute
This commit is contained in:
@@ -232,7 +232,7 @@ public class Dim
|
|||||||
/// <summary>Creates an Absolute <see cref="Dim"/> from the specified integer value.</summary>
|
/// <summary>Creates an Absolute <see cref="Dim"/> from the specified integer value.</summary>
|
||||||
/// <returns>The Absolute <see cref="Dim"/>.</returns>
|
/// <returns>The Absolute <see cref="Dim"/>.</returns>
|
||||||
/// <param name="size">The value to convert to the <see cref="Dim"/>.</param>
|
/// <param name="size">The value to convert to the <see cref="Dim"/>.</param>
|
||||||
public static Dim Sized (int size) { return new DimAbsolute (size); }
|
public static Dim Absolute (int size) { return new DimAbsolute (size); }
|
||||||
|
|
||||||
/// <summary>Creates a <see cref="Dim"/> object that tracks the Width of the specified <see cref="View"/>.</summary>
|
/// <summary>Creates a <see cref="Dim"/> object that tracks the Width of the specified <see cref="View"/>.</summary>
|
||||||
/// <returns>The width <see cref="Dim"/> of the other <see cref="View"/>.</returns>
|
/// <returns>The width <see cref="Dim"/> of the other <see cref="View"/>.</returns>
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ public partial class View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dim _height = Dim.Sized (0);
|
private Dim _height = Dim.Absolute (0);
|
||||||
|
|
||||||
/// <summary>Gets or sets the height dimension of the view.</summary>
|
/// <summary>Gets or sets the height dimension of the view.</summary>
|
||||||
/// <value>The <see cref="Dim"/> object representing the height of the view (the number of rows).</value>
|
/// <value>The <see cref="Dim"/> object representing the height of the view (the number of rows).</value>
|
||||||
@@ -286,7 +286,7 @@ public partial class View
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dim _width = Dim.Sized (0);
|
private Dim _width = Dim.Absolute (0);
|
||||||
|
|
||||||
/// <summary>Gets or sets the width dimension of the view.</summary>
|
/// <summary>Gets or sets the width dimension of the view.</summary>
|
||||||
/// <value>The <see cref="Dim"/> object representing the width of the view (the number of columns).</value>
|
/// <value>The <see cref="Dim"/> object representing the width of the view (the number of columns).</value>
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ public class AllViewsTester : Scenario
|
|||||||
Title = "Size (Dim)"
|
Title = "Size (Dim)"
|
||||||
};
|
};
|
||||||
|
|
||||||
radioItems = new [] { "Auto", "_Percent(width)", "_Fill(width)", "_Sized(width)" };
|
radioItems = new [] { "Auto", "_Percent(width)", "_Fill(width)", "A_bsolute(width)" };
|
||||||
label = new Label { X = 0, Y = 0, Text = "Width:" };
|
label = new Label { X = 0, Y = 0, Text = "Width:" };
|
||||||
_sizeFrame.Add (label);
|
_sizeFrame.Add (label);
|
||||||
_wRadioGroup = new RadioGroup { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
_wRadioGroup = new RadioGroup { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
||||||
@@ -233,7 +233,7 @@ public class AllViewsTester : Scenario
|
|||||||
_sizeFrame.Add (_wText);
|
_sizeFrame.Add (_wText);
|
||||||
_sizeFrame.Add (_wRadioGroup);
|
_sizeFrame.Add (_wRadioGroup);
|
||||||
|
|
||||||
radioItems = new [] { "_Auto", "P_ercent(height)", "F_ill(height)", "Si_zed(height)" };
|
radioItems = new [] { "_Auto", "P_ercent(height)", "F_ill(height)", "Ab_solute(height)" };
|
||||||
label = new Label { X = Pos.Right (_wRadioGroup) + 1, Y = 0, Text = "Height:" };
|
label = new Label { X = Pos.Right (_wRadioGroup) + 1, Y = 0, Text = "Height:" };
|
||||||
_sizeFrame.Add (label);
|
_sizeFrame.Add (label);
|
||||||
_hText = new TextField { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_hVal}" };
|
_hText = new TextField { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_hVal}" };
|
||||||
@@ -444,7 +444,7 @@ public class AllViewsTester : Scenario
|
|||||||
0 => Dim.Auto (),
|
0 => Dim.Auto (),
|
||||||
1 => Dim.Percent (_wVal),
|
1 => Dim.Percent (_wVal),
|
||||||
2 => Dim.Fill (_wVal),
|
2 => Dim.Fill (_wVal),
|
||||||
3 => Dim.Sized (_wVal),
|
3 => Dim.Absolute (_wVal),
|
||||||
_ => view.Width
|
_ => view.Width
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -453,7 +453,7 @@ public class AllViewsTester : Scenario
|
|||||||
0 => Dim.Auto (),
|
0 => Dim.Auto (),
|
||||||
1 => Dim.Percent (_hVal),
|
1 => Dim.Percent (_hVal),
|
||||||
2 => Dim.Fill (_hVal),
|
2 => Dim.Fill (_hVal),
|
||||||
3 => Dim.Sized (_hVal),
|
3 => Dim.Absolute (_hVal),
|
||||||
_ => view.Height
|
_ => view.Height
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ public class ScenarioTests : TestsAllViews
|
|||||||
Title = "Size (Dim)"
|
Title = "Size (Dim)"
|
||||||
};
|
};
|
||||||
|
|
||||||
radioItems = new [] { "Auto()", "Percent(width)", "Fill(width)", "Sized(width)" };
|
radioItems = new [] { "Auto()", "Percent(width)", "Fill(width)", "Absolute(width)" };
|
||||||
label = new () { X = 0, Y = 0, Text = "width:" };
|
label = new () { X = 0, Y = 0, Text = "width:" };
|
||||||
_sizeFrame.Add (label);
|
_sizeFrame.Add (label);
|
||||||
_wRadioGroup = new () { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
_wRadioGroup = new () { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
||||||
@@ -212,7 +212,7 @@ public class ScenarioTests : TestsAllViews
|
|||||||
_sizeFrame.Add (_wText);
|
_sizeFrame.Add (_wText);
|
||||||
_sizeFrame.Add (_wRadioGroup);
|
_sizeFrame.Add (_wRadioGroup);
|
||||||
|
|
||||||
radioItems = new [] { "Auto()", "Percent(height)", "Fill(height)", "Sized(height)" };
|
radioItems = new [] { "Auto()", "Percent(height)", "Fill(height)", "Absolute(height)" };
|
||||||
label = new () { X = Pos.Right (_wRadioGroup) + 1, Y = 0, Text = "height:" };
|
label = new () { X = Pos.Right (_wRadioGroup) + 1, Y = 0, Text = "height:" };
|
||||||
_sizeFrame.Add (label);
|
_sizeFrame.Add (label);
|
||||||
_hText = new () { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_hVal}" };
|
_hText = new () { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_hVal}" };
|
||||||
@@ -408,7 +408,7 @@ public class ScenarioTests : TestsAllViews
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
view.Width = Dim.Sized (_wVal);
|
view.Width = Dim.Absolute (_wVal);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -424,7 +424,7 @@ public class ScenarioTests : TestsAllViews
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
view.Height = Dim.Sized (_hVal);
|
view.Height = Dim.Absolute (_hVal);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ public class AbsoluteLayoutTests
|
|||||||
); // With Absolute Viewport *is* deterministic before Layout
|
); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal ($"Absolute({newFrame.X})", v.X.ToString ());
|
Assert.Equal ($"Absolute({newFrame.X})", v.X.ToString ());
|
||||||
Assert.Equal ($"Absolute({newFrame.Y})", v.Y.ToString ());
|
Assert.Equal ($"Absolute({newFrame.Y})", v.Y.ToString ());
|
||||||
Assert.Equal (Dim.Sized (3), v.Width);
|
Assert.Equal (Dim.Absolute (3), v.Width);
|
||||||
Assert.Equal (Dim.Sized (4), v.Height);
|
Assert.Equal (Dim.Absolute (4), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,8 +180,8 @@ public class AbsoluteLayoutTests
|
|||||||
); // With Absolute Viewport *is* deterministic before Layout
|
); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (0), v.X);
|
Assert.Equal (Pos.Absolute (0), v.X);
|
||||||
Assert.Equal (Pos.Absolute (0), v.Y);
|
Assert.Equal (Pos.Absolute (0), v.Y);
|
||||||
Assert.Equal (Dim.Sized (0), v.Width);
|
Assert.Equal (Dim.Absolute (0), v.Width);
|
||||||
Assert.Equal (Dim.Sized (0), v.Height);
|
Assert.Equal (Dim.Absolute (0), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
|
|
||||||
frame = new Rectangle (1, 2, 3, 4);
|
frame = new Rectangle (1, 2, 3, 4);
|
||||||
@@ -195,8 +195,8 @@ public class AbsoluteLayoutTests
|
|||||||
); // With Absolute Viewport *is* deterministic before Layout
|
); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (3), v.Width);
|
Assert.Equal (Dim.Absolute (3), v.Width);
|
||||||
Assert.Equal (Dim.Sized (4), v.Height);
|
Assert.Equal (Dim.Absolute (4), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
|
|
||||||
v = new View { Frame = frame, Text = "v" };
|
v = new View { Frame = frame, Text = "v" };
|
||||||
@@ -209,8 +209,8 @@ public class AbsoluteLayoutTests
|
|||||||
); // With Absolute Viewport *is* deterministic before Layout
|
); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (3), v.Width);
|
Assert.Equal (Dim.Absolute (3), v.Width);
|
||||||
Assert.Equal (Dim.Sized (4), v.Height);
|
Assert.Equal (Dim.Absolute (4), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
|
|
||||||
v = new View { X = frame.X, Y = frame.Y, Text = "v" };
|
v = new View { X = frame.X, Y = frame.Y, Text = "v" };
|
||||||
@@ -223,8 +223,8 @@ public class AbsoluteLayoutTests
|
|||||||
Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
|
Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (0), v.Width);
|
Assert.Equal (Dim.Absolute (0), v.Width);
|
||||||
Assert.Equal (Dim.Sized (0), v.Height);
|
Assert.Equal (Dim.Absolute (0), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
|
|
||||||
v = new View ();
|
v = new View ();
|
||||||
@@ -233,8 +233,8 @@ public class AbsoluteLayoutTests
|
|||||||
Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
|
Assert.Equal (new Rectangle (0, 0, 0, 0), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (0), v.X);
|
Assert.Equal (Pos.Absolute (0), v.X);
|
||||||
Assert.Equal (Pos.Absolute (0), v.Y);
|
Assert.Equal (Pos.Absolute (0), v.Y);
|
||||||
Assert.Equal (Dim.Sized (0), v.Width);
|
Assert.Equal (Dim.Absolute (0), v.Width);
|
||||||
Assert.Equal (Dim.Sized (0), v.Height);
|
Assert.Equal (Dim.Absolute (0), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
|
|
||||||
v = new View { X = frame.X, Y = frame.Y, Width = frame.Width, Height = frame.Height };
|
v = new View { X = frame.X, Y = frame.Y, Width = frame.Width, Height = frame.Height };
|
||||||
@@ -243,8 +243,8 @@ public class AbsoluteLayoutTests
|
|||||||
Assert.Equal (new Rectangle (0, 0, 3, 4), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
|
Assert.Equal (new Rectangle (0, 0, 3, 4), v.Viewport); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (3), v.Width);
|
Assert.Equal (Dim.Absolute (3), v.Width);
|
||||||
Assert.Equal (Dim.Sized (4), v.Height);
|
Assert.Equal (Dim.Absolute (4), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1011,8 +1011,8 @@ public class DimAutoTests (ITestOutputHelper output)
|
|||||||
{
|
{
|
||||||
X = subViewOffset,
|
X = subViewOffset,
|
||||||
Y = subViewOffset,
|
Y = subViewOffset,
|
||||||
Width = Dim.Sized (dimAbsoluteSize),
|
Width = Dim.Absolute (dimAbsoluteSize),
|
||||||
Height = Dim.Sized (dimAbsoluteSize)
|
Height = Dim.Absolute (dimAbsoluteSize)
|
||||||
};
|
};
|
||||||
view.Add (subview);
|
view.Add (subview);
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ public class DimTests
|
|||||||
{
|
{
|
||||||
var t = new View { Width = 80, Height = 25, Text = "top" };
|
var t = new View { Width = 80, Height = 25, Text = "top" };
|
||||||
|
|
||||||
var w = new Window { Width = Dim.Fill (), Height = Dim.Sized (10) };
|
var w = new Window { Width = Dim.Fill (), Height = Dim.Absolute (10) };
|
||||||
var v = new View { Width = Dim.Width (w) - 2, Height = Dim.Percent (10), Text = "v" };
|
var v = new View { Width = Dim.Width (w) - 2, Height = Dim.Percent (10), Text = "v" };
|
||||||
|
|
||||||
w.Add (v);
|
w.Add (v);
|
||||||
@@ -292,7 +292,7 @@ public class DimTests
|
|||||||
{
|
{
|
||||||
var t = new View { Width = 80, Height = 25, Text = "top" };
|
var t = new View { Width = 80, Height = 25, Text = "top" };
|
||||||
|
|
||||||
var w = new Window { Width = Dim.Fill (), Height = Dim.Sized (10) };
|
var w = new Window { Width = Dim.Fill (), Height = Dim.Absolute (10) };
|
||||||
var v = new View { Width = Dim.Width (w) - 2, Height = Dim.Percent (10), Text = "v" };
|
var v = new View { Width = Dim.Width (w) - 2, Height = Dim.Percent (10), Text = "v" };
|
||||||
|
|
||||||
w.Add (v);
|
w.Add (v);
|
||||||
@@ -434,8 +434,8 @@ public class DimTests
|
|||||||
|
|
||||||
var v4 = new Button
|
var v4 = new Button
|
||||||
{
|
{
|
||||||
Width = Dim.Sized (50),
|
Width = Dim.Absolute (50),
|
||||||
Height = Dim.Sized (50),
|
Height = Dim.Absolute (50),
|
||||||
ValidatePosDim = true,
|
ValidatePosDim = true,
|
||||||
Text = "v4"
|
Text = "v4"
|
||||||
};
|
};
|
||||||
@@ -641,39 +641,39 @@ public class DimTests
|
|||||||
{
|
{
|
||||||
var n1 = 0;
|
var n1 = 0;
|
||||||
var n2 = 0;
|
var n2 = 0;
|
||||||
Dim dim1 = Dim.Sized (n1);
|
Dim dim1 = Dim.Absolute (n1);
|
||||||
Dim dim2 = Dim.Sized (n2);
|
Dim dim2 = Dim.Absolute (n2);
|
||||||
Assert.Equal (dim1, dim2);
|
Assert.Equal (dim1, dim2);
|
||||||
|
|
||||||
n1 = n2 = 1;
|
n1 = n2 = 1;
|
||||||
dim1 = Dim.Sized (n1);
|
dim1 = Dim.Absolute (n1);
|
||||||
dim2 = Dim.Sized (n2);
|
dim2 = Dim.Absolute (n2);
|
||||||
Assert.Equal (dim1, dim2);
|
Assert.Equal (dim1, dim2);
|
||||||
|
|
||||||
n1 = n2 = -1;
|
n1 = n2 = -1;
|
||||||
dim1 = Dim.Sized (n1);
|
dim1 = Dim.Absolute (n1);
|
||||||
dim2 = Dim.Sized (n2);
|
dim2 = Dim.Absolute (n2);
|
||||||
Assert.Equal (dim1, dim2);
|
Assert.Equal (dim1, dim2);
|
||||||
|
|
||||||
n1 = 0;
|
n1 = 0;
|
||||||
n2 = 1;
|
n2 = 1;
|
||||||
dim1 = Dim.Sized (n1);
|
dim1 = Dim.Absolute (n1);
|
||||||
dim2 = Dim.Sized (n2);
|
dim2 = Dim.Absolute (n2);
|
||||||
Assert.NotEqual (dim1, dim2);
|
Assert.NotEqual (dim1, dim2);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void DimSized_SetsValue ()
|
public void DimSized_SetsValue ()
|
||||||
{
|
{
|
||||||
Dim dim = Dim.Sized (0);
|
Dim dim = Dim.Absolute (0);
|
||||||
Assert.Equal ("Absolute(0)", dim.ToString ());
|
Assert.Equal ("Absolute(0)", dim.ToString ());
|
||||||
|
|
||||||
var testVal = 5;
|
var testVal = 5;
|
||||||
dim = Dim.Sized (testVal);
|
dim = Dim.Absolute (testVal);
|
||||||
Assert.Equal ($"Absolute({testVal})", dim.ToString ());
|
Assert.Equal ($"Absolute({testVal})", dim.ToString ());
|
||||||
|
|
||||||
testVal = -1;
|
testVal = -1;
|
||||||
dim = Dim.Sized (testVal);
|
dim = Dim.Absolute (testVal);
|
||||||
Assert.Equal ($"Absolute({testVal})", dim.ToString ());
|
Assert.Equal ($"Absolute({testVal})", dim.ToString ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public class FrameTests (ITestOutputHelper output)
|
|||||||
); // With Absolute Viewport *is* deterministic before Layout
|
); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (30), v.Width);
|
Assert.Equal (Dim.Absolute (30), v.Width);
|
||||||
Assert.Equal (Dim.Sized (40), v.Height);
|
Assert.Equal (Dim.Absolute (40), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
|
|
||||||
v = new View { X = frame.X, Y = frame.Y, Text = "v" };
|
v = new View { X = frame.X, Y = frame.Y, Text = "v" };
|
||||||
@@ -71,8 +71,8 @@ public class FrameTests (ITestOutputHelper output)
|
|||||||
); // With Absolute Viewport *is* deterministic before Layout
|
); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (30), v.Width);
|
Assert.Equal (Dim.Absolute (30), v.Width);
|
||||||
Assert.Equal (Dim.Sized (40), v.Height);
|
Assert.Equal (Dim.Absolute (40), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
|
|
||||||
newFrame = new Rectangle (10, 20, 30, 40);
|
newFrame = new Rectangle (10, 20, 30, 40);
|
||||||
@@ -87,8 +87,8 @@ public class FrameTests (ITestOutputHelper output)
|
|||||||
); // With Absolute Viewport *is* deterministic before Layout
|
); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (10), v.X);
|
Assert.Equal (Pos.Absolute (10), v.X);
|
||||||
Assert.Equal (Pos.Absolute (20), v.Y);
|
Assert.Equal (Pos.Absolute (20), v.Y);
|
||||||
Assert.Equal (Dim.Sized (30), v.Width);
|
Assert.Equal (Dim.Absolute (30), v.Width);
|
||||||
Assert.Equal (Dim.Sized (40), v.Height);
|
Assert.Equal (Dim.Absolute (40), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
|
|
||||||
v = new View { X = frame.X, Y = frame.Y, Text = "v" };
|
v = new View { X = frame.X, Y = frame.Y, Text = "v" };
|
||||||
@@ -102,8 +102,8 @@ public class FrameTests (ITestOutputHelper output)
|
|||||||
); // With Absolute Viewport *is* deterministic before Layout
|
); // With Absolute Viewport *is* deterministic before Layout
|
||||||
Assert.Equal (Pos.Absolute (10), v.X);
|
Assert.Equal (Pos.Absolute (10), v.X);
|
||||||
Assert.Equal (Pos.Absolute (20), v.Y);
|
Assert.Equal (Pos.Absolute (20), v.Y);
|
||||||
Assert.Equal (Dim.Sized (30), v.Width);
|
Assert.Equal (Dim.Absolute (30), v.Width);
|
||||||
Assert.Equal (Dim.Sized (40), v.Height);
|
Assert.Equal (Dim.Absolute (40), v.Height);
|
||||||
v.Dispose ();
|
v.Dispose ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ public class ViewportTests (ITestOutputHelper output)
|
|||||||
Assert.Equal (new Rectangle (0, 0, newViewport.Width, newViewport.Height), v.Viewport);
|
Assert.Equal (new Rectangle (0, 0, newViewport.Width, newViewport.Height), v.Viewport);
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (30), v.Width);
|
Assert.Equal (Dim.Absolute (30), v.Width);
|
||||||
Assert.Equal (Dim.Sized (40), v.Height);
|
Assert.Equal (Dim.Absolute (40), v.Height);
|
||||||
|
|
||||||
newViewport = new Rectangle (0, 0, 3, 4);
|
newViewport = new Rectangle (0, 0, 3, 4);
|
||||||
v.Viewport = newViewport;
|
v.Viewport = newViewport;
|
||||||
@@ -200,8 +200,8 @@ public class ViewportTests (ITestOutputHelper output)
|
|||||||
Assert.Equal (new Rectangle (0, 0, newViewport.Width, newViewport.Height), v.Viewport);
|
Assert.Equal (new Rectangle (0, 0, newViewport.Width, newViewport.Height), v.Viewport);
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (3), v.Width);
|
Assert.Equal (Dim.Absolute (3), v.Width);
|
||||||
Assert.Equal (Dim.Sized (4), v.Height);
|
Assert.Equal (Dim.Absolute (4), v.Height);
|
||||||
|
|
||||||
v.BorderStyle = LineStyle.Single;
|
v.BorderStyle = LineStyle.Single;
|
||||||
|
|
||||||
@@ -212,8 +212,8 @@ public class ViewportTests (ITestOutputHelper output)
|
|||||||
Assert.Equal (new Rectangle (1, 2, 3, 4), v.Frame);
|
Assert.Equal (new Rectangle (1, 2, 3, 4), v.Frame);
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (3), v.Width);
|
Assert.Equal (Dim.Absolute (3), v.Width);
|
||||||
Assert.Equal (Dim.Sized (4), v.Height);
|
Assert.Equal (Dim.Absolute (4), v.Height);
|
||||||
|
|
||||||
// Now set bounds bigger as before
|
// Now set bounds bigger as before
|
||||||
newViewport = new Rectangle (0, 0, 3, 4);
|
newViewport = new Rectangle (0, 0, 3, 4);
|
||||||
@@ -225,8 +225,8 @@ public class ViewportTests (ITestOutputHelper output)
|
|||||||
Assert.Equal (new Rectangle (0, 0, newViewport.Width, newViewport.Height), v.Viewport);
|
Assert.Equal (new Rectangle (0, 0, newViewport.Width, newViewport.Height), v.Viewport);
|
||||||
Assert.Equal (Pos.Absolute (1), v.X);
|
Assert.Equal (Pos.Absolute (1), v.X);
|
||||||
Assert.Equal (Pos.Absolute (2), v.Y);
|
Assert.Equal (Pos.Absolute (2), v.Y);
|
||||||
Assert.Equal (Dim.Sized (5), v.Width);
|
Assert.Equal (Dim.Absolute (5), v.Width);
|
||||||
Assert.Equal (Dim.Sized (6), v.Height);
|
Assert.Equal (Dim.Absolute (6), v.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|||||||
@@ -83,13 +83,16 @@ In v1, `Application.Init` automatically created a toplevel view and set `Applica
|
|||||||
|
|
||||||
## `Pos` and `Dim` types are no-longer internal nested classes
|
## `Pos` and `Dim` types are no-longer internal nested classes
|
||||||
|
|
||||||
In v1, the `Pos` and `Dim` types (e.g. `Pos.PosView`) were nested classes and marked `internal`. In v2, they are no longer nested, and have appropriate public APIs. As part of this, the static method that creates a `PosAbsolute`, `Pos.At`, was renamed to `Pos.Absoulte` for consistency
|
* In v1, the `Pos` and `Dim` types (e.g. `Pos.PosView`) were nested classes and marked `internal`. In v2, they are no longer nested, and have appropriate public APIs.
|
||||||
|
* The static method that creates a `PosAbsolute`, `Pos.At`, was renamed to `Pos.Absolute` for consistency.
|
||||||
|
* The static method that crates as `DimAbsoulte`, `Dim.Sized`, was renamed to `Dim.Absolute` for consistency.
|
||||||
|
|
||||||
### How to Fix
|
### How to Fix
|
||||||
|
|
||||||
* Search and replace `Pos.Pos` -> `Pos`.
|
* Search and replace `Pos.Pos` -> `Pos`.
|
||||||
* Search and replace `Dim.Dim` -> `Dim`.
|
* Search and replace `Dim.Dim` -> `Dim`.
|
||||||
* Search and replace `Pos.At` -> `Pos.Absolute`
|
* Search and replace `Pos.At` -> `Pos.Absolute`
|
||||||
|
* Search and replace `Dim.Sized` -> `Dim.Absolute`
|
||||||
|
|
||||||
## Layout Improvements
|
## Layout Improvements
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user