1 | using System;
|
---|
2 | using System.Drawing;
|
---|
3 | using NUnit.Framework;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.Visualization.Test {
|
---|
6 | [TestFixture]
|
---|
7 | public class LineChartTests {
|
---|
8 | private ChartDataRowsModel model;
|
---|
9 |
|
---|
10 | [SetUp]
|
---|
11 | public void SetUp() {
|
---|
12 | model = new ChartDataRowsModel();
|
---|
13 | }
|
---|
14 |
|
---|
15 | [Test]
|
---|
16 | public void TestLineChart() {
|
---|
17 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
18 |
|
---|
19 | IDataRow row1 = new DataRow();
|
---|
20 | IDataRow row2 = new DataRow();
|
---|
21 | IDataRow row3 = new DataRow();
|
---|
22 |
|
---|
23 | row1.Color = Color.Red;
|
---|
24 | row2.Color = Color.Green;
|
---|
25 | row3.Color = Color.Blue;
|
---|
26 |
|
---|
27 | row1.Thickness = 3;
|
---|
28 | row2.Thickness = 4;
|
---|
29 | row3.Thickness = 5;
|
---|
30 |
|
---|
31 | row1.Label = "Simon";
|
---|
32 | row2.Label = "Gertschi";
|
---|
33 | row3.Label = "Maxi";
|
---|
34 |
|
---|
35 | row1.Style = DrawingStyle.Solid;
|
---|
36 | row2.Style = DrawingStyle.Solid;
|
---|
37 | row3.Style = DrawingStyle.Dashed;
|
---|
38 |
|
---|
39 |
|
---|
40 | model.AddDataRow(row1);
|
---|
41 | model.AddDataRow(row2);
|
---|
42 | model.AddDataRow(row3);
|
---|
43 |
|
---|
44 | row1.AddValue(10);
|
---|
45 | row1.AddValue(5);
|
---|
46 | row1.AddValue(7);
|
---|
47 | row1.AddValue(3);
|
---|
48 | row1.AddValue(10);
|
---|
49 | row1.AddValue(2);
|
---|
50 |
|
---|
51 | row2.AddValue(5);
|
---|
52 | row2.AddValue(6);
|
---|
53 | row2.AddValue(5);
|
---|
54 |
|
---|
55 | row3.AddValue(2);
|
---|
56 | row3.AddValue(2);
|
---|
57 | row3.AddValue(2);
|
---|
58 | row3.AddValue(2);
|
---|
59 | row3.AddValue(2);
|
---|
60 |
|
---|
61 | Random rand = new Random();
|
---|
62 |
|
---|
63 | for (int i = 0; i < 10000; i++) {
|
---|
64 | row1.AddValue(rand.NextDouble()*10);
|
---|
65 | row2.AddValue(rand.NextDouble()*10);
|
---|
66 | row3.AddValue(rand.NextDouble()*10);
|
---|
67 | }
|
---|
68 |
|
---|
69 | f.ShowDialog();
|
---|
70 | }
|
---|
71 |
|
---|
72 | [Test]
|
---|
73 | public void TestAxes() {
|
---|
74 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
75 |
|
---|
76 | IDataRow row1 = new DataRow();
|
---|
77 | IDataRow row2 = new DataRow();
|
---|
78 |
|
---|
79 | row1.Color = Color.Red;
|
---|
80 | row1.Thickness = 3;
|
---|
81 | row1.Style = DrawingStyle.Solid;
|
---|
82 |
|
---|
83 | row2.Color = Color.Green;
|
---|
84 | row2.Thickness = 3;
|
---|
85 | row2.Style = DrawingStyle.Solid;
|
---|
86 |
|
---|
87 | model.AddDataRow(row1);
|
---|
88 | model.AddDataRow(row2);
|
---|
89 |
|
---|
90 | Random rand = new Random(42);
|
---|
91 |
|
---|
92 | for (int i = 0; i < 10; i++) {
|
---|
93 | row1.AddValue(rand.NextDouble()*10);
|
---|
94 | row2.AddValue(rand.NextDouble()*10);
|
---|
95 | }
|
---|
96 |
|
---|
97 | f.ShowDialog();
|
---|
98 | }
|
---|
99 |
|
---|
100 | [Test]
|
---|
101 | public void TestAutoZoomInConstructor() {
|
---|
102 | IDataRow row1 = new DataRow();
|
---|
103 |
|
---|
104 | row1.Color = Color.Red;
|
---|
105 | row1.Thickness = 3;
|
---|
106 | row1.Style = DrawingStyle.Solid;
|
---|
107 |
|
---|
108 | model.AddDataRow(row1);
|
---|
109 |
|
---|
110 | row1.AddValue(10);
|
---|
111 | row1.AddValue(5);
|
---|
112 | row1.AddValue(7);
|
---|
113 | row1.AddValue(3);
|
---|
114 | row1.AddValue(10);
|
---|
115 | row1.AddValue(2);
|
---|
116 |
|
---|
117 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
118 | f.ShowDialog();
|
---|
119 | }
|
---|
120 |
|
---|
121 |
|
---|
122 | [Test]
|
---|
123 | public void TestSingleValueDataRows() {
|
---|
124 | LineChartTestForm f = new LineChartTestForm(model);
|
---|
125 |
|
---|
126 | IDataRow row1 = new DataRow();
|
---|
127 | IDataRow row2 = new DataRow();
|
---|
128 | IDataRow row3 = new DataRow();
|
---|
129 |
|
---|
130 | row1.Color = Color.Red;
|
---|
131 | row2.Color = Color.Green;
|
---|
132 | row3.Color = Color.Blue;
|
---|
133 |
|
---|
134 | row1.Thickness = 3;
|
---|
135 | row2.Thickness = 4;
|
---|
136 | row3.Thickness = 5;
|
---|
137 |
|
---|
138 | row1.Label = "SingleValue";
|
---|
139 | row2.Label = "Gertschi";
|
---|
140 | row3.Label = "Maxi";
|
---|
141 |
|
---|
142 | row1.Style = DrawingStyle.Solid;
|
---|
143 | row2.Style = DrawingStyle.Solid;
|
---|
144 | row3.Style = DrawingStyle.Dashed;
|
---|
145 |
|
---|
146 | row1.LineType = DataRowType.SingleValue;
|
---|
147 | row2.LineType = DataRowType.SingleValue;
|
---|
148 | row1.AddValue(12);
|
---|
149 |
|
---|
150 | model.AddDataRow(row1);
|
---|
151 | model.AddDataRow(row2);
|
---|
152 | model.AddDataRow(row3);
|
---|
153 |
|
---|
154 |
|
---|
155 |
|
---|
156 | row2.AddValue(5);
|
---|
157 |
|
---|
158 |
|
---|
159 | row3.AddValue(2);
|
---|
160 | row3.AddValue(5);
|
---|
161 | row3.AddValue(9);
|
---|
162 | row3.AddValue(1);
|
---|
163 | row3.AddValue(3);
|
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 |
|
---|
168 | f.ShowDialog();
|
---|
169 | }
|
---|
170 |
|
---|
171 |
|
---|
172 |
|
---|
173 | [Test]
|
---|
174 | public void TestMainForm() {
|
---|
175 | MainForm f = new MainForm();
|
---|
176 | f.ShowDialog();
|
---|
177 | }
|
---|
178 | }
|
---|
179 | }
|
---|