mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-29 09:18:01 +01:00
Added Padding button to Adornments scenario
This commit is contained in:
@@ -50,7 +50,7 @@ public class Adornments : Scenario
|
||||
};
|
||||
label.Border.Thickness = new Thickness (1, 3, 1, 1);
|
||||
|
||||
var tf2 = new Button { X = Pos.AnchorEnd (10), Y = Pos.AnchorEnd (1), Text = "Button" };
|
||||
var btnButtonInWindow = new Button { X = Pos.AnchorEnd (10), Y = Pos.AnchorEnd (1), Text = "Button" };
|
||||
|
||||
var tv = new Label
|
||||
{
|
||||
@@ -70,7 +70,7 @@ public class Adornments : Scenario
|
||||
view.Padding.Data = "Padding";
|
||||
view.Padding.Thickness = new Thickness (3);
|
||||
|
||||
view.Add (tf1, color, button, label, tf2, tv);
|
||||
view.Add (tf1, color, button, label, btnButtonInWindow, tv);
|
||||
|
||||
var editor = new AdornmentsEditor
|
||||
{
|
||||
@@ -85,9 +85,8 @@ public class Adornments : Scenario
|
||||
|
||||
editor.Initialized += (s, e) => { editor.ViewToEdit = view; };
|
||||
|
||||
//view.Margin.ColorScheme = new ColorScheme (Colors.ColorSchemes ["Dialog"]);
|
||||
//view.Border.ColorScheme = new ColorScheme (Colors.ColorSchemes ["Error"]);
|
||||
//view.Padding.ColorScheme = new ColorScheme (Colors.ColorSchemes ["Menu"]);
|
||||
var btnButtonInPadding = new Button { X = Pos.Center(), Y = 0, Text = "Button in Padding" };
|
||||
view.Padding.Add (btnButtonInPadding);
|
||||
|
||||
Application.Run (editor);
|
||||
Application.Shutdown ();
|
||||
|
||||
@@ -289,4 +289,49 @@ public class AdornmentTests
|
||||
adornment.Thickness = new Thickness (1, 2, 3, 4);
|
||||
Assert.True (raised);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Adornment_WithSubView_FindDeepestView_Finds ()
|
||||
{
|
||||
var view = new View () {
|
||||
Width = 10,
|
||||
Height = 10
|
||||
|
||||
};
|
||||
view.Padding.Thickness = new Thickness (1);
|
||||
|
||||
var subView = new View () {
|
||||
X = 0,
|
||||
Y =0,
|
||||
Width = 1,
|
||||
Height = 1
|
||||
};
|
||||
view.Padding.Add (subView);
|
||||
|
||||
Assert.Equal (subView, View.FindDeepestView (view, 0, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Adornment_WithNonVisibleSubView_FindDeepestView_Finds_Adornment ()
|
||||
{
|
||||
var view = new View ()
|
||||
{
|
||||
Width = 10,
|
||||
Height = 10
|
||||
|
||||
};
|
||||
view.Padding.Thickness = new Thickness (1);
|
||||
|
||||
var subView = new View ()
|
||||
{
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Width = 1,
|
||||
Height = 1,
|
||||
Visible = false
|
||||
};
|
||||
view.Padding.Add (subView);
|
||||
|
||||
Assert.Equal (view.Padding, View.FindDeepestView (view, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user