mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fix warnings
This commit is contained in:
@@ -454,15 +454,15 @@ public class Pos
|
||||
internal class PosCombine (bool add, Pos left, Pos right) : Pos
|
||||
{
|
||||
internal bool Add { get; set; } = add;
|
||||
internal Pos Left { get; set; } = left;
|
||||
internal Pos Right { get; set; } = right;
|
||||
internal Pos LeftPos { get; set; } = left;
|
||||
internal Pos RightPos { get; set; } = right;
|
||||
|
||||
public override string ToString () { return $"Combine({Left}{(Add ? '+' : '-')}{Right})"; }
|
||||
public override string ToString () { return $"Combine({LeftPos}{(Add ? '+' : '-')}{RightPos})"; }
|
||||
|
||||
internal override int Anchor (int width)
|
||||
{
|
||||
int la = Left.Anchor (width);
|
||||
int ra = Right.Anchor (width);
|
||||
int la = LeftPos.Anchor (width);
|
||||
int ra = RightPos.Anchor (width);
|
||||
|
||||
if (Add)
|
||||
{
|
||||
@@ -475,8 +475,8 @@ public class Pos
|
||||
internal override int Calculate (int superviewDimension, Dim dim, View us, Dimension dimension)
|
||||
{
|
||||
int newDimension = dim.Calculate (0, superviewDimension, us, dimension);
|
||||
int left = Left.Calculate (superviewDimension, dim, us, dimension);
|
||||
int right = Right.Calculate (superviewDimension, dim, us, dimension);
|
||||
int left = LeftPos.Calculate (superviewDimension, dim, us, dimension);
|
||||
int right = RightPos.Calculate (superviewDimension, dim, us, dimension);
|
||||
|
||||
if (Add)
|
||||
{
|
||||
@@ -492,12 +492,12 @@ public class Pos
|
||||
/// <returns></returns>
|
||||
internal override bool ReferencesOtherViews ()
|
||||
{
|
||||
if (Left.ReferencesOtherViews ())
|
||||
if (LeftPos.ReferencesOtherViews ())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Right.ReferencesOtherViews ())
|
||||
if (RightPos.ReferencesOtherViews ())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1243,17 +1243,18 @@ public class Dim
|
||||
|
||||
internal class DimCombine (bool add, Dim left, Dim right) : Dim
|
||||
{
|
||||
internal bool _add = add;
|
||||
internal Dim _left = left, _right = right;
|
||||
internal bool Add { get; set; } = add;
|
||||
internal Dim Left { get; set; } = left;
|
||||
internal Dim Right { get; set; } = right;
|
||||
|
||||
public override string ToString () { return $"Combine({_left}{(_add ? '+' : '-')}{_right})"; }
|
||||
public override string ToString () { return $"Combine({Left}{(Add ? '+' : '-')}{Right})"; }
|
||||
|
||||
internal override int Anchor (int width)
|
||||
{
|
||||
int la = _left.Anchor (width);
|
||||
int ra = _right.Anchor (width);
|
||||
int la = Left.Anchor (width);
|
||||
int ra = Right.Anchor (width);
|
||||
|
||||
if (_add)
|
||||
if (Add)
|
||||
{
|
||||
return la + ra;
|
||||
}
|
||||
@@ -1263,12 +1264,12 @@ public class Dim
|
||||
|
||||
internal override int Calculate (int location, int superviewContentSize, View us, Dimension dimension)
|
||||
{
|
||||
int leftNewDim = _left.Calculate (location, superviewContentSize, us, dimension);
|
||||
int rightNewDim = _right.Calculate (location, superviewContentSize, us, dimension);
|
||||
int leftNewDim = Left.Calculate (location, superviewContentSize, us, dimension);
|
||||
int rightNewDim = Right.Calculate (location, superviewContentSize, us, dimension);
|
||||
|
||||
int newDimension;
|
||||
|
||||
if (_add)
|
||||
if (Add)
|
||||
{
|
||||
newDimension = leftNewDim + rightNewDim;
|
||||
}
|
||||
@@ -1286,12 +1287,12 @@ public class Dim
|
||||
/// <returns></returns>
|
||||
internal override bool ReferencesOtherViews ()
|
||||
{
|
||||
if (_left.ReferencesOtherViews ())
|
||||
if (Left.ReferencesOtherViews ())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_right.ReferencesOtherViews ())
|
||||
if (Right.ReferencesOtherViews ())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public partial class View
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If set to a relative value (e.g. <see cref="Pos.Center"/>) the value is indeterminate until the view has been
|
||||
/// initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Size)"/> has been
|
||||
/// initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout"/> has been
|
||||
/// called.
|
||||
/// </para>
|
||||
/// <para>
|
||||
@@ -219,7 +219,7 @@ public partial class View
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If set to a relative value (e.g. <see cref="Pos.Center"/>) the value is indeterminate until the view has been
|
||||
/// initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Size)"/> has been
|
||||
/// initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout"/> has been
|
||||
/// called.
|
||||
/// </para>
|
||||
/// <para>
|
||||
@@ -258,7 +258,7 @@ public partial class View
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If set to a relative value (e.g. <see cref="Dim.Fill(int)"/>) the value is indeterminate until the view has
|
||||
/// been initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Size)"/> has been
|
||||
/// been initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout"/> has been
|
||||
/// called.
|
||||
/// </para>
|
||||
/// <para>
|
||||
@@ -304,7 +304,7 @@ public partial class View
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If set to a relative value (e.g. <see cref="Dim.Fill(int)"/>) the value is indeterminate until the view has
|
||||
/// been initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout(Size)"/> has been
|
||||
/// been initialized ( <see cref="IsInitialized"/> is true) and <see cref="SetRelativeLayout"/> has been
|
||||
/// called.
|
||||
/// </para>
|
||||
/// <para>
|
||||
@@ -736,7 +736,7 @@ public partial class View
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Determines the relative bounds of the <see cref="View"/> and its <see cref="Frame"/>s, and then calls
|
||||
/// <see cref="SetRelativeLayout(Size)"/> to update the view.
|
||||
/// <see cref="SetRelativeLayout"/> to update the view.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal void OnResizeNeeded ()
|
||||
@@ -894,8 +894,8 @@ public partial class View
|
||||
|
||||
return;
|
||||
case Dim.DimCombine dc:
|
||||
CollectDim (dc._left, from, ref nNodes, ref nEdges);
|
||||
CollectDim (dc._right, from, ref nNodes, ref nEdges);
|
||||
CollectDim (dc.Left, from, ref nNodes, ref nEdges);
|
||||
CollectDim (dc.Right, from, ref nNodes, ref nEdges);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -917,8 +917,8 @@ public partial class View
|
||||
|
||||
return;
|
||||
case Pos.PosCombine pc:
|
||||
CollectPos (pc.Left, from, ref nNodes, ref nEdges);
|
||||
CollectPos (pc.Right, from, ref nNodes, ref nEdges);
|
||||
CollectPos (pc.LeftPos, from, ref nNodes, ref nEdges);
|
||||
CollectPos (pc.RightPos, from, ref nNodes, ref nEdges);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1105,8 +1105,8 @@ public partial class View
|
||||
|
||||
case Pos pos and Pos.PosCombine:
|
||||
// Recursively check for not Absolute or not View
|
||||
ThrowInvalid (view, (pos as Pos.PosCombine).Left, name);
|
||||
ThrowInvalid (view, (pos as Pos.PosCombine).Right, name);
|
||||
ThrowInvalid (view, (pos as Pos.PosCombine).LeftPos, name);
|
||||
ThrowInvalid (view, (pos as Pos.PosCombine).RightPos, name);
|
||||
|
||||
break;
|
||||
|
||||
@@ -1117,8 +1117,8 @@ public partial class View
|
||||
|
||||
case Dim dim and Dim.DimCombine:
|
||||
// Recursively check for not Absolute or not View
|
||||
ThrowInvalid (view, (dim as Dim.DimCombine)._left, name);
|
||||
ThrowInvalid (view, (dim as Dim.DimCombine)._right, name);
|
||||
ThrowInvalid (view, (dim as Dim.DimCombine).Left, name);
|
||||
ThrowInvalid (view, (dim as Dim.DimCombine).Right, name);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,6 @@ public class AlignerTests (ITestOutputHelper output)
|
||||
[InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30 }, 101, new [] { 0, 50, 71 })]
|
||||
[InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30, 40 }, 101, new [] { 0, 10, 30, 61 })]
|
||||
[InlineData (Alignment.FirstLeftRestRight, new [] { 10, 20, 30, 40, 50 }, 151, new [] { 0, 10, 30, 60, 101 })]
|
||||
[InlineData (Alignment.FirstLeftRestRight, new [] { 3, 3, 3 }, 21, new [] { 0, 14, 18 })]
|
||||
[InlineData (Alignment.FirstLeftRestRight, new [] { 3, 4, 5 }, 21, new [] { 0, 11, 16 })]
|
||||
public void Alignment_SpaceBetweenItems (Alignment alignment, int [] sizes, int containerSize, int [] expected)
|
||||
{
|
||||
|
||||
@@ -3260,7 +3260,6 @@ ssb
|
||||
[InlineData ("A B", 3, false, "A B")]
|
||||
[InlineData ("A B", 1, false, "A")]
|
||||
[InlineData ("A B", 2, false, "A")]
|
||||
[InlineData ("A B", 3, false, "A B")]
|
||||
[InlineData ("A B", 4, false, "A B")]
|
||||
[InlineData ("A B", 5, false, "A B")]
|
||||
[InlineData ("A B", 6, false, "A B")]
|
||||
@@ -3270,7 +3269,6 @@ ssb
|
||||
[InlineData ("A", 0, true, "")]
|
||||
[InlineData ("A", 1, true, "A")]
|
||||
[InlineData ("A", 2, true, "A")]
|
||||
[InlineData ("A B", 3, true, "A B")]
|
||||
[InlineData ("A B", 1, true, "A")]
|
||||
[InlineData ("A B", 2, true, "A")]
|
||||
[InlineData ("A B", 3, true, "A B")]
|
||||
|
||||
@@ -893,7 +893,6 @@ public class DimAutoTests (ITestOutputHelper output)
|
||||
[Theory]
|
||||
[InlineData (0, 15, 15)]
|
||||
[InlineData (1, 15, 16)]
|
||||
[InlineData (0, 15, 15)]
|
||||
[InlineData (-1, 15, 14)]
|
||||
public void DimAuto_With_Subview_Using_DimAbsolute (int subViewOffset, int dimAbsoluteSize, int expectedSize)
|
||||
{
|
||||
|
||||
@@ -7,8 +7,6 @@ namespace Terminal.Gui.PosDimTests;
|
||||
|
||||
public class DimPercentTests
|
||||
{
|
||||
private readonly ITestOutputHelper _output;
|
||||
|
||||
[Fact]
|
||||
public void DimFactor_Calculate_ReturnsCorrectValue ()
|
||||
{
|
||||
|
||||
@@ -355,8 +355,8 @@ public class DimTests
|
||||
Assert.Equal (99, dimFill.Anchor (100));
|
||||
|
||||
var dimCombine = new Dim.DimCombine (true, dimFactor, dimAbsolute);
|
||||
Assert.Equal (dimCombine._left, dimFactor);
|
||||
Assert.Equal (dimCombine._right, dimAbsolute);
|
||||
Assert.Equal (dimCombine.Left, dimFactor);
|
||||
Assert.Equal (dimCombine.Right, dimAbsolute);
|
||||
Assert.Equal (20, dimCombine.Anchor (100));
|
||||
|
||||
var view = new View { Frame = new Rectangle (20, 10, 20, 1) };
|
||||
|
||||
@@ -4,13 +4,13 @@ using static Terminal.Gui.Pos;
|
||||
|
||||
namespace Terminal.Gui.PosDimTests;
|
||||
|
||||
public class PosAlignTests (ITestOutputHelper output)
|
||||
public class PosAlignTests ()
|
||||
{
|
||||
[Fact]
|
||||
public void PosAlign_Constructor ()
|
||||
{
|
||||
var PosAlign = new PosAlign (Alignment.Justified);
|
||||
Assert.NotNull (PosAlign);
|
||||
var posAlign = new PosAlign (Alignment.Justified);
|
||||
Assert.NotNull (posAlign);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -30,20 +30,20 @@ public class PosAlignTests (ITestOutputHelper output)
|
||||
[Fact]
|
||||
public void PosAlign_ToString ()
|
||||
{
|
||||
var PosAlign = new PosAlign (Alignment.Justified);
|
||||
var posAlign = new PosAlign (Alignment.Justified);
|
||||
var expectedString = "Align(groupId=0, alignment=Justified)";
|
||||
|
||||
Assert.Equal (expectedString, PosAlign.ToString ());
|
||||
Assert.Equal (expectedString, posAlign.ToString ());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PosAlign_Anchor ()
|
||||
{
|
||||
var PosAlign = new PosAlign (Alignment.Left);
|
||||
var posAlign = new PosAlign (Alignment.Left);
|
||||
var width = 50;
|
||||
var expectedAnchor = -width;
|
||||
|
||||
Assert.Equal (expectedAnchor, PosAlign.Anchor (width));
|
||||
Assert.Equal (expectedAnchor, posAlign.Anchor (width));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -4,7 +4,7 @@ using static Terminal.Gui.Pos;
|
||||
|
||||
namespace Terminal.Gui.PosDimTests;
|
||||
|
||||
public class PosTests (ITestOutputHelper output)
|
||||
public class PosTests ()
|
||||
{
|
||||
// Was named AutoSize_Pos_Validation_Do_Not_Throws_If_NewValue_Is_PosAbsolute_And_OldValue_Is_Another_Type_After_Sets_To_LayoutStyle_Absolute ()
|
||||
// but doesn't actually have anything to do with AutoSize.
|
||||
@@ -110,7 +110,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
{
|
||||
Application.Init (new FakeDriver ());
|
||||
|
||||
Toplevel t = new Toplevel();
|
||||
Toplevel t = new Toplevel ();
|
||||
|
||||
var w = new Window { X = Pos.Left (t) + 2, Y = Pos.Top (t) + 2 };
|
||||
var f = new FrameView ();
|
||||
@@ -225,13 +225,13 @@ public class PosTests (ITestOutputHelper output)
|
||||
Assert.Equal (10, posAbsolute.Anchor (0));
|
||||
|
||||
var posCombine = new Pos.PosCombine (true, posFactor, posAbsolute);
|
||||
Assert.Equal (posCombine.Left, posFactor);
|
||||
Assert.Equal (posCombine.Right, posAbsolute);
|
||||
Assert.Equal (posCombine.LeftPos, posFactor);
|
||||
Assert.Equal (posCombine.RightPos, posAbsolute);
|
||||
Assert.Equal (20, posCombine.Anchor (100));
|
||||
|
||||
posCombine = new (true, posAbsolute, posFactor);
|
||||
Assert.Equal (posCombine.Left, posAbsolute);
|
||||
Assert.Equal (posCombine.Right, posFactor);
|
||||
Assert.Equal (posCombine.LeftPos, posAbsolute);
|
||||
Assert.Equal (posCombine.RightPos, posFactor);
|
||||
Assert.Equal (20, posCombine.Anchor (100));
|
||||
|
||||
var view = new View { Frame = new (20, 10, 20, 1) };
|
||||
@@ -255,7 +255,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
public void LeftTopBottomRight_Win_ShouldNotThrow ()
|
||||
{
|
||||
// Setup Fake driver
|
||||
(Toplevel top, Window win, Button button) setup ()
|
||||
(Toplevel top, Window win, Button button) Setup ()
|
||||
{
|
||||
Application.Init (new FakeDriver ());
|
||||
Application.Iteration += (s, a) => { Application.RequestStop (); };
|
||||
@@ -271,7 +271,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
|
||||
RunState rs;
|
||||
|
||||
void cleanup (RunState rs)
|
||||
void Cleanup (RunState rs)
|
||||
{
|
||||
// Cleanup
|
||||
Application.End (rs);
|
||||
@@ -283,53 +283,53 @@ public class PosTests (ITestOutputHelper output)
|
||||
}
|
||||
|
||||
// Test cases:
|
||||
(Toplevel top, Window win, Button button) app = setup ();
|
||||
(Toplevel top, Window win, Button button) app = Setup ();
|
||||
app.button.Y = Pos.Left (app.win);
|
||||
rs = Application.Begin (app.top);
|
||||
|
||||
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
||||
Application.RunLoop (rs);
|
||||
cleanup (rs);
|
||||
Cleanup (rs);
|
||||
|
||||
app = setup ();
|
||||
app = Setup ();
|
||||
app.button.Y = Pos.X (app.win);
|
||||
rs = Application.Begin (app.top);
|
||||
|
||||
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
||||
Application.RunLoop (rs);
|
||||
cleanup (rs);
|
||||
Cleanup (rs);
|
||||
|
||||
app = setup ();
|
||||
app = Setup ();
|
||||
app.button.Y = Pos.Top (app.win);
|
||||
rs = Application.Begin (app.top);
|
||||
|
||||
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
||||
Application.RunLoop (rs);
|
||||
cleanup (rs);
|
||||
Cleanup (rs);
|
||||
|
||||
app = setup ();
|
||||
app = Setup ();
|
||||
app.button.Y = Pos.Y (app.win);
|
||||
rs = Application.Begin (app.top);
|
||||
|
||||
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
||||
Application.RunLoop (rs);
|
||||
cleanup (rs);
|
||||
Cleanup (rs);
|
||||
|
||||
app = setup ();
|
||||
app = Setup ();
|
||||
app.button.Y = Pos.Bottom (app.win);
|
||||
rs = Application.Begin (app.top);
|
||||
|
||||
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
||||
Application.RunLoop (rs);
|
||||
cleanup (rs);
|
||||
Cleanup (rs);
|
||||
|
||||
app = setup ();
|
||||
app = Setup ();
|
||||
app.button.Y = Pos.Right (app.win);
|
||||
rs = Application.Begin (app.top);
|
||||
|
||||
// If Application.RunState is used then we must use Application.RunLoop with the rs parameter
|
||||
Application.RunLoop (rs);
|
||||
cleanup (rs);
|
||||
Cleanup (rs);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -548,15 +548,15 @@ public class PosTests (ITestOutputHelper output)
|
||||
pos = Pos.Left (new ());
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
pos = Pos.Left (new() { Frame = testRect });
|
||||
pos = Pos.Left (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
testRect = new (1, 2, 3, 4);
|
||||
pos = Pos.Left (new() { Frame = testRect });
|
||||
pos = Pos.Left (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
// Pos.Left(win) + 0
|
||||
pos = Pos.Left (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.Left (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -566,7 +566,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = 1;
|
||||
|
||||
// Pos.Left(win) +1
|
||||
pos = Pos.Left (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.Left (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -576,7 +576,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = -1;
|
||||
|
||||
// Pos.Left(win) -1
|
||||
pos = Pos.Left (new() { Frame = testRect }) - testInt;
|
||||
pos = Pos.Left (new () { Frame = testRect }) - testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -590,15 +590,15 @@ public class PosTests (ITestOutputHelper output)
|
||||
pos = Pos.X (new ());
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
pos = Pos.X (new() { Frame = testRect });
|
||||
pos = Pos.X (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
testRect = new (1, 2, 3, 4);
|
||||
pos = Pos.X (new() { Frame = testRect });
|
||||
pos = Pos.X (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
// Pos.X(win) + 0
|
||||
pos = Pos.X (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.X (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -608,7 +608,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = 1;
|
||||
|
||||
// Pos.X(win) +1
|
||||
pos = Pos.X (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.X (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -618,7 +618,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = -1;
|
||||
|
||||
// Pos.X(win) -1
|
||||
pos = Pos.X (new() { Frame = testRect }) - testInt;
|
||||
pos = Pos.X (new () { Frame = testRect }) - testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -632,15 +632,15 @@ public class PosTests (ITestOutputHelper output)
|
||||
pos = Pos.Top (new ());
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
pos = Pos.Top (new() { Frame = testRect });
|
||||
pos = Pos.Top (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
testRect = new (1, 2, 3, 4);
|
||||
pos = Pos.Top (new() { Frame = testRect });
|
||||
pos = Pos.Top (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
// Pos.Top(win) + 0
|
||||
pos = Pos.Top (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.Top (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -650,7 +650,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = 1;
|
||||
|
||||
// Pos.Top(win) +1
|
||||
pos = Pos.Top (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.Top (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -660,7 +660,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = -1;
|
||||
|
||||
// Pos.Top(win) -1
|
||||
pos = Pos.Top (new() { Frame = testRect }) - testInt;
|
||||
pos = Pos.Top (new () { Frame = testRect }) - testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -674,15 +674,15 @@ public class PosTests (ITestOutputHelper output)
|
||||
pos = Pos.Y (new ());
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
pos = Pos.Y (new() { Frame = testRect });
|
||||
pos = Pos.Y (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
testRect = new (1, 2, 3, 4);
|
||||
pos = Pos.Y (new() { Frame = testRect });
|
||||
pos = Pos.Y (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
// Pos.Y(win) + 0
|
||||
pos = Pos.Y (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.Y (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -692,7 +692,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = 1;
|
||||
|
||||
// Pos.Y(win) +1
|
||||
pos = Pos.Y (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.Y (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -702,7 +702,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = -1;
|
||||
|
||||
// Pos.Y(win) -1
|
||||
pos = Pos.Y (new() { Frame = testRect }) - testInt;
|
||||
pos = Pos.Y (new () { Frame = testRect }) - testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -716,15 +716,15 @@ public class PosTests (ITestOutputHelper output)
|
||||
pos = Pos.Bottom (new ());
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
pos = Pos.Bottom (new() { Frame = testRect });
|
||||
pos = Pos.Bottom (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
testRect = new (1, 2, 3, 4);
|
||||
pos = Pos.Bottom (new() { Frame = testRect });
|
||||
pos = Pos.Bottom (new () { Frame = testRect });
|
||||
Assert.Equal ($"View(side={side},target=View(){testRect})", pos.ToString ());
|
||||
|
||||
// Pos.Bottom(win) + 0
|
||||
pos = Pos.Bottom (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.Bottom (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -734,7 +734,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = 1;
|
||||
|
||||
// Pos.Bottom(win) +1
|
||||
pos = Pos.Bottom (new() { Frame = testRect }) + testInt;
|
||||
pos = Pos.Bottom (new () { Frame = testRect }) + testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -744,7 +744,7 @@ public class PosTests (ITestOutputHelper output)
|
||||
testInt = -1;
|
||||
|
||||
// Pos.Bottom(win) -1
|
||||
pos = Pos.Bottom (new() { Frame = testRect }) - testInt;
|
||||
pos = Pos.Bottom (new () { Frame = testRect }) - testInt;
|
||||
|
||||
Assert.Equal (
|
||||
$"Combine(View(side={side},target=View(){testRect}){(testInt < 0 ? '-' : '+')}Absolute({testInt}))",
|
||||
@@ -878,7 +878,6 @@ public class PosTests (ITestOutputHelper output)
|
||||
[SetupFakeDriver]
|
||||
public void PosCombine_DimCombine_View_With_SubViews ()
|
||||
{
|
||||
var clicked = false;
|
||||
Toplevel top = new Toplevel () { Width = 80, Height = 25 };
|
||||
var win1 = new Window { Id = "win1", Width = 20, Height = 10 };
|
||||
var view1 = new View
|
||||
@@ -887,10 +886,9 @@ public class PosTests (ITestOutputHelper output)
|
||||
Width = Auto (DimAutoStyle.Text),
|
||||
Height = Auto (DimAutoStyle.Text)
|
||||
|
||||
};
|
||||
};
|
||||
var win2 = new Window { Id = "win2", Y = Pos.Bottom (view1) + 1, Width = 10, Height = 3 };
|
||||
var view2 = new View { Id = "view2", Width = Dim.Fill (), Height = 1, CanFocus = true };
|
||||
view2.MouseClick += (sender, e) => clicked = true;
|
||||
var view3 = new View { Id = "view3", Width = Dim.Fill (1), Height = 1, CanFocus = true };
|
||||
|
||||
view2.Add (view3);
|
||||
|
||||
@@ -5,7 +5,7 @@ using Xunit.Abstractions;
|
||||
namespace Terminal.Gui.ViewTests;
|
||||
|
||||
[Trait("Category","Output")]
|
||||
public class NeedsDisplayTests (ITestOutputHelper output)
|
||||
public class NeedsDisplayTests ()
|
||||
{
|
||||
[Fact]
|
||||
public void NeedsDisplay_False_If_Width_Height_Zero ()
|
||||
|
||||
Reference in New Issue
Block a user