mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Remove constructors with frame parameters from TimeField class.
This commit is contained in:
@@ -43,11 +43,9 @@ public class TimeField : TextField {
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="TimeField"/> using <see cref="LayoutStyle.Absolute"/> positioning.
|
||||
/// </summary>
|
||||
/// <param name="x">The x coordinate.</param>
|
||||
/// <param name="y">The y coordinate.</param>
|
||||
/// <param name="time">Initial time.</param>
|
||||
/// <param name="isShort">If true, the seconds are hidden. Sets the <see cref="IsShortFormat"/> property.</param>
|
||||
public TimeField (int x, int y, TimeSpan time, bool isShort = false) : base (x, y, isShort ? 7 : 10, "")
|
||||
public TimeField (TimeSpan time, bool isShort = false) : base (string.Empty)
|
||||
{
|
||||
SetInitialProperties (time, isShort);
|
||||
}
|
||||
@@ -58,7 +56,6 @@ public class TimeField : TextField {
|
||||
/// <param name="time">Initial time</param>
|
||||
public TimeField (TimeSpan time) : base (string.Empty)
|
||||
{
|
||||
Width = _fieldLen + 2;
|
||||
SetInitialProperties (time);
|
||||
}
|
||||
|
||||
@@ -74,6 +71,7 @@ public class TimeField : TextField {
|
||||
_longFormat = $" hh\\{_sepChar}mm\\{_sepChar}ss";
|
||||
_shortFormat = $" hh\\{_sepChar}mm";
|
||||
this._isShort = isShort;
|
||||
Width = _fieldLen + 2;
|
||||
Time = time;
|
||||
CursorPosition = 1;
|
||||
TextChanging += TextField_TextChanging;
|
||||
|
||||
@@ -19,13 +19,13 @@ public class TimeFieldTests {
|
||||
Assert.Equal (1, tf.CursorPosition);
|
||||
Assert.Equal (new Rect (0, 0, 10, 1), tf.Frame);
|
||||
|
||||
tf = new TimeField (1, 2, time);
|
||||
tf = new TimeField (time) { X = 1, Y = 2 };
|
||||
Assert.False (tf.IsShortFormat);
|
||||
Assert.Equal (time, tf.Time);
|
||||
Assert.Equal (1, tf.CursorPosition);
|
||||
Assert.Equal (new Rect (1, 2, 10, 1), tf.Frame);
|
||||
|
||||
tf = new TimeField (3, 4, time, true);
|
||||
tf = new TimeField (time, true) { X = 3, Y = 4 };
|
||||
Assert.True (tf.IsShortFormat);
|
||||
Assert.Equal (time, tf.Time);
|
||||
Assert.Equal (1, tf.CursorPosition);
|
||||
|
||||
Reference in New Issue
Block a user