Skip to content

Commit 0ff7572

Browse files
committed
Address review comments, add easter egg.
1 parent de2bdc6 commit 0ff7572

File tree

11 files changed

+65
-60
lines changed

11 files changed

+65
-60
lines changed

Rubberduck.Core/UI/GridViewSort.cs

Lines changed: 0 additions & 40 deletions
This file was deleted.

Rubberduck.Core/UI/UnitTesting/TestExplorerControl.xaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@
436436
<converters:NonZeroToVisibilityConverter x:Key="NonZeroToVisibility"/>
437437
<BitmapImage x:Key="IgnoredTestImage" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/minus-white.png" />
438438
<BitmapImage x:Key="InconclusiveTestImage" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/exclamation.png" />
439+
<BitmapImage x:Key="EasterEggTestImage" UriSource="pack://application:,,,/Rubberduck.Resources;component/Icons/Fugue/skull-mad.png" />
439440
<Style x:Key="ResultsTestOutcomeStyle" TargetType="TextBlock" >
440441
<Setter Property="Margin" Value="4,0,12,0"/>
441442
<Setter Property="TextWrapping" Value="WrapWithOverflow"/>
@@ -451,6 +452,13 @@
451452
<TextBlock Margin="2" Padding="4,2,4,2" FontWeight="Bold" VerticalAlignment="Center"
452453
Text="{Resx ResxName=Rubberduck.Resources.UnitTesting.TestExplorer, Key=TestOutcome_SummaryCaption}"/>
453454
<TextBlock Style="{StaticResource ResultsTestOutcomeStyle}" Text="{Binding Model.LastTestRunSummary, Mode=OneWay}"/>
455+
<StackPanel Orientation="Horizontal" Visibility="{Binding Model.LastTestSpectacularFailCount, Mode=OneWay, Converter={StaticResource NonZeroToVisibility}}" >
456+
<Image Style="{StaticResource TestOutcomeIconStyle}" Source="{StaticResource EasterEggTestImage}" Margin="4,0,4,0"/>
457+
<TextBlock Style="{StaticResource ResultsTestOutcomeStyle}">
458+
<Run Text="{Binding Model.LastTestSpectacularFailCount, Mode=OneWay}"/>
459+
<Run Text="{Resx ResxName=Rubberduck.Resources.UnitTesting.TestExplorer, Key=TestOutcome_SpectacularFail}"/>
460+
</TextBlock>
461+
</StackPanel>
454462
<StackPanel Orientation="Horizontal" Visibility="{Binding Model.LastTestFailedCount, Mode=OneWay, Converter={StaticResource NonZeroToVisibility}}" >
455463
<Image Style="{StaticResource TestOutcomeIconStyle}" Source="{StaticResource RunFailedTestsImage}" Margin="4,0,4,0"/>
456464
<TextBlock Style="{StaticResource ResultsTestOutcomeStyle}">

Rubberduck.Core/UI/UnitTesting/TestExplorerModel.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public bool IsRefreshing
100100
public string LastTestRunSummary =>
101101
string.Format(Resources.UnitTesting.TestExplorer.TestOutcome_RunSummaryFormat, CurrentRunTestCount, Tests.Count, TimeSpan.FromMilliseconds(TotalDuration));
102102

103+
public int LastTestSpectacularFailCount => Tests.Count(test => test.Result.Outcome == TestOutcome.SpectacularFail && _testEngine.LastRunTests.Contains(test.Method));
104+
103105
public int LastTestFailedCount => Tests.Count(test => test.Result.Outcome == TestOutcome.Failed && _testEngine.LastRunTests.Contains(test.Method));
104106

105107
public int LastTestInconclusiveCount => Tests.Count(test => test.Result.Outcome == TestOutcome.Inconclusive && _testEngine.LastRunTests.Contains(test.Method));
@@ -179,6 +181,7 @@ private void HandleRunCompletion(object sender, TestRunCompletedEventArgs e)
179181
IsBusy = false;
180182

181183
OnPropertyChanged(nameof(LastTestRunSummary));
184+
OnPropertyChanged(nameof(LastTestSpectacularFailCount));
182185
OnPropertyChanged(nameof(LastTestFailedCount));
183186
OnPropertyChanged(nameof(LastTestIgnoredCount));
184187
OnPropertyChanged(nameof(LastTestInconclusiveCount));
@@ -242,15 +245,16 @@ private void OnTestCompleted(TestCompletedEventArgs args)
242245
{ TestOutcome.Succeeded, Colors.LimeGreen },
243246
{ TestOutcome.Inconclusive, Colors.Gold },
244247
{ TestOutcome.Ignored, Colors.Orange },
245-
{ TestOutcome.Failed, Colors.Red }
248+
{ TestOutcome.Failed, Colors.Red },
249+
{ TestOutcome.SpectacularFail, Colors.Black }
246250
};
247251

248-
private TestOutcome _bestOutcome = TestOutcome.Unknown;
252+
private TestOutcome _worstOutcome = TestOutcome.Unknown;
249253
private void UpdateProgressBar(TestOutcome output, bool reset = false)
250254
{
251255
if (reset)
252256
{
253-
_bestOutcome = TestOutcome.Unknown;
257+
_worstOutcome = TestOutcome.Unknown;
254258
ExecutedCount = 0;
255259
CurrentRunTestCount = 0;
256260
ProgressBarColor = OutcomeColors[TestOutcome.Unknown];
@@ -259,12 +263,12 @@ private void UpdateProgressBar(TestOutcome output, bool reset = false)
259263

260264
ExecutedCount++;
261265

262-
if (_bestOutcome != TestOutcome.Unknown && output >= _bestOutcome)
266+
if (_worstOutcome != TestOutcome.Unknown && output >= _worstOutcome)
263267
{
264268
return;
265269
}
266270

267-
_bestOutcome = output;
271+
_worstOutcome = output;
268272
ProgressBarColor = OutcomeColors[output];
269273
}
270274

Rubberduck.Core/UI/UnitTesting/TestOutcomeImageSourceConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public class TestOutcomeImageSourceConverter : ImageSourceConverter, IMultiValue
2222
{ TestOutcome.Succeeded, ToImageSource(RubberduckUI.tick_circle) },
2323
{ TestOutcome.Failed, ToImageSource(RubberduckUI.cross_circle) },
2424
{ TestOutcome.Inconclusive, ToImageSource(RubberduckUI.exclamation) },
25-
{ TestOutcome.Ignored, ToImageSource(RubberduckUI.minus_white) }
25+
{ TestOutcome.Ignored, ToImageSource(RubberduckUI.minus_white) },
26+
{ TestOutcome.SpectacularFail, ToImageSource(RubberduckUI.skull_mad) }
2627
};
2728

2829
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1.58 KB
Loading

Rubberduck.Resources/RubberduckUI.Designer.cs

Lines changed: 24 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Resources/RubberduckUI.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,4 +1523,7 @@ NOTE: Restart is required for the setting to take effect.</value>
15231523
<data name="hourglass" type="System.Resources.ResXFileRef, System.Windows.Forms">
15241524
<value>Icons\Fugue\hourglass.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
15251525
</data>
1526+
<data name="skull_mad" type="System.Resources.ResXFileRef, System.Windows.Forms">
1527+
<value>Icons\Fugue\skull-mad.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
1528+
</data>
15261529
</root>

Rubberduck.Resources/UnitTesting/TestExplorer.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Resources/UnitTesting/TestExplorer.resx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,4 +339,8 @@
339339
<data name="TestOutcome_SummaryCaption" xml:space="preserve">
340340
<value>Summary:</value>
341341
</data>
342+
<data name="TestOutcome_SpectacularFail" xml:space="preserve">
343+
<value>Spectactular Failure</value>
344+
<comment>Easter egg status.</comment>
345+
</data>
342346
</root>

Rubberduck.UnitTesting/UnitTesting/TestEngine.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@ private TestResult EvaluateResults(IEnumerable<AssertCompletedEventArgs> assertR
362362
var result = new AssertCompletedEventArgs(TestOutcome.Succeeded);
363363
var asserted = assertResults.ToList();
364364

365+
if (asserted.Count(assert => assert.Outcome == TestOutcome.Failed) >= 10)
366+
{
367+
return new TestResult(TestOutcome.SpectacularFail, result.Message, duration);
368+
}
369+
365370
if (asserted.Any(assertion => assertion.Outcome != TestOutcome.Succeeded))
366371
{
367372
result = asserted.First(assertion => assertion.Outcome != TestOutcome.Succeeded);

0 commit comments

Comments
 (0)