~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/NUnit/Gui/TestResultsPad.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
                ToggleButton buttonSuccess;
75
75
                ToggleButton buttonFailures;
76
76
                ToggleButton buttonIgnored;
 
77
                ToggleButton buttonInconclusive;
77
78
                ToggleButton buttonOutput;
78
79
                
79
80
                bool running;
91
92
                
92
93
                bool cancel;
93
94
                
94
 
                public class ResultRecord {
 
95
                public class ResultRecord
 
96
                {
95
97
                        public UnitTest Test;
96
98
                        public UnitTestResult Result;
97
99
                }
124
126
                
125
127
                        var sw = new MonoDevelop.Components.CompactScrolledWindow ();
126
128
                        sw.ShadowType = ShadowType.None;
127
 
                        sw.Add(failuresTreeView);
 
129
                        sw.Add (failuresTreeView);
128
130
                        book.Pack1 (sw, true, true);
129
131
                        
130
 
                        outputView = new TextView();
 
132
                        outputView = new MonoDevelop.Ide.Gui.Components.LogView.LogTextView ();
131
133
                        outputView.Editable = false;
132
134
                        bold = new TextTag ("bold");
133
135
                        bold.Weight = Pango.Weight.Bold;
134
136
                        outputView.Buffer.TagTable.Add (bold);
135
137
                        sw = new MonoDevelop.Components.CompactScrolledWindow ();
136
138
                        sw.ShadowType = ShadowType.None;
137
 
                        sw.Add(outputView);
 
139
                        sw.Add (outputView);
138
140
                        book.Pack2 (sw, true, true);
139
141
                        outputViewScrolled = sw;
140
142
                        
164
166
                        buttonSuccess.Toggled += new EventHandler (OnShowSuccessfulToggled);
165
167
                        buttonSuccess.TooltipText = GettextCatalog.GetString ("Show Successful Tests");
166
168
                        toolbar.Add (buttonSuccess);
 
169
 
 
170
                        buttonInconclusive = new ToggleButton ();
 
171
                        buttonInconclusive.Label = GettextCatalog.GetString ("Inconclusive Tests");
 
172
                        buttonInconclusive.Active = true;
 
173
                        buttonInconclusive.Image = new Gtk.Image (CircleImage.Inconclusive);
 
174
                        buttonInconclusive.Image.Show ();
 
175
                        buttonInconclusive.Toggled += new EventHandler (OnShowInconclusiveToggled);
 
176
                        buttonInconclusive.TooltipText = GettextCatalog.GetString ("Show Inconclusive Tests");
 
177
                        toolbar.Add (buttonInconclusive);
167
178
                        
168
179
                        buttonFailures = new ToggleButton ();
169
180
                        buttonFailures.Label = GettextCatalog.GetString ("Failed Tests");
173
184
                        buttonFailures.Toggled += new EventHandler (OnShowFailuresToggled);
174
185
                        buttonFailures.TooltipText = GettextCatalog.GetString ("Show Failed Tests");
175
186
                        toolbar.Add (buttonFailures);
176
 
                        
 
187
 
177
188
                        buttonIgnored = new ToggleButton ();
178
189
                        buttonIgnored.Label = GettextCatalog.GetString ("Ignored Tests");
179
190
                        buttonIgnored.Active = true;
243
254
                
244
255
                public void OnTestSuiteChanged (object sender, EventArgs e)
245
256
                {
 
257
                        if (failuresTreeView.IsRealized)
 
258
                                failuresTreeView.ScrollToPoint (0, 0);
 
259
 
246
260
                        results.Clear ();
247
261
                        
248
262
                        error = null;
314
328
                        labels.Show ();
315
329
                        buttonStop.Sensitive = true;
316
330
                        buttonRun.Sensitive = false;
 
331
 
 
332
                        if (failuresTreeView.IsRealized)
 
333
                                failuresTreeView.ScrollToPoint (0, 0);
317
334
                        
318
335
                        failuresStore.Clear ();
319
336
                        outputView.Buffer.Clear ();
463
480
                {
464
481
                        Pad pad = IdeApp.Workbench.GetPad<TestPad> ();
465
482
                        pad.BringToFront ();
466
 
                        TestPad content = (TestPad) pad.Content;
 
483
                        TestPad content = (TestPad)pad.Content;
467
484
                        content.SelectTest (GetSelectedTest ());
468
485
                }
469
486
                
516
533
                        if (!failuresTreeView.Selection.GetSelected (out foo, out iter))
517
534
                                return null;
518
535
                                
519
 
                        UnitTest t = (UnitTest) failuresStore.GetValue (iter, 2);
 
536
                        UnitTest t = (UnitTest)failuresStore.GetValue (iter, 2);
520
537
                        return t;
521
538
                }
522
539
                
524
541
                {
525
542
                        RefreshList ();
526
543
                }
527
 
 
 
544
                
528
545
                void OnShowFailuresToggled (object sender, EventArgs args)
529
546
                {
530
547
                        RefreshList ();
531
548
                }
532
549
                
 
550
                void OnShowInconclusiveToggled (object sender, EventArgs args)
 
551
                {
 
552
                        RefreshList ();
 
553
                }
 
554
                
533
555
                void OnShowIgnoredToggled (object sender, EventArgs args)
534
556
                {
535
557
                        RefreshList ();
542
564
                
543
565
                void RefreshList ()
544
566
                {
 
567
                        if (failuresTreeView.IsRealized)
 
568
                                failuresTreeView.ScrollToPoint (0, 0);
 
569
 
545
570
                        failuresStore.Clear ();
546
571
                        outputView.Buffer.Clear ();
547
572
                        outIters.Clear ();
587
612
                                        failuresStore.AppendValues (testRow, null, Escape (result.Message), test);
588
613
                                failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
589
614
                        }
 
615
                        if (result.IsInconclusive) {
 
616
                                if (!buttonInconclusive.Active)
 
617
                                        return;
 
618
                                TreeIter testRow = failuresStore.AppendValues (CircleImage.Inconclusive, Escape (test.FullName), test);
 
619
                                if (result.Message != null)
 
620
                                        failuresStore.AppendValues (testRow, null, Escape (result.Message), test);
 
621
                                failuresTreeView.ScrollToCell (failuresStore.GetPath (testRow), null, false, 0, 0);
 
622
                        }
590
623
                        
591
624
                        string msg = GettextCatalog.GetString ("Running {0} ...", test.FullName);
592
625
                        TextIter it = outputView.Buffer.EndIter;
656
689
                public event TestHandler CancelRequested;
657
690
        }
658
691
        
659
 
        class TestMonitor: GuiSyncObject, ITestProgressMonitor
 
692
        class TestMonitor: ITestProgressMonitor
660
693
        {
661
 
                // TestResultsPad can't be a GuiSyncObject because there are some
662
 
                // object identity issues. If the pad is registered using the
663
 
                // proxy, it will get different hash codes depending on the caller.
664
 
                
665
694
                ITestProgressMonitor monitor;
666
695
                TestResultsPad pad;
667
696
                
668
 
                public TestMonitor (TestResultsPad pad) {
 
697
                public TestMonitor (TestResultsPad pad)
 
698
                {
669
699
                        this.pad = pad;
670
700
                        this.monitor = pad;
671
701
                }
672
 
                public void InitializeTestRun (UnitTest test) {
673
 
                        pad.InitializeTestRun (test);
674
 
                }
675
 
                public void FinishTestRun () {
676
 
                        pad.FinishTestRun ();
677
 
                }
678
 
                public void Cancel () {
679
 
                        pad.Cancel ();
680
 
                }
681
 
                public void BeginTest (UnitTest test) {
682
 
                        monitor.BeginTest (test);
683
 
                }
684
 
                public void EndTest (UnitTest test, UnitTestResult result) {
685
 
                        monitor.EndTest (test, result);
686
 
                }
687
 
                public void ReportRuntimeError (string message, Exception exception) {
688
 
                        monitor.ReportRuntimeError (message, exception);
 
702
                public void InitializeTestRun (UnitTest test)
 
703
                {
 
704
                        DispatchService.GuiDispatch (delegate {
 
705
                                pad.InitializeTestRun (test);
 
706
                        });
 
707
                }
 
708
                public void FinishTestRun ()
 
709
                {
 
710
                        DispatchService.GuiDispatch (delegate {
 
711
                                pad.FinishTestRun ();
 
712
                        });
 
713
                }
 
714
                public void Cancel ()
 
715
                {
 
716
                        DispatchService.GuiDispatch (delegate {
 
717
                                pad.Cancel ();
 
718
                        });
 
719
                }
 
720
                public void BeginTest (UnitTest test)
 
721
                {
 
722
                        DispatchService.GuiDispatch (delegate {
 
723
                                monitor.BeginTest (test);
 
724
                        });
 
725
                }
 
726
                public void EndTest (UnitTest test, UnitTestResult result)
 
727
                {
 
728
                        DispatchService.GuiDispatch (delegate {
 
729
                                monitor.EndTest (test, result);
 
730
                        });
 
731
                }
 
732
                public void ReportRuntimeError (string message, Exception exception)
 
733
                {
 
734
                        DispatchService.GuiDispatch (delegate {
 
735
                                monitor.ReportRuntimeError (message, exception);
 
736
                        });
689
737
                }
690
738
                public bool IsCancelRequested {
691
739
                        get { return monitor.IsCancelRequested; }