PHP Classes

File: tests/Support/Algorithms/LuminosityContrastRatioTest.php

Recommend this page to a friend!
  Classes of tomloprod   Colority   tests/Support/Algorithms/LuminosityContrastRatioTest.php   Download  
File: tests/Support/Algorithms/LuminosityContrastRatioTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Colority
Perform color transformation operations
Author: By
Last change:
Date: 7 months ago
Size: 983 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

use
Tomloprod\Colority\Support\Algorithms\LuminosityContrastRatio;

test('getContrastRatio white and black', function (): void {
   
$lumContrastRatio = new LuminosityContrastRatio();

   
/** @var float $contrastRatio */
   
$contrastRatio = $lumContrastRatio->getContrastRatio([255, 255, 255], [0, 0, 0]);

   
expect($contrastRatio)->toBeGreaterThanOrEqual(7);
});

test('getContrastRatio white and white', function (): void {
   
$lumContrastRatio = new LuminosityContrastRatio();

   
/** @var float $contrastRatio */
   
$contrastRatio = $lumContrastRatio->getContrastRatio([255, 255, 255], [255, 255, 255]);

   
expect($contrastRatio)->toBeLessThan(3);
});

test('getContrastRatio black and black', function (): void {
   
$lumContrastRatio = new LuminosityContrastRatio();

   
/** @var float $contrastRatio */
   
$contrastRatio = $lumContrastRatio->getContrastRatio([0, 0, 0], [0, 0, 0]);

   
expect($contrastRatio)->toBeLessThan(3);
});