Renamed Dim.Function->Func to align iwth C# Func type.

Dim API doc fixes and code cleanup
This commit is contained in:
Tig
2024-05-16 06:41:36 -07:00
parent c12c20603f
commit 80d9a97e2d
7 changed files with 64 additions and 48 deletions

View File

@@ -1086,7 +1086,7 @@ public class DimAutoTests (ITestOutputHelper output)
public void With_Subview_Using_DimFunc ()
{
var view = new View ();
var subview = new View () { Width = Dim.Function (() => 20), Height = Dim.Function (() => 25) };
var subview = new View () { Width = Dim.Func (() => 20), Height = Dim.Func (() => 25) };
view.Add (subview);
subview.SetRelativeLayout (new (100, 100));

View File

@@ -14,12 +14,12 @@ public class DimFunctionTests (ITestOutputHelper output)
Func<int> f1 = () => 0;
Func<int> f2 = () => 0;
Dim dim1 = Dim.Function (f1);
Dim dim2 = Dim.Function (f2);
Dim dim1 = Dim.Func (f1);
Dim dim2 = Dim.Func (f2);
Assert.Equal (dim1, dim2);
f2 = () => 1;
dim2 = Dim.Function (f2);
dim2 = Dim.Func (f2);
Assert.NotEqual (dim1, dim2);
}
@@ -27,7 +27,7 @@ public class DimFunctionTests (ITestOutputHelper output)
public void DimFunction_SetsValue ()
{
var text = "Test";
Dim dim = Dim.Function (() => text.Length);
Dim dim = Dim.Func (() => text.Length);
Assert.Equal ("DimFunc(4)", dim.ToString ());
text = "New Test";

View File

@@ -204,7 +204,7 @@ public class PosAnchorEndTests (ITestOutputHelper output)
// Dim.Fill (1) fills remaining space minus 1 (16 - 1 = 15)
// Dim.Function (Btn_Width) is 6
// Width should be 15 - 6 = 9
Width = Dim.Fill (1) - Dim.Function (Btn_Width),
Width = Dim.Fill (1) - Dim.Func (Btn_Width),
Height = 1
};

View File

@@ -418,7 +418,7 @@ public class SetRelativeLayoutTests
Assert.Equal (1, view.Frame.Height);
var tf = new TextField { Text = "01234567890123456789" };
tf.Width = Dim.Fill (1) - Dim.Function (GetViewWidth);
tf.Width = Dim.Fill (1) - Dim.Func (GetViewWidth);
// tf will fill the screen minus 1 minus the width of view (3).
// so it's width will be 26 (30 - 1 - 3).