Skip to content

Commit

Permalink
adusted more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tig committed Mar 20, 2023
1 parent ee93ac9 commit 10971ec
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Terminal.Gui/Core/Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Terminal.Gui {
/// enabling borders, menus, etc...
/// </summary>
public class Frame : View {
private Thickness _thickness;
private Thickness _thickness = Thickness.Empty;

internal override void CreateFrames () { /* Do nothing - Frames do not have Frames */ }

Expand Down
6 changes: 6 additions & 0 deletions Terminal.Gui/Core/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ void SetInitialProperties (ustring title, Rect frame, int padding = 0, Border bo

// TODO: Hack until Border is refactored
Padding.Thickness = Border.PaddingThickness ?? Padding.Thickness;

if (frame.IsEmpty) {
// Make it bigger to fit the margin, border, & padding
frame = new Rect (frame.Location, new Size (Margin.Thickness.Horizontal + BorderFrame.Thickness.Horizontal + Padding.Thickness.Horizontal + 1, Margin.Thickness.Vertical + BorderFrame.Thickness.Vertical + Padding.Thickness.Vertical + 1));
}
Frame = frame;
}

public override void BeginInit ()
Expand Down
1 change: 1 addition & 0 deletions Terminal.Gui/Views/Label.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public Label (ustring text, TextDirection direction, bool autosize = true)

void SetInitialProperties (bool autosize = true)
{
Height = 1;
AutoSize = autosize;
}

Expand Down
3 changes: 2 additions & 1 deletion UICatalog/Scenarios/ASCIICustomButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ private void CustomInitialize (string id, string text, Pos x, Pos y, int width,
};

border.MouseClick += This_MouseClick;
border.Subviews [0].MouseClick += This_MouseClick;
// BUGBUG: v2 This uses internal knowledge of FrameView an breaks in v2 where FrameView does not have a ContentView
//border.Subviews [0].MouseClick += This_MouseClick;
fill.MouseClick += This_MouseClick;
title.MouseClick += This_MouseClick;

Expand Down
8 changes: 6 additions & 2 deletions UICatalog/Scenarios/VkeyPacketSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,18 @@ public override void Setup ()

tvInput.SetFocus ();

Win.LayoutComplete += (_) => {
void Win_LayoutComplete (View.LayoutEventArgs obj)
{
inputHorizontalRuler.Text = outputHorizontalRuler.Text = ruler.Repeat ((int)Math.Ceiling ((double)(inputHorizontalRuler.Bounds.Width) / (double)ruler.Length)) [0..(inputHorizontalRuler.Bounds.Width)];
inputVerticalRuler.Height = tvInput.Frame.Height + 1;
inputVerticalRuler.Text = ruler.Repeat ((int)Math.Ceiling ((double)(inputVerticalRuler.Bounds.Height) / (double)ruler.Length)) [0..(inputVerticalRuler.Bounds.Height)];
outputVerticalRuler.Text = ruler.Repeat ((int)Math.Ceiling ((double)(outputVerticalRuler.Bounds.Height) / (double)ruler.Length)) [0..(outputVerticalRuler.Bounds.Height)];
};
}

Win.LayoutComplete += Win_LayoutComplete;
}


private void AddKeyboardStrokes (View.KeyEventEventArgs e)
{
var ke = e.KeyEvent;
Expand Down

0 comments on commit 10971ec

Please sign in to comment.