Changeset 1386


Ignore:
Timestamp:
03/21/09 11:45:26 (10 years ago)
Author:
cbahner
Message:

#519 test cases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs

    r1350 r1386  
    171171      }
    172172     
    173       public void DoWork() {
     173      public void DoWorkMultiLine() {
    174174
    175175        IDataRow row1 = new DataRow();
    176176        row1.Color = Color.Red;
    177177        row1.Thickness = 2;
    178         row1.Label = "Simon";
     178        row1.Label = "Sinus";
    179179        row1.Style = DrawingStyle.Solid;
    180180        model.AddDataRow(row1);
     
    183183        row2.Color = Color.Red;
    184184        row2.Thickness = 3;
    185         row2.Label = "Simon";
     185        row2.Label = "Growing";
    186186        row2.Style = DrawingStyle.Solid;
    187187        model.AddDataRow(row2);
    188 
    189 
    190         MinAggregator aggregator = new MinAggregator();
    191         aggregator.Label = "MinAggregator";
    192         aggregator.Color = Color.Pink;
    193         aggregator.Thickness = 3;
    194         aggregator.Style = DrawingStyle.Solid;
    195         aggregator.LineType = DataRowType.SingleValue;
    196         aggregator.AddWatch(row1);
    197         model.AddDataRow(aggregator);
    198 
    199         MaxAggregator maxAggregator = new MaxAggregator();
    200         maxAggregator.Label = "MaxAggregator";
    201         maxAggregator.Color = Color.DeepSkyBlue;
    202         maxAggregator.Thickness = 3;
    203         maxAggregator.Style = DrawingStyle.Solid;
    204         maxAggregator.LineType = DataRowType.SingleValue;
    205         maxAggregator.AddWatch(row1);
    206         model.AddDataRow(maxAggregator);
    207        
    208        
    209         AvgAggregator avgAggregator = new AvgAggregator();
    210         avgAggregator.Label = "AvgAggregator";
    211         avgAggregator.Color = Color.Violet;
    212         avgAggregator.Thickness = 3;
    213         avgAggregator.Style = DrawingStyle.Solid;
    214         avgAggregator.LineType = DataRowType.SingleValue;
    215         avgAggregator.AddWatch(row1);
    216         model.AddDataRow(avgAggregator);
    217188
    218189        AvgAggregator multiAvgAggregator = new AvgAggregator();
     
    272243        Console.WriteLine("worker thread: terminating gracefully.");
    273244      }
     245      public void DoWorkSingleLine() {
     246
     247        IDataRow row1 = new DataRow();
     248        row1.Color = Color.Red;
     249        row1.Thickness = 2;
     250        row1.Label = "Sinus";
     251        row1.Style = DrawingStyle.Solid;
     252        model.AddDataRow(row1);
     253
     254        IDataRow row2 = new DataRow();
     255        row2.Color = Color.Red;
     256        row2.Thickness = 3;
     257        row2.Label = "Growing";
     258        row2.Style = DrawingStyle.Solid;
     259        model.AddDataRow(row2);
     260
     261        MinAggregator aggregator = new MinAggregator();
     262        aggregator.Label = "MinAggregator";
     263        aggregator.Color = Color.Pink;
     264        aggregator.Thickness = 3;
     265        aggregator.Style = DrawingStyle.Solid;
     266        aggregator.LineType = DataRowType.SingleValue;
     267        aggregator.AddWatch(row1);
     268        model.AddDataRow(aggregator);
     269
     270        MaxAggregator maxAggregator = new MaxAggregator();
     271        maxAggregator.Label = "MaxAggregator";
     272        maxAggregator.Color = Color.DeepSkyBlue;
     273        maxAggregator.Thickness = 3;
     274        maxAggregator.Style = DrawingStyle.Solid;
     275        maxAggregator.LineType = DataRowType.SingleValue;
     276        maxAggregator.AddWatch(row1);
     277        model.AddDataRow(maxAggregator);
     278
     279        AvgAggregator avgAggregator = new AvgAggregator();
     280        avgAggregator.Label = "AvgAggregator";
     281        avgAggregator.Color = Color.Violet;
     282        avgAggregator.Thickness = 3;
     283        avgAggregator.Style = DrawingStyle.Solid;
     284        avgAggregator.LineType = DataRowType.SingleValue;
     285        avgAggregator.AddWatch(row1);
     286        model.AddDataRow(avgAggregator);
     287
     288        double i = 0;
     289        double newY;
     290
     291        Random rand = new Random();
     292        while (!_shouldStop && i <= 24) {
     293          i += 0.2;
     294          newY = Math.Sin(i);
     295          System.Console.WriteLine("working");
     296          //row1.AddValue(rand.NextDouble() * 10);
     297          row1.AddValue(newY * 10);
     298          row2.AddValue(i * 2 - 15);
     299          System.Threading.Thread.Sleep(100);
     300        }
     301        Console.WriteLine("worker thread: terminating gracefully.");
     302      }
     303      public void DoWorkAvgLine() {
     304
     305        IDataRow row1 = new DataRow();
     306        row1.Color = Color.Red;
     307        row1.Thickness = 2;
     308        row1.Label = "Sinus";
     309        row1.Style = DrawingStyle.Solid;
     310        model.AddDataRow(row1);
     311
     312        IDataRow row2 = new DataRow();
     313        row2.Color = Color.Red;
     314        row2.Thickness = 3;
     315        row2.Label = "Growing";
     316        row2.Style = DrawingStyle.Solid;
     317        model.AddDataRow(row2);
     318
     319        AvgLineAggregator avgLineAggregator = new AvgLineAggregator();
     320        avgLineAggregator.Label = "AvgLineAggregator";
     321        avgLineAggregator.Color = Color.Violet;
     322        avgLineAggregator.Thickness = 3;
     323        avgLineAggregator.Style = DrawingStyle.Solid;
     324        avgLineAggregator.LineType = DataRowType.Normal;
     325        avgLineAggregator.AddWatch(row1);
     326        avgLineAggregator.AddWatch(row2);
     327        model.AddDataRow(avgLineAggregator);
     328
     329        double i = 0;
     330        double newY;
     331
     332        Random rand = new Random();
     333        while (!_shouldStop && i <= 24) {
     334          i += 0.2;
     335          newY = Math.Sin(i);
     336          System.Console.WriteLine("working");
     337          //row1.AddValue(rand.NextDouble() * 10);
     338          row1.AddValue(newY * 10);
     339          row2.AddValue(i * 2 - 15);
     340          System.Threading.Thread.Sleep(100);
     341        }
     342        Console.WriteLine("worker thread: terminating gracefully.");
     343      }
    274344      public void RequestStop() {
    275345        _shouldStop = true;
     
    282352
    283353    [Test]
    284     public void TestAggregator2() {
     354    public void TestAggregatorMultiLine() {
     355      LineChartTestForm f = new LineChartTestForm(model);
     356
     357      // Create the thread object. This does not start the thread.
     358      Worker workerObject = new Worker(model);
     359      Thread workerThread = new Thread(workerObject.DoWorkMultiLine);
     360
     361      // Start the worker thread.
     362      workerThread.Start();
     363
     364      f.ShowDialog();
     365      workerObject.RequestStop();
     366    }
     367
     368    [Test]
     369    public void TestAggregatorSingleLine() {
    285370      LineChartTestForm f = new LineChartTestForm(model);
    286371   
    287372      // Create the thread object. This does not start the thread.
    288373      Worker workerObject = new Worker(model);
    289       Thread workerThread = new Thread(workerObject.DoWork);
     374      Thread workerThread = new Thread(workerObject.DoWorkSingleLine);
     375
     376      // Start the worker thread.
     377      workerThread.Start();
     378
     379      f.ShowDialog();
     380      workerObject.RequestStop();
     381    }
     382    [Test]
     383    public void TestAggregatorAvgLine() {
     384      LineChartTestForm f = new LineChartTestForm(model);
     385
     386      // Create the thread object. This does not start the thread.
     387      Worker workerObject = new Worker(model);
     388      Thread workerThread = new Thread(workerObject.DoWorkAvgLine);
    290389
    291390      // Start the worker thread.
Note: See TracChangeset for help on using the changeset viewer.