mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Revamped to further simplify and make more correct
This commit is contained in:
@@ -295,9 +295,9 @@ public class ApplicationTests
|
||||
|
||||
return;
|
||||
|
||||
void OnApplicationOnInitializedChanged (object s, CancelEventArgs<bool> a)
|
||||
void OnApplicationOnInitializedChanged (object s, EventArgs<bool> a)
|
||||
{
|
||||
if (a.NewValue)
|
||||
if (a.CurrentValue)
|
||||
{
|
||||
initialized = true;
|
||||
}
|
||||
@@ -1151,9 +1151,9 @@ public class ApplicationTests
|
||||
|
||||
return;
|
||||
|
||||
void OnApplicationOnInitializedChanged (object s, CancelEventArgs<bool> a)
|
||||
void OnApplicationOnInitializedChanged (object s, EventArgs<bool> a)
|
||||
{
|
||||
if (a.NewValue)
|
||||
if (a.CurrentValue)
|
||||
{
|
||||
Application.Iteration += OnApplicationOnIteration;
|
||||
initialized = true;
|
||||
|
||||
@@ -129,10 +129,10 @@ public class KeyboardTests
|
||||
|
||||
return;
|
||||
|
||||
void OnApplicationOnInitializedChanged (object s, CancelEventArgs<bool> a)
|
||||
void OnApplicationOnInitializedChanged (object s, EventArgs<bool> a)
|
||||
{
|
||||
_output.WriteLine ("OnApplicationOnInitializedChanged: {0}", a.NewValue);
|
||||
if (a.NewValue)
|
||||
_output.WriteLine ("OnApplicationOnInitializedChanged: {0}", a.CurrentValue);
|
||||
if (a.CurrentValue)
|
||||
{
|
||||
Application.Iteration += OnApplicationOnIteration;
|
||||
initialized = true;
|
||||
|
||||
@@ -597,7 +597,7 @@ public class WizardTests ()
|
||||
Assert.Equal (string.Empty, r.Title);
|
||||
|
||||
var expected = string.Empty;
|
||||
r.TitleChanged += (s, args) => { Assert.Equal (r.Title, args.NewValue); };
|
||||
r.TitleChanged += (s, args) => { Assert.Equal (r.Title, args.CurrentValue); };
|
||||
|
||||
expected = "title";
|
||||
r.Title = expected;
|
||||
|
||||
@@ -73,9 +73,9 @@ public class ScenarioTests : TestsAllViews
|
||||
|
||||
return;
|
||||
|
||||
void OnApplicationOnInitializedChanged (object s, CancelEventArgs<bool> a)
|
||||
void OnApplicationOnInitializedChanged (object s, EventArgs<bool> a)
|
||||
{
|
||||
if (a.NewValue)
|
||||
if (a.CurrentValue)
|
||||
{
|
||||
Application.Iteration += OnApplicationOnIteration;
|
||||
initialized = true;
|
||||
|
||||
@@ -326,8 +326,7 @@ public class AdornmentTests (ITestOutputHelper output)
|
||||
adornment.ThicknessChanged += (s, e) =>
|
||||
{
|
||||
raised = true;
|
||||
Assert.Equal (Thickness.Empty, e.CurrentValue);
|
||||
Assert.Equal (new Thickness (1, 2, 3, 4), e.NewValue);
|
||||
Assert.Equal (new Thickness (1, 2, 3, 4), e.CurrentValue);
|
||||
Assert.Equal (new Thickness (1, 2, 3, 4), adornment.Thickness);
|
||||
};
|
||||
adornment.Thickness = new Thickness (1, 2, 3, 4);
|
||||
|
||||
@@ -53,8 +53,7 @@ public class TitleTests (ITestOutputHelper output)
|
||||
|
||||
r.TitleChanged += (s, args) =>
|
||||
{
|
||||
Assert.Equal (expectedOld, args.CurrentValue);
|
||||
Assert.Equal (r.Title, args.NewValue);
|
||||
Assert.Equal (r.Title, args.CurrentValue);
|
||||
};
|
||||
|
||||
expected = "title";
|
||||
|
||||
@@ -828,6 +828,7 @@ Three ",
|
||||
Assert.Equal ("Tw", cb.Text);
|
||||
Assert.False (cb.IsShow);
|
||||
cb.SetSource<string> (null);
|
||||
Assert.False (cb.IsShow);
|
||||
Assert.False (cb.NewKeyDownEvent (Key.Enter));
|
||||
Assert.True (cb.NewKeyDownEvent (Key.F4)); // with no source also expand empty
|
||||
Assert.True (cb.IsShow);
|
||||
|
||||
@@ -429,8 +429,11 @@ public class TextFieldTests (ITestOutputHelper output)
|
||||
var oldText = "";
|
||||
var tf = new TextField { Width = 10, Text = "-1" };
|
||||
|
||||
tf.TextChanging += (s, e) => newText = e.NewValue;
|
||||
tf.TextChanged += (s, e) => oldText = e.CurrentValue;
|
||||
tf.TextChanging += (s, e) =>
|
||||
{
|
||||
newText = e.NewValue;
|
||||
oldText = e.CurrentValue;
|
||||
};
|
||||
|
||||
var top = new Toplevel ();
|
||||
top.Add (tf);
|
||||
@@ -1191,10 +1194,13 @@ public class TextFieldTests (ITestOutputHelper output)
|
||||
[TextFieldTestsAutoInitShutdown]
|
||||
public void TextChanged_Event ()
|
||||
{
|
||||
_textField.TextChanged += (s, e) => { Assert.Equal ("TAB to jump between text fields.", e.CurrentValue); };
|
||||
bool eventFired = false;
|
||||
_textField.TextChanged += (s, e) => eventFired = true;
|
||||
|
||||
_textField.Text = "changed";
|
||||
Assert.True (eventFired);
|
||||
Assert.Equal ("changed", _textField.Text);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user