New overlapped drawing impl.

This commit is contained in:
Tig
2024-09-18 12:24:47 -06:00
parent 78a3dffea9
commit 941a6ee5e6
19 changed files with 130 additions and 64 deletions

View File

@@ -448,8 +448,8 @@ public class SeriesTests
var gv = new GraphView ();
gv.BeginInit ();
gv.EndInit ();
gv.ColorScheme = new ColorScheme ();
gv.Viewport = new Rectangle (0, 0, 50, 30);
gv.ColorScheme = new ColorScheme ();
var fullGraphBounds = RectangleF.Empty;
var graphScreenBounds = Rectangle.Empty;
@@ -477,6 +477,7 @@ public class SeriesTests
// Even with a margin the graph should be drawn from
// the origin, we just get less visible width/height
gv.LayoutSubviews ();
gv.SetNeedsDisplay ();
gv.Draw ();
Assert.Equal (new RectangleF (0, 0, 45, 28), fullGraphBounds);
@@ -535,6 +536,7 @@ public class SeriesTests
// Even with a margin the graph should be drawn from
// the origin, we just get less visible width/height
gv.LayoutSubviews ();
gv.SetNeedsDisplay ();
gv.Draw ();
Assert.Equal (new RectangleF (0, 0, 90, 140), fullGraphBounds);
@@ -672,6 +674,7 @@ public class MultiBarSeriesTests
multibarSeries.AddBars ("hey", (Rune)'M', 0.5001f, 0.5001f);
fakeXAxis.LabelPoints.Clear ();
gv.LayoutSubviews ();
gv.SetNeedsDisplay ();
gv.Draw ();
Assert.Equal (4, fakeXAxis.LabelPoints.Single ());
@@ -680,6 +683,7 @@ public class MultiBarSeriesTests
multibarSeries.AddBars ("bob", (Rune)'M', 1, 2);
fakeXAxis.LabelPoints.Clear ();
gv.LayoutSubviews ();
gv.SetNeedsDisplay ();
gv.Draw ();
Assert.Equal (3, fakeXAxis.LabelPoints.Count);
@@ -741,6 +745,7 @@ public class BarSeriesTests
);
// redraw graph
graph.SetNeedsDisplay ();
graph.Draw ();
// since bars are horizontal all have the same X start cordinates
@@ -804,6 +809,7 @@ public class BarSeriesTests
barSeries.Orientation = Orientation.Vertical;
// redraw graph
graph.SetNeedsDisplay ();
graph.Draw ();
// bar should be drawn at BarEvery 1f + offset 0.5f = 3 screen units
@@ -845,6 +851,7 @@ public class BarSeriesTests
barSeries.Orientation = Orientation.Vertical;
// redraw graph
graph.SetNeedsDisplay ();
graph.Draw ();
// bar should not be drawn
@@ -869,11 +876,11 @@ public class BarSeriesTests
var gv = new GraphView ();
gv.BeginInit ();
gv.EndInit ();
gv.ColorScheme = new ColorScheme ();
// y axis goes from 0.1 to 1 across 10 console rows
// x axis goes from 0 to 10 across 20 console columns
gv.Viewport = new Rectangle (0, 0, 20, 10);
gv.ColorScheme = new ColorScheme ();
gv.CellSize = new PointF (0.5f, 0.1f);
gv.Series.Add (series = new FakeBarSeries ());
@@ -913,8 +920,8 @@ public class AxisTests
GraphViewTests.InitFakeDriver ();
var gv = new GraphView ();
gv.ColorScheme = new ColorScheme ();
gv.Viewport = new Rectangle (0, 0, 50, 30);
gv.ColorScheme = new ColorScheme ();
// graph can't be completely empty or it won't draw
gv.Series.Add (new ScatterSeries ());
@@ -1109,9 +1116,7 @@ public class TextAnnotationTests
var expected =
@$"
┤ {
CM.Glyphs.Dot
}
┤ {CM.Glyphs.Dot}
0┼┬┬┬┬┬┬┬┬
0 5";
@@ -1146,6 +1151,7 @@ public class TextAnnotationTests
// user scrolls up one unit of graph space
gv.ScrollOffset = new PointF (0, 1f);
gv.SetNeedsDisplay ();
gv.Draw ();
// we expect the text annotation to go down one line since
@@ -1179,6 +1185,7 @@ public class TextAnnotationTests
);
gv.LayoutSubviews ();
gv.SetNeedsDisplay ();
gv.Draw ();
// long text should get truncated
@@ -1252,6 +1259,7 @@ public class TextAnnotationTests
// user scrolls up one unit of graph space
gv.ScrollOffset = new PointF (0, 1f);
gv.SetNeedsDisplay ();
gv.Draw ();
// we expect no change in the location of the annotation (only the axis label changes)
@@ -1269,6 +1277,7 @@ public class TextAnnotationTests
// user scrolls up one unit of graph space
gv.ScrollOffset = new PointF (0, 1f);
gv.SetNeedsDisplay ();
gv.Draw ();
// we expect no change in the location of the annotation (only the axis label changes)
@@ -1527,6 +1536,7 @@ public class PathAnnotationTests
// render view
view.ColorScheme = new ColorScheme ();
Assert.Equal (1, view.Height);
mount.SetNeedsDisplay ();
mount.Draw ();
// should have the initial text
@@ -1534,6 +1544,7 @@ public class PathAnnotationTests
// change the text and redraw
view.Text = "ff1234";
mount.SetNeedsDisplay ();
mount.Draw ();
// should have the new text rendered
@@ -1565,6 +1576,7 @@ public class PathAnnotationTests
gv.MarginBottom = 1;
gv.LayoutSubviews ();
gv.SetNeedsDisplay ();
gv.Draw ();
var expected =
@@ -1572,13 +1584,9 @@ public class PathAnnotationTests
2┤
1┤{
CM.Glyphs.Dot
}
1┤{CM.Glyphs.Dot}
0┼┬┬┬┬{
CM.Glyphs.Dot
}┬
0┼┬┬┬┬{CM.Glyphs.Dot}┬
0 5
";
@@ -1607,18 +1615,15 @@ public class PathAnnotationTests
gv.MarginLeft = 1;
gv.LayoutSubviews ();
gv.SetNeedsDisplay ();
gv.Draw ();
var expected =
@$"
1┤{
CM.Glyphs.Dot
}
1┤{CM.Glyphs.Dot}
0┼┬┬┬┬{
CM.Glyphs.Dot
}┬┬┬
0┼┬┬┬┬{CM.Glyphs.Dot}┬┬┬
0 5
";