fixed graphview unit tests

This commit is contained in:
Tigger Kindel
2023-04-04 15:49:36 -06:00
parent a5a7f84c39
commit 7eaccbd2a7
2 changed files with 20 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ using Xunit.Abstractions;
using Rune = System.Rune;
namespace Terminal.Gui.ViewTests {
#if false // BUGBUG: v2 see https://github.com/gui-cs/Terminal.Gui/issues/2463
// BUGBUG: v2 see https://github.com/gui-cs/Terminal.Gui/issues/2463
#region Helper Classes
class FakeHAxis : HorizontalAxis {
@@ -86,6 +86,8 @@ namespace Terminal.Gui.ViewTests {
GraphViewTests.InitFakeDriver ();
var gv = new GraphView ();
gv.BeginInit (); gv.EndInit ();
gv.ColorScheme = new ColorScheme ();
gv.MarginBottom = 1;
gv.MarginLeft = 1;
@@ -100,6 +102,8 @@ namespace Terminal.Gui.ViewTests {
public void ScreenToGraphSpace_DefaultCellSize ()
{
var gv = new GraphView ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 20, 10);
// origin should be bottom left
@@ -119,7 +123,7 @@ namespace Terminal.Gui.ViewTests {
public void ScreenToGraphSpace_DefaultCellSize_WithMargin ()
{
var gv = new GraphView ();
gv.LayoutSubviews ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 20, 10);
@@ -155,7 +159,7 @@ namespace Terminal.Gui.ViewTests {
public void ScreenToGraphSpace_CustomCellSize ()
{
var gv = new GraphView ();
gv.LayoutSubviews ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 20, 10);
@@ -186,7 +190,7 @@ namespace Terminal.Gui.ViewTests {
public void GraphSpaceToScreen_DefaultCellSize ()
{
var gv = new GraphView ();
gv.LayoutSubviews ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 20, 10);
@@ -205,7 +209,7 @@ namespace Terminal.Gui.ViewTests {
public void GraphSpaceToScreen_DefaultCellSize_WithMargin ()
{
var gv = new GraphView ();
gv.LayoutSubviews ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 20, 10);
@@ -234,7 +238,7 @@ namespace Terminal.Gui.ViewTests {
public void GraphSpaceToScreen_ScrollOffset ()
{
var gv = new GraphView ();
gv.LayoutSubviews ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 20, 10);
@@ -255,7 +259,7 @@ namespace Terminal.Gui.ViewTests {
public void GraphSpaceToScreen_CustomCellSize ()
{
var gv = new GraphView ();
gv.LayoutSubviews ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 20, 10);
@@ -295,7 +299,7 @@ namespace Terminal.Gui.ViewTests {
public void GraphSpaceToScreen_CustomCellSize_WithScrollOffset ()
{
var gv = new GraphView ();
gv.LayoutSubviews ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 20, 10);
@@ -340,6 +344,8 @@ namespace Terminal.Gui.ViewTests {
InitFakeDriver ();
var gv = new GraphView ();
gv.BeginInit (); gv.EndInit ();
gv.ColorScheme = new ColorScheme ();
gv.Bounds = new Rect (0, 0, 50, 30);
gv.Series.Add (new ScatterSeries () { Points = new List<PointF> { new PointF (1, 1) } });
@@ -363,6 +369,7 @@ namespace Terminal.Gui.ViewTests {
public void TestReversing_ScreenToGraphSpace ()
{
var gv = new GraphView ();
gv.BeginInit (); gv.EndInit ();
gv.Bounds = new Rect (0, 0, 50, 30);
// How much graph space each cell of the console depicts
@@ -414,6 +421,7 @@ namespace Terminal.Gui.ViewTests {
GraphViewTests.InitFakeDriver ();
var gv = new GraphView ();
gv.BeginInit (); gv.EndInit ();
gv.ColorScheme = new ColorScheme ();
gv.Bounds = new Rect (0, 0, 50, 30);
@@ -460,6 +468,7 @@ namespace Terminal.Gui.ViewTests {
GraphViewTests.InitFakeDriver ();
var gv = new GraphView ();
gv.BeginInit (); gv.EndInit ();
gv.ColorScheme = new ColorScheme ();
gv.Bounds = new Rect (0, 0, 50, 30);
@@ -683,6 +692,7 @@ namespace Terminal.Gui.ViewTests {
GraphViewTests.InitFakeDriver ();
var gv = new GraphView ();
gv.BeginInit (); gv.EndInit ();
gv.ColorScheme = new ColorScheme ();
// y axis goes from 0.1 to 1 across 10 console rows
@@ -1601,5 +1611,5 @@ namespace Terminal.Gui.ViewTests {
Assert.Equal (6.6f, render.Value);
}
}
#endif
}

View File

@@ -3,7 +3,7 @@ using Terminal.Gui;
using Xunit;
using Xunit.Abstractions;
namespace UnitTests.Views {
namespace Terminal.Gui.ViewsTests {
public class SpinnerViewTests {
readonly ITestOutputHelper output;