Skip to content

Commit 19a1ad8

Browse files
fix: resolve CI annotations by allowing nullable UIElement properties on Border
- Allowed nulls on `Border.Title` and `Border.StatusBar` to eliminate compiler warnings about missing `required` modifier. Co-authored-by: tedd <493224+tedd@users.noreply.github.com>
1 parent 8ae873a commit 19a1ad8

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/Tedd.TUI.Tests/ItemsControlTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private class TestItemsControl : ItemsControl
1414
public void ItemsSource_Populates_Items()
1515
{
1616
var control = new TestItemsControl();
17-
string[] source = [ "A", "B", "C" ];
17+
string[] source = ["A", "B", "C"];
1818

1919
control.ItemsSource = source;
2020

@@ -111,7 +111,7 @@ public void ItemsSource_Move_Updates_Items()
111111
public void Items_IsReadOnly_When_ItemsSource_Set()
112112
{
113113
var control = new TestItemsControl();
114-
control.ItemsSource = (string[])[ "A" ];
114+
control.ItemsSource = (string[])["A"];
115115

116116
Assert.Throws<InvalidOperationException>(() => control.Items.Add("B"));
117117
Assert.Throws<InvalidOperationException>(() => control.Items.RemoveAt(0));
@@ -214,7 +214,7 @@ public void ItemTemplate_Change_Repopulates_ItemsPresenter()
214214
{
215215
var control = new TestItemsControl();
216216

217-
TestItem[] items = [ new TestItem { Name = "A" }, new TestItem { Name = "B" } ];
217+
TestItem[] items = [new TestItem { Name = "A" }, new TestItem { Name = "B" }];
218218
control.ItemsSource = items;
219219

220220
control.Template = new ControlTemplate(parent =>

src/Tedd.TUI.Tests/MarkdownViewTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public void MarkdownView_TablePreservesEmptyCells()
184184
var table = (Table)doc.GetVisualChild(0);
185185

186186
// Row count check
187-
Assert.Equal(1, table.Rows.Count);
187+
Assert.Single(table.Rows);
188188
var row = table.Rows[0];
189189
Assert.Equal(3, row.Cells.Count);
190190
}
@@ -204,7 +204,7 @@ public void MarkdownView_TablePadsShortRowsToColumnCount()
204204
var table = (Table)doc.GetVisualChild(0);
205205

206206
Assert.Equal(4, table.Columns.Count);
207-
Assert.Equal(1, table.Rows.Count);
207+
Assert.Single(table.Rows);
208208
Assert.Equal(4, table.Rows[0].Cells.Count);
209209
}
210210

src/Tedd.TUI.Tests/ValidatorGroupBoxTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,17 @@ public void BoundaryAndEdgeVerification_NegativeConstraints()
115115
var groupBox = new GroupBox { BoxStyle = BoxStyle.Single, Header = "Neg" };
116116
stack.Children.Add(groupBox);
117117

118-
var ex = Record.Exception(() => {
118+
var ex = Record.Exception(() =>
119+
{
119120
stack.Measure(new Size(-10, -10));
120121
stack.Arrange(new Rect(0, 0, -10, -10));
121122
});
122123

123124
Assert.Null(ex); // Layout should not crash on negative dimensions
124125

125126
var buffer = new VirtualBuffer(10, 10);
126-
var ex2 = Record.Exception(() => {
127+
var ex2 = Record.Exception(() =>
128+
{
127129
stack.Render(buffer, 0, 0);
128130
});
129131

src/Tedd.TUI.Tests/ValidatorLayoutMatrixTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,17 @@ public void BoundaryAndEdgeVerification_NegativeConstraints()
331331

332332
// Negative size should be handled gracefully without exception
333333
// The Measure/Arrange algorithms typically clamp sizes to 0
334-
var ex = Record.Exception(() => {
334+
var ex = Record.Exception(() =>
335+
{
335336
stack.Measure(new Size(-10, -10));
336337
stack.Arrange(new Rect(0, 0, -10, -10));
337338
});
338339

339340
Assert.Null(ex); // Layout should not crash on negative dimensions
340341

341342
var buffer = new VirtualBuffer(10, 10);
342-
var ex2 = Record.Exception(() => {
343+
var ex2 = Record.Exception(() =>
344+
{
343345
stack.Render(buffer, 0, 0);
344346
});
345347

src/Tedd.TUI/Border.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public UIElement Child
1111
set => Content = value;
1212
}
1313

14-
public UIElement Title
14+
public UIElement? Title
1515
{
1616
get;
1717
set
@@ -39,7 +39,7 @@ public HorizontalAlignment TitleAlignment
3939
}
4040
} = HorizontalAlignment.Left;
4141

42-
public UIElement StatusBar
42+
public UIElement? StatusBar
4343
{
4444
get;
4545
set

0 commit comments

Comments
 (0)