Skip to content

Commit

Permalink
MDL-78785 tool_brickfield: Review changes :void and @Covers
Browse files Browse the repository at this point in the history
  • Loading branch information
learningtechnologyservices committed Aug 5, 2024
1 parent 7bb645b commit 94cebad
Showing 1 changed file with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ class css_text_has_contrast_test extends all_checks {

/**
* Test for the area assign intro
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check(): void {
$results = $this->get_checker_results($this->htmlfail1);
Expand All @@ -254,6 +255,7 @@ public function test_check(): void {

/**
* Test with valid colour names.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_namedcolours(): void {
$results = $this->get_checker_results($this->namecolours);
Expand All @@ -262,6 +264,7 @@ public function test_check_for_namedcolours(): void {

/**
* Test with invalid colour names.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_invalidcolours(): void {
$results = $this->get_checker_results($this->invalidcolours);
Expand All @@ -270,6 +273,7 @@ public function test_check_for_invalidcolours(): void {

/**
* Test with invalid colour numeric values.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_invalidvalues(): void {
$results = $this->get_checker_results($this->invalidvalue);
Expand All @@ -278,6 +282,7 @@ public function test_check_for_invalidvalues(): void {

/**
* Test with empty colour values.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_emptyvalues(): void {
$results = $this->get_checker_results($this->emptyvalue);
Expand All @@ -286,6 +291,7 @@ public function test_check_for_emptyvalues(): void {

/**
* Test for text px18 with insufficient contrast of 4.49.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_px18_fail(): void {
$results = $this->get_checker_results($this->px18);
Expand All @@ -294,6 +300,7 @@ public function test_check_for_px18_fail(): void {

/**
* Test for text px19 bold with sufficient contrast of 4.49.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_px19bold_pass(): void {
$results = $this->get_checker_results($this->px19bold);
Expand All @@ -302,6 +309,7 @@ public function test_check_for_px19bold_pass(): void {

/**
* Test for text px18 with sufficient contrast of 4.81.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_px18_pass(): void {
$results = $this->get_checker_results($this->px18pass);
Expand All @@ -310,6 +318,7 @@ public function test_check_for_px18_pass(): void {

/**
* Test for medium (12pt) text with insufficient contrast of 4.49.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_medium_fail(): void {
$results = $this->get_checker_results($this->mediumfail);
Expand All @@ -318,6 +327,7 @@ public function test_check_for_medium_fail(): void {

/**
* Test for medium (12pt) text with sufficient contrast of 4.81.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_medium_pass(): void {
$results = $this->get_checker_results($this->mediumpass);
Expand All @@ -326,6 +336,7 @@ public function test_check_for_medium_pass(): void {

/**
* Test for larger (14pt) text with insufficient contrast of 2.94.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_larger_fail(): void {
$results = $this->get_checker_results($this->largerfail);
Expand All @@ -334,6 +345,7 @@ public function test_check_for_larger_fail(): void {

/**
* Test for larger (14pt) text with insufficient contrast of 3.02.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_larger_pass(): void {
$results = $this->get_checker_results($this->largerpass);
Expand All @@ -342,6 +354,7 @@ public function test_check_for_larger_pass(): void {

/**
* Test for larger (14pt) bold text with sufficient contrast of 3.02.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_check_for_largerbold_pass(): void {
$results = $this->get_checker_results($this->largerboldpass);
Expand All @@ -350,8 +363,9 @@ public function test_check_for_largerbold_pass(): void {

/**
* Test for rgb colors with insufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_bad_rgbcolor() {
public function test_bad_rgbcolor(): void {
$html = '<body><p style="color:rgb(255, 255, 255); background-color:rgb(204, 204, 204);">
This is not contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -360,8 +374,9 @@ public function test_bad_rgbcolor() {

/**
* Test for rgb colors with sufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_good_rgbcolor() {
public function test_good_rgbcolor(): void {
$html = '<body><p style="color:rgb(255, 255, 255); background-color:rgb(0, 0, 0);">
This is contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -370,8 +385,9 @@ public function test_good_rgbcolor() {

/**
* Test for named colors with insufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_bad_namedcolor2() {
public function test_bad_namedcolor2(): void {
$html = '<body><p style="color:lightcyan; background-color:lavender;">
This is not contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -380,8 +396,9 @@ public function test_bad_namedcolor2() {

/**
* Test for named colors with sufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_good_namedcolor2() {
public function test_good_namedcolor2(): void {
$html = '<body><p style="color:linen; background-color:darkslategray;">
This is contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -390,8 +407,9 @@ public function test_good_namedcolor2() {

/**
* Test for background value with insufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_bad_backgroundcss() {
public function test_bad_backgroundcss(): void {
$html = '<body><p style="color:lightcyan; background:fixed lavender center;">
This is not contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -400,8 +418,9 @@ public function test_bad_backgroundcss() {

/**
* Test for background value with sufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_good_backgroundcss() {
public function test_good_backgroundcss(): void {
$html = '<body><p style="color:linen; background:fixed darkslategray center;">
This is contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -410,8 +429,9 @@ public function test_good_backgroundcss() {

/**
* Test for background value with rgb with insufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_bad_backgroundcssrgb() {
public function test_bad_backgroundcssrgb(): void {
$html = '<body><p style="color:rgb(255, 255, 255); background:fixed rgb(204, 204, 204) center;">
This is not contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -420,8 +440,9 @@ public function test_bad_backgroundcssrgb() {

/**
* Test for background value with rgb with sufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_good_backgroundcssrgb() {
public function test_good_backgroundcssrgb(): void {
$html = '<body><p style="color:rgb(255, 255, 255); background:fixed rgb(0, 0, 0) center;">
This is contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -430,8 +451,9 @@ public function test_good_backgroundcssrgb() {

/**
* Test for text with insufficient contrast of 4.3.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_bad_contrastrounding() {
public function test_bad_contrastrounding(): void {
$html = '<body><p style="color:#F50000; background-color:white; font-size: 12px">
This is not contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -440,8 +462,9 @@ public function test_bad_contrastrounding() {

/**
* Test for background value with rgba with insufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_bad_backgroundcssrgba() {
public function test_bad_backgroundcssrgba(): void {
$html = '<body><p style="color:rgba(255, 255, 255, 0.5); background:fixed rgba(0, 204, 204, 0.5) center;">
This is not contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand All @@ -450,8 +473,9 @@ public function test_bad_backgroundcssrgba() {

/**
* Test for background value with rgba with sufficient contrast.
* @covers \tool_brickfield\local\htmlchecker\brickfield_accessibility\run_check()
*/
public function test_good_backgroundcssrgba() {
public function test_good_backgroundcssrgba(): void {
$html = '<body><p style="color:rgba(255, 255, 255, 0.75); background:fixed rgba(0, 0, 0, 0.75) center;">
This is contrasty enough.</p></body>';
$results = $this->get_checker_results($html);
Expand Down

0 comments on commit 94cebad

Please sign in to comment.