~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
                Dictionary<UnitTest,int> outIters = new Dictionary<UnitTest,int> ();
67
67
                Widget outputViewScrolled;
68
68
                VSeparator infoSep;
 
69
                Gtk.TreeIter startMessageIter;
69
70
                
70
71
                Button buttonStop;
71
72
                Button buttonRun;
240
241
                public void OnTestSuiteChanged (object sender, EventArgs e)
241
242
                {
242
243
                        results.Clear ();
 
244
                        
 
245
                        error = null;
 
246
                        errorMessage = null;
 
247
                        
243
248
                        failuresStore.Clear ();
244
249
                        outputView.Buffer.Clear ();
245
250
                        outIters.Clear ();
285
290
                        rootTest = test;
286
291
                        results.Clear ();
287
292
                        testsToRun = test.CountTestCases ();
 
293
                        
 
294
                        error = null;
 
295
                        errorMessage = null;
 
296
                        
288
297
                        progressBar.Fraction = 0;
289
298
                        progressBar.Text = "";
290
299
                        progressBar.Text = "0 / " + testsToRun;
313
322
                        AddStartMessage ();
314
323
                }
315
324
                
316
 
                public void AddStartMessage ()
 
325
                public void AddStartMessage (bool isRunning = true)
317
326
                {
318
327
                        if (rootTest != null) {
319
328
                                Gdk.Pixbuf infoIcon = failuresTreeView.RenderIcon (Gtk.Stock.DialogInfo, Gtk.IconSize.Menu, "");
320
 
                                string msg = string.Format (GettextCatalog.GetString ("Running tests for <b>{0}</b> configuration <b>{1}</b>"), rootTest.Name, configuration);
321
 
                                failuresStore.AppendValues (infoIcon, msg, rootTest);
 
329
                                string msg = string.Format (isRunning ? GettextCatalog.GetString ("Running tests for <b>{0}</b> configuration <b>{1}</b>") : GettextCatalog.GetString ("Test results for <b>{0}</b> configuration <b>{1}</b>"), rootTest.Name, configuration);
 
330
                                startMessageIter = failuresStore.AppendValues (infoIcon, msg, rootTest);
 
331
                        } else {
 
332
                                startMessageIter = Gtk.TreeIter.Zero;
322
333
                        }
323
334
                }
324
335
 
359
370
                
360
371
                public void FinishTestRun ()
361
372
                {
 
373
                        if (!Gtk.TreeIter.Zero.Equals (startMessageIter)) {
 
374
                                string msg = string.Format (GettextCatalog.GetString ("Test results for <b>{0}</b> configuration <b>{1}</b>"), rootTest.Name, configuration);
 
375
                                failuresStore.SetValue (startMessageIter, 1, msg);
 
376
                                startMessageIter = Gtk.TreeIter.Zero;
 
377
                        }
362
378
                        infoCurrent.Text = "";
363
379
                        progressBar.Fraction = 1;
364
380
                        progressBar.Text = "";
410
426
                                        if (i != -1) {
411
427
                                                int line;
412
428
                                                if (int.TryParse (file.Substring (i+1), out line)) {
413
 
                                                        IdeApp.Workbench.OpenDocument (file.Substring (0, i), line, -1, true);
 
429
                                                        IdeApp.Workbench.OpenDocument (file.Substring (0, i), line, -1);
414
430
                                                        return;
415
431
                                                }
416
432
                                        }
462
478
                        if (loc == null)
463
479
                                loc = test.SourceCodeLocation;
464
480
                        if (loc != null)
465
 
                                IdeApp.Workbench.OpenDocument (loc.FileName, loc.Line, loc.Column, true);
 
481
                                IdeApp.Workbench.OpenDocument (loc.FileName, loc.Line, loc.Column);
466
482
                }
467
483
                
468
484
                [CommandHandler (TestCommands.ShowTestCode)]
473
489
                                return;
474
490
                        SourceCodeLocation loc = test.SourceCodeLocation;
475
491
                        if (loc != null)
476
 
                                IdeApp.Workbench.OpenDocument (loc.FileName, loc.Line, loc.Column, true);
 
492
                                IdeApp.Workbench.OpenDocument (loc.FileName, loc.Line, loc.Column);
477
493
                }
478
494
                
479
495
                [CommandUpdateHandler (TestCommands.ShowTestCode)]
520
536
                        failuresStore.Clear ();
521
537
                        outputView.Buffer.Clear ();
522
538
                        outIters.Clear ();
523
 
                        AddStartMessage ();
 
539
                        AddStartMessage (running);
524
540
                                
525
541
                        foreach (ResultRecord res in results) {
526
542
                                ShowTestResult (res.Test, res.Result);
541
557
                        if (result.IsFailure) {
542
558
                                if (!buttonFailures.Active)
543
559
                                        return;
544
 
                                TreeIter testRow = failuresStore.AppendValues (CircleImage.Failure, Escape (test.FullName), test);
 
560
                                string file = test.SourceCodeLocation != null ? test.SourceCodeLocation.FileName + ":" + test.SourceCodeLocation.Line : null;
 
561
                                TreeIter testRow = failuresStore.AppendValues (CircleImage.Failure, Escape (test.FullName), test, file);
545
562
                                bool hasMessage = result.Message != null && result.Message.Length > 0;
546
563
                                if (hasMessage)
547
564
                                        failuresStore.AppendValues (testRow, null, Escape (result.Message), test);