mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 08:50:25 +01:00
Merge pull request #2395 from tig/v2_develop
Fixing #2391 - Updating CI/CD for v2_develop
This commit is contained in:
4
.github/workflows/dotnet-core.yml
vendored
4
.github/workflows/dotnet-core.yml
vendored
@@ -2,9 +2,9 @@ name: Build & Test Terminal.Gui with .NET Core
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
branches: [ main, develop, v2_develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
branches: [ main, develop, v2_develop ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -490,21 +490,20 @@ namespace Terminal.Gui.Configuration {
|
||||
/// <summary>
|
||||
/// Loads all settings found in the various configuraiton storage locations to
|
||||
/// the <see cref="ConfigurationManager"/>. Optionally,
|
||||
/// resets all settings attributed with <see cref="SerializableConfigurationProperty"/> to the defaults
|
||||
/// defined in <see cref="LoadAppResources"/>.
|
||||
/// resets all settings attributed with <see cref="SerializableConfigurationProperty"/> to the defaults.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Use <see cref="Apply"/> to cause the loaded settings to be applied to the running application.
|
||||
/// </remarks>
|
||||
/// <param name="reset">If <see langword="true"/> the state of <see cref="ConfigurationManager"/> will
|
||||
/// be reset to the defaults defined in <see cref="LoadAppResources"/>.</param>
|
||||
/// be reset to the defaults.</param>
|
||||
public static void Load (bool reset = false)
|
||||
{
|
||||
Debug.WriteLine ($"ConfigurationManager.Load()");
|
||||
|
||||
if (reset) Reset ();
|
||||
|
||||
// LibraryResoruces is always loaded by Reset
|
||||
// LibraryResources is always loaded by Reset
|
||||
if (Locations == ConfigLocations.All) {
|
||||
var embeddedStylesResourceName = Assembly.GetEntryAssembly ()?
|
||||
.GetManifestResourceNames ().FirstOrDefault (x => x.EndsWith (_configFilename));
|
||||
|
||||
@@ -34,6 +34,9 @@ namespace Terminal.Gui.Configuration {
|
||||
[JsonInclude, JsonPropertyName ("$schema")]
|
||||
public string Schema { get; set; } = "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json";
|
||||
|
||||
/// <summary>
|
||||
/// The list of paths to the configuration files.
|
||||
/// </summary>
|
||||
public List<string> Sources = new List<string> ();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NStack;
|
||||
|
||||
namespace Terminal.Gui {
|
||||
|
||||
public class View2 : View, ISupportInitializeNotification {
|
||||
public Thickness Margin { get; set; }
|
||||
|
||||
void DrawThickness (Thickness thickness)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Redraw (Rect bounds)
|
||||
{
|
||||
base.Redraw (bounds);
|
||||
|
||||
DrawThickness (Margin);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -308,6 +308,7 @@ namespace Terminal.Gui {
|
||||
ClearNeedsDisplay ();
|
||||
|
||||
Driver.SetAttribute (GetNormalColor ());
|
||||
Border.Title = Title; // not sure why Title is getting un-set
|
||||
Border.DrawContent (this, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
ConfigurationManager.Settings ["Application.AlternateBackwardKey"].PropertyValue = Key.B;
|
||||
ConfigurationManager.Settings ["Application.UseSystemConsole"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.IsMouseDisabled"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.HeightAsBuffer"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.EnableConsoleScrolling"].PropertyValue = true;
|
||||
ConfigurationManager.Settings.Apply ();
|
||||
|
||||
// assert apply worked
|
||||
@@ -256,7 +256,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
ConfigurationManager.Settings ["Application.AlternateBackwardKey"].PropertyValue = Key.B;
|
||||
ConfigurationManager.Settings ["Application.UseSystemConsole"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.IsMouseDisabled"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.HeightAsBuffer"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.EnableConsoleScrolling"].PropertyValue = true;
|
||||
ConfigurationManager.Settings.Apply ();
|
||||
|
||||
|
||||
@@ -771,7 +771,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
ConfigurationManager.Settings ["Application.AlternateBackwardKey"].PropertyValue = Key.B;
|
||||
ConfigurationManager.Settings ["Application.UseSystemConsole"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.IsMouseDisabled"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.HeightAsBuffer"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.EnableConsoleScrolling"].PropertyValue = true;
|
||||
|
||||
ConfigurationManager.Updated += ConfigurationManager_Updated;
|
||||
bool fired = false;
|
||||
@@ -784,7 +784,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
Assert.Equal (Key.PageUp | Key.CtrlMask, ConfigurationManager.Settings ["Application.AlternateBackwardKey"].PropertyValue);
|
||||
Assert.False ((bool)ConfigurationManager.Settings ["Application.UseSystemConsole"].PropertyValue);
|
||||
Assert.False ((bool)ConfigurationManager.Settings ["Application.IsMouseDisabled"].PropertyValue);
|
||||
Assert.False ((bool)ConfigurationManager.Settings ["Application.HeightAsBuffer"].PropertyValue);
|
||||
Assert.False ((bool)ConfigurationManager.Settings ["Application.EnableConsoleScrolling"].PropertyValue);
|
||||
}
|
||||
|
||||
ConfigurationManager.Load (true);
|
||||
@@ -819,7 +819,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
ConfigurationManager.Settings ["Application.AlternateBackwardKey"].PropertyValue = Key.B;
|
||||
ConfigurationManager.Settings ["Application.UseSystemConsole"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.IsMouseDisabled"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.HeightAsBuffer"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.EnableConsoleScrolling"].PropertyValue = true;
|
||||
|
||||
ConfigurationManager.Apply ();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
Assert.True (ConfigurationManager.Settings ["Application.AlternateBackwardKey"].PropertyValue is Key);
|
||||
Assert.True (ConfigurationManager.Settings ["Application.UseSystemConsole"].PropertyValue is bool);
|
||||
Assert.True (ConfigurationManager.Settings ["Application.IsMouseDisabled"].PropertyValue is bool);
|
||||
Assert.True (ConfigurationManager.Settings ["Application.HeightAsBuffer"].PropertyValue is bool);
|
||||
Assert.True (ConfigurationManager.Settings ["Application.EnableConsoleScrolling"].PropertyValue is bool);
|
||||
|
||||
Assert.True (ConfigurationManager.Settings ["Theme"].PropertyValue is string);
|
||||
Assert.Equal ("Default", ConfigurationManager.Settings ["Theme"].PropertyValue as string);
|
||||
@@ -45,7 +45,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
Assert.Equal (Key.PageUp | Key.CtrlMask, (Key)ConfigurationManager.Settings ["Application.AlternateBackwardKey"].PropertyValue);
|
||||
Assert.False ((bool)ConfigurationManager.Settings ["Application.UseSystemConsole"].PropertyValue);
|
||||
Assert.False ((bool)ConfigurationManager.Settings ["Application.IsMouseDisabled"].PropertyValue);
|
||||
Assert.False ((bool)ConfigurationManager.Settings ["Application.HeightAsBuffer"].PropertyValue);
|
||||
Assert.False ((bool)ConfigurationManager.Settings ["Application.EnableConsoleScrolling"].PropertyValue);
|
||||
|
||||
// act
|
||||
ConfigurationManager.Settings ["Application.QuitKey"].PropertyValue = Key.Q;
|
||||
@@ -53,7 +53,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
ConfigurationManager.Settings ["Application.AlternateBackwardKey"].PropertyValue = Key.B;
|
||||
ConfigurationManager.Settings ["Application.UseSystemConsole"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.IsMouseDisabled"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.HeightAsBuffer"].PropertyValue = true;
|
||||
ConfigurationManager.Settings ["Application.EnableConsoleScrolling"].PropertyValue = true;
|
||||
|
||||
ConfigurationManager.Settings.Apply ();
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
updatedSettings["Application.AlternateBackwardKey"].PropertyValue = Key.B;
|
||||
updatedSettings["Application.UseSystemConsole"].PropertyValue = true;
|
||||
updatedSettings["Application.IsMouseDisabled"].PropertyValue = true;
|
||||
updatedSettings["Application.HeightAsBuffer"].PropertyValue = true;
|
||||
updatedSettings["Application.EnableConsoleScrolling"].PropertyValue = true;
|
||||
|
||||
ConfigurationManager.Settings.Update (updatedSettings);
|
||||
Assert.Equal (Key.End, ConfigurationManager.Settings ["Application.QuitKey"].PropertyValue);
|
||||
@@ -86,7 +86,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
Assert.Equal (Key.B, updatedSettings ["Application.AlternateBackwardKey"].PropertyValue);
|
||||
Assert.True ((bool)updatedSettings ["Application.UseSystemConsole"].PropertyValue);
|
||||
Assert.True ((bool)updatedSettings ["Application.IsMouseDisabled"].PropertyValue);
|
||||
Assert.True ((bool)updatedSettings ["Application.HeightAsBuffer"].PropertyValue);
|
||||
Assert.True ((bool)updatedSettings ["Application.EnableConsoleScrolling"].PropertyValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,7 +228,7 @@ namespace Terminal.Gui.CoreTests {
|
||||
var rune = (Rune)driver.Contents [r, c, 0];
|
||||
if (r == frame.Y - drawMarginFrame || r == frame.Bottom + drawMarginFrame - 1
|
||||
|| c == frame.X - drawMarginFrame || c == frame.Right + drawMarginFrame - 1) {
|
||||
Assert.Equal (Color.BrightGreen, color.Background);
|
||||
Assert.Equal (Color.Black, color.Background); // because of #2345 - Border: can't change border color in window by Border.BorderBrush.
|
||||
} else {
|
||||
Assert.Equal (Color.Black, color.Background);
|
||||
}
|
||||
@@ -463,7 +463,7 @@ namespace Terminal.Gui.CoreTests {
|
||||
var rune = (Rune)driver.Contents [r, c, 0];
|
||||
if (r == frame.Y + sumThickness.Top || r == frame.Bottom - sumThickness.Bottom - 1
|
||||
|| c == frame.X + sumThickness.Left || c == frame.Right - sumThickness.Right - 1) {
|
||||
Assert.Equal (Color.BrightGreen, color.Background);
|
||||
Assert.Equal (Color.Black, color.Background); // because of #2345 - Border: can't change border color in window by Border.BorderBrush.
|
||||
} else {
|
||||
Assert.Equal (Color.Black, color.Background);
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ namespace Terminal.Gui.DriverTests {
|
||||
[Fact, AutoInitShutdown (useFakeClipboard: false)]
|
||||
public void IsSupported_Get ()
|
||||
{
|
||||
if (Clipboard.IsSupported) Assert.True (Clipboard.IsSupported);
|
||||
else Assert.False (Clipboard.IsSupported);
|
||||
if (Clipboard.IsSupported) Assert.True (Clipboard.IsSupported);
|
||||
else Assert.False (Clipboard.IsSupported);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown (useFakeClipboard: false)]
|
||||
@@ -129,18 +129,19 @@ else Assert.False (Clipboard.IsSupported);
|
||||
public void TrySetClipboardData_Sets_The_OS_Clipboard ()
|
||||
{
|
||||
var clipText = "The TrySetClipboardData_Sets_The_OS_Clipboard unit test pasted this to the OS clipboard.";
|
||||
if (Clipboard.IsSupported) Assert.True (Clipboard.TrySetClipboardData (clipText));
|
||||
else Assert.False (Clipboard.TrySetClipboardData (clipText));
|
||||
if (Clipboard.IsSupported) Assert.True (Clipboard.TrySetClipboardData (clipText));
|
||||
else Assert.False (Clipboard.TrySetClipboardData (clipText));
|
||||
|
||||
Application.Iteration += () => Application.RequestStop ();
|
||||
|
||||
Application.Run ();
|
||||
|
||||
if (Clipboard.IsSupported) Assert.Equal (clipText, Clipboard.Contents);
|
||||
else Assert.NotEqual (clipText, Clipboard.Contents);
|
||||
if (Clipboard.IsSupported) Assert.Equal (clipText, Clipboard.Contents);
|
||||
else Assert.NotEqual (clipText, Clipboard.Contents);
|
||||
}
|
||||
|
||||
|
||||
// Disabling this test for now because it is not reliable
|
||||
#if false
|
||||
[Fact, AutoInitShutdown (useFakeClipboard: false)]
|
||||
public void Contents_Copies_From_OS_Clipboard ()
|
||||
{
|
||||
@@ -262,12 +263,13 @@ else Assert.NotEqual (clipText, Clipboard.Contents);
|
||||
|
||||
Application.RequestStop ();
|
||||
};
|
||||
|
||||
|
||||
Application.Run ();
|
||||
|
||||
if (!failed) Assert.Equal (clipText, clipReadText.TrimEnd ());
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Is_WSL_Platform ()
|
||||
{
|
||||
@@ -284,5 +286,6 @@ else Assert.NotEqual (clipText, Clipboard.Contents);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,9 @@ namespace Terminal.Gui.TopLevelTests {
|
||||
[AutoInitShutdown]
|
||||
public void Internal_Tests ()
|
||||
{
|
||||
Toplevel.dragPosition = null; // dragPosition is `static` and must be reset for each instance or unit tests will fail?
|
||||
var top = new Toplevel ();
|
||||
|
||||
var eventInvoked = "";
|
||||
|
||||
top.ChildUnloaded += (e) => eventInvoked = "ChildUnloaded";
|
||||
@@ -898,9 +900,9 @@ namespace Terminal.Gui.TopLevelTests {
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
File
|
||||
|
||||
┌────┐
|
||||
│ │
|
||||
└────┘
|
||||
┌─────┐
|
||||
│ │
|
||||
└─────┘
|
||||
|
||||
|
||||
|
||||
@@ -908,7 +910,7 @@ namespace Terminal.Gui.TopLevelTests {
|
||||
CTRL-N New", output);
|
||||
|
||||
Assert.Equal (win, Application.MouseGrabView);
|
||||
Assert.Equal (new Rect (4, 2, 6, 3), Application.MouseGrabView.Frame);
|
||||
Assert.Equal (new Rect (4, 2, 7, 3), Application.MouseGrabView.Frame);
|
||||
|
||||
} else if (iterations == 3) {
|
||||
Assert.Equal (win, Application.MouseGrabView);
|
||||
@@ -929,10 +931,10 @@ namespace Terminal.Gui.TopLevelTests {
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
File
|
||||
┌────┐
|
||||
│ │
|
||||
│ │
|
||||
└────┘
|
||||
┌─────┐
|
||||
│ │
|
||||
└─────┘
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -940,7 +942,7 @@ namespace Terminal.Gui.TopLevelTests {
|
||||
CTRL-N New", output);
|
||||
|
||||
Assert.Equal (win, Application.MouseGrabView);
|
||||
Assert.Equal (new Rect (4, 1, 6, 4), Application.MouseGrabView.Frame);
|
||||
Assert.Equal (new Rect (4, 1, 7, 3), Application.MouseGrabView.Frame);
|
||||
|
||||
} else if (iterations == 5) {
|
||||
Assert.Equal (win, Application.MouseGrabView);
|
||||
|
||||
@@ -477,32 +477,32 @@ namespace Terminal.Gui.TypeTests {
|
||||
f1.Text = "Frame1";
|
||||
Assert.Equal ("Factor(0.5,False)", f1.Width.ToString ());
|
||||
Assert.Equal ("Absolute(5)", f1.Height.ToString ());
|
||||
Assert.Equal (99, f1.Frame.Width); // 100-1=99
|
||||
Assert.Equal (49, f1.Frame.Width); // 100*0.5=49
|
||||
Assert.Equal (5, f1.Frame.Height);
|
||||
|
||||
f2.Text = "Frame2";
|
||||
Assert.Equal ("Fill(0)", f2.Width.ToString ());
|
||||
Assert.Equal ("Absolute(5)", f2.Height.ToString ());
|
||||
Assert.Equal (99, f2.Frame.Width); // 100-1=99
|
||||
Assert.Equal (49, f2.Frame.Width); // f2.X = Pos.Right(f1), thus 50-1=49
|
||||
Assert.Equal (5, f2.Frame.Height);
|
||||
|
||||
v1.Text = "Button1";
|
||||
Assert.Equal ("Combine(DimView(Width,FrameView()({X=0,Y=0,Width=99,Height=5}))-Absolute(2))", v1.Width.ToString ());
|
||||
Assert.Equal ("Combine(DimView(Width,FrameView()({X=0,Y=0,Width=49,Height=5}))-Absolute(2))", v1.Width.ToString ());
|
||||
Assert.Equal ("Combine(Fill(0)-Absolute(2))", v1.Height.ToString ());
|
||||
Assert.Equal (97, v1.Frame.Width); // 99-2=97
|
||||
Assert.Equal (189, v1.Frame.Height); // 198-2-7=189
|
||||
Assert.Equal (47, v1.Frame.Width); // 49-2=47
|
||||
Assert.Equal (89, v1.Frame.Height); // 98-2-7=89
|
||||
|
||||
v2.Text = "Button2";
|
||||
Assert.Equal ("Combine(DimView(Width,FrameView()({X=99,Y=0,Width=99,Height=5}))-Absolute(2))", v2.Width.ToString ());
|
||||
Assert.Equal ("Combine(DimView(Width,FrameView()({X=49,Y=0,Width=49,Height=5}))-Absolute(2))", v2.Width.ToString ());
|
||||
Assert.Equal ("Combine(Fill(0)-Absolute(2))", v2.Height.ToString ());
|
||||
Assert.Equal (97, v2.Frame.Width); // 99-2=97
|
||||
Assert.Equal (189, v2.Frame.Height); // 198-2-7=189
|
||||
Assert.Equal (47, v2.Frame.Width); // 49-2=47
|
||||
Assert.Equal (89, v2.Frame.Height); // 98-2-7=89
|
||||
|
||||
v3.Text = "Button3";
|
||||
Assert.Equal ("Factor(0.1,False)", v3.Width.ToString ());
|
||||
Assert.Equal ("Factor(0.1,False)", v3.Height.ToString ());
|
||||
Assert.Equal (19, v3.Frame.Width); // 198*10%=19 * Percent is related to the super-view if it isn't null otherwise the view width
|
||||
Assert.Equal (19, v3.Frame.Height); // 199*10%=19
|
||||
Assert.Equal (9, v3.Frame.Width); // 98*10%=9 * Percent is related to the super-view if it isn't null otherwise the view width
|
||||
Assert.Equal (9, v3.Frame.Height); // 99*10%=9
|
||||
|
||||
v4.Text = "Button4";
|
||||
v4.AutoSize = false;
|
||||
@@ -517,16 +517,16 @@ namespace Terminal.Gui.TypeTests {
|
||||
Assert.Equal (1, v4.Frame.Height); // 1 because is Dim.DimAbsolute
|
||||
|
||||
v5.Text = "Button5";
|
||||
Assert.Equal ("Combine(DimView(Width,Button()({X=2,Y=7,Width=97,Height=189}))-DimView(Width,Button()({X=0,Y=0,Width=19,Height=19})))", v5.Width.ToString ());
|
||||
Assert.Equal ("Combine(DimView(Height,Button()({X=2,Y=7,Width=97,Height=189}))-DimView(Height,Button()({X=0,Y=0,Width=19,Height=19})))", v5.Height.ToString ());
|
||||
Assert.Equal (78, v5.Frame.Width); // 97-19=78
|
||||
Assert.Equal (170, v5.Frame.Height); // 189-19=170
|
||||
Assert.Equal ("Combine(DimView(Width,Button()({X=2,Y=7,Width=47,Height=89}))-DimView(Width,Button()({X=0,Y=0,Width=9,Height=9})))", v5.Width.ToString ());
|
||||
Assert.Equal ("Combine(DimView(Height,Button()({X=2,Y=7,Width=47,Height=89}))-DimView(Height,Button()({X=0,Y=0,Width=9,Height=9})))", v5.Height.ToString ());
|
||||
Assert.Equal (38, v5.Frame.Width); // 47-9=38
|
||||
Assert.Equal (80, v5.Frame.Height); // 89-9=80
|
||||
|
||||
v6.Text = "Button6";
|
||||
Assert.Equal ("Factor(0.2,True)", v6.Width.ToString ());
|
||||
Assert.Equal ("Factor(0.2,True)", v6.Height.ToString ());
|
||||
Assert.Equal (19, v6.Frame.Width); // 99*20%=19
|
||||
Assert.Equal (38, v6.Frame.Height); // 198-7*20=38
|
||||
Assert.Equal (9, v6.Frame.Width); // 49*20%=9
|
||||
Assert.Equal (18, v6.Frame.Height); // 98-7*20=18
|
||||
};
|
||||
|
||||
Application.Iteration += () => Application.RequestStop ();
|
||||
|
||||
Reference in New Issue
Block a user