Skip to content

Commit 3c87985

Browse files
committed
Test locally first
1 parent ca28e5e commit 3c87985

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

webapp/src/Twig/TwigExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,12 @@ public function fileTypeIcon(string $type): string
11571157

11581158
public function problemBadge(ContestProblem $problem, bool $grayedOut = false): string
11591159
{
1160+
dump(Utils::hexToForegroundAndBorder("#fffDDD"));
1161+
dump(Utils::hexToForegroundAndBorder("#000000"));
1162+
dump(Utils::hexToForegroundAndBorder("#ABC"));
1163+
dump(Utils::hexToForegroundAndBorder("#1239"));
1164+
dump(Utils::hexToForegroundAndBorder("#10203040"));
1165+
11601166
$rgb = Utils::convertToHex($problem->getColor() ?? '#ffffff');
11611167
if ($grayedOut || empty($rgb)) {
11621168
$rgb = Utils::convertToHex('whitesmoke');

webapp/tests/Unit/Utils/UtilsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public function testRelativeLuminance(): void
363363
public function testApcaContrast(): void
364364
{
365365
self::assertEquals(0.0, Utils::apcaContrast("#ffffff", "#000000"));
366-
self::assertEquals(0.0, Utils::apcaContrast("#000000", "#ffffff"));
366+
self::assertEquals(-114.0, Utils::apcaContrast("#000000", "#ffffff"));
367367
self::assertEquals(0.0, Utils::apcaContrast("#fffFFF", "#FFFfff"));
368368
self::assertEquals(0.0, Utils::apcaContrast("#111", "#111"));
369369
self::assertEquals(0.0, Utils::apcaContrast("#123f", "#975A"));
@@ -373,11 +373,11 @@ public function testApcaContrast(): void
373373

374374
public function testHexToForegroundAndBorder(): void
375375
{
376-
self::assertEquals(["#bfbd9dff", "#bfbd9dff"], Utils::hexToForegroundAndBorder("#fffDDD"));
376+
self::assertEquals(["#000000", "#bfbd9dff"], Utils::hexToForegroundAndBorder("#fffDDD"));
377377
self::assertEquals(["#ffffff", "#000000ff"], Utils::hexToForegroundAndBorder("#000000"));
378-
self::assertEquals(["#ffffff", "#000000ff"], Utils::hexToForegroundAndBorder("#ABC"));
378+
self::assertEquals(["#000000", "#6a7b8cff"], Utils::hexToForegroundAndBorder("#ABC"));
379379
self::assertEquals(["#ffffff", "#00000099"], Utils::hexToForegroundAndBorder("#1239"));
380-
self::assertEquals(["#ffffff", "#0000ff40"], Utils::hexToForegroundAndBorder("#10203040"));
380+
self::assertEquals(["#000000", "#00000040"], Utils::hexToForegroundAndBorder("#10203040"));
381381
}
382382

383383
/**

0 commit comments

Comments
 (0)