contrastTest function

  1. @isTest
void contrastTest(
  1. dynamic description,
  2. Color backgroundColor,
  3. Color foregroundColor, {
  4. ReadabilityLevel readabilityLevel = ReadabilityLevel.normal,
  5. dynamic tags,
})

Creates a new contrast test case with the given description.

Checks if given backgroundColor and foregroundColor meet minimum contrast ratio value for given readabilityLevel.

Example error message:

1.0:1 contrast ratio of Color(0xffffffff) and Color(0xffffffff)
does not meet minimum acceptable contrast ratio
for ReadabilityLevel.normal, which is 4.5:1.

If tags is passed, it declares user-defined tags that are applied to the test. These tags can be used to select or skip the test on the command line, or to do bulk test configuration. All tags should be declared in the package configuration file. The parameter can be an Iterable of tag names, or a String representing a single tag.

Implementation

@isTest
void contrastTest(
  dynamic description,
  Color backgroundColor,
  Color foregroundColor, {
  ReadabilityLevel readabilityLevel = ReadabilityLevel.normal,
  dynamic tags,
}) {
  test.test(
    description,
    () => runContrastTest(backgroundColor, foregroundColor,
        readabilityLevel: readabilityLevel),
    tags: tags,
  );
}