Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,19 @@ public async Task DialogBackgroundShouldInheritThemeBackground(BaseTheme dialogT
await Wait.For(async () =>
{
Color? foreground1 = await textBlock1.GetForegroundColor();
await Assert.That(foreground1).IsNotNull();
Color foreground1Value = await Assert.That(foreground1).IsNotNull();
await AssertContrastRatio(
foreground1.Value,
foreground1Value,
await textBlock1.GetEffectiveBackground(),
MinimumContrastSmallText);
});

await Wait.For(async () =>
{
Color? foreground2 = await textBlock2.GetForegroundColor();
await Assert.That(foreground2).IsNotNull();
Color foreground2Value = await Assert.That(foreground2).IsNotNull();
await AssertContrastRatio(
foreground2.Value,
foreground2Value,
await textBlock2.GetEffectiveBackground(),
MinimumContrastSmallText);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public async Task OnLoad_ThemeBrushesSet()
Color? selectedTabUnderline = await selectedTabBorder.GetBorderBrushColor();

//Assert
await Assert.That(foreground).IsNotNull();
await Assert.That(background).IsNotNull();
Color foregroundValue = await Assert.That(foreground).IsNotNull();
Color backgroundValue = await Assert.That(background).IsNotNull();

await MaterialDesignSpec.AssertContrastRatio(foreground.Value, background.Value, MaterialDesignSpec.MinimumContrastSmallText);
await MaterialDesignSpec.AssertContrastRatio(foregroundValue, backgroundValue, MaterialDesignSpec.MinimumContrastSmallText);

await Assert.That(selectedTabUnderline).IsEqualTo(foreground);
await Assert.That(selectedTabUnderline).IsEqualTo(foregroundValue);

recorder.Success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ async Task AssertContrastRatio()

Color? smallTextForeground = await smallText.GetForegroundColor();
Color smallTextBackground = await smallText.GetEffectiveBackground();
Color largeTextForegroundValue = await Assert.That(largeTextForeground).IsNotNull();
Color smallTextForegroundValue = await Assert.That(smallTextForeground).IsNotNull();

double largeContrastRatio = ColorAssist.ContrastRatio(largeTextForeground.Value, largeTextBackground);
double largeContrastRatio = ColorAssist.ContrastRatio(largeTextForegroundValue, largeTextBackground);
await Assert.That(largeContrastRatio).IsGreaterThanOrEqualTo(MaterialDesignSpec.MinimumContrastLargeText - tolerance)
.Because($"Large font contrast ratio '{largeContrastRatio}' does not meet material design spec {MaterialDesignSpec.MinimumContrastLargeText}");
double smallContrastRatio = ColorAssist.ContrastRatio(smallTextForeground.Value, smallTextBackground);
double smallContrastRatio = ColorAssist.ContrastRatio(smallTextForegroundValue, smallTextBackground);
await Assert.That(smallContrastRatio).IsGreaterThanOrEqualTo(MaterialDesignSpec.MinimumContrastSmallText - tolerance).Because($"Small font contrast ratio '{smallContrastRatio}' does not meet material design spec {MaterialDesignSpec.MinimumContrastSmallText}");
}
}
Expand Down
Loading