startPlayer(); $names = array_map(fn ($s) => basename($s->dir), $this->wz->skins()); foreach (['aurore', 'corail', 'menthe', 'ambre', 'sakura'] as $skin) { self::assertContains($skin, $names); } self::assertSame('givre', basename($this->wz->skin->dir), 'Givre stays the default skin'); } public function testTheLinesChosenInThePlayListReadOnEverySkin(): void { $this->startPlayer(); $skins = array_values(array_filter($this->wz->skins(), fn ($s) => str_contains(str_replace('\\', '/', $s->dir), '/assets/skins/'))); self::assertGreaterThanOrEqual(16, count($skins)); $rgb = fn (string $h): array => [(int)hexdec(substr($h, 1, 2)), (int)hexdec(substr($h, 3, 2)), (int)hexdec(substr($h, 5, 2))]; $changed = []; foreach ($skins as $skin) { $name = basename($skin->dir); foreach ([50, 70] as $veil) { $bg = PlaylistWindow::veiled($skin, $veil); $colors = array_merge(array_map(fn (int $row) => $skin->lineColor($row), range(0, 22)), [$skin->colors['active']]); foreach ($colors as $color) { $ink = PlaylistWindow::inkOnVeil($skin, $color, $veil); self::assertGreaterThanOrEqual(PlaylistWindow::MIN_CONTRAST, PlaylistWindow::contrast($rgb($ink), $bg), "$name: $color under the veil $veil (" . implode(',', $bg) . ") gives $ink"); if ($ink !== $color) { $changed[$name] = true; } } } } // the skins of the review (contrast 3.0 to 4.1 with their own colours): their chosen lines are drawn in another ink foreach (['base', 'chaine-hifi', 'the-skin', 'win48', 'bois-laiton'] as $name) { self::assertArrayHasKey($name, $changed, $name); } } /** * Every skin photographed with its player open, the equalizer, the play list (a song playing, a line chosen, a * button held down), then in compact mode with the lyrics bar: var/screenshots/tests/skin-[-compact].png. */ public function testEverySkinShowsThePlayerTheEqualizerAndThePlayList(): void { $this->startPlayer(); // the skins of the application (not those a test of the skin editor left in var/skins) $skins = array_values(array_filter($this->wz->skins(), fn ($s) => str_contains(str_replace('\\', '/', $s->dir), '/assets/skins/'))); self::assertGreaterThanOrEqual(16, count($skins)); foreach ($skins as $skin) { $name = basename($skin->dir); self::assertTrue($this->wz->useSkin('assets/skins/' . $name), $name); $ui = &$this->wz->ui; $ui['compact']['active'] = false; $ui['main']['expanded'] = true; $ui['eq']['visible'] = true; $ui['lyrics']['visible'] = true; $this->wz->playlist->active = 0; $this->wz->play(); $main = $list = null; foreach ($this->desk->windows() as $window) { $main = $window instanceof MainWindow ? $window : $main; $list = $window instanceof PlaylistWindow ? $window : $list; } self::assertNotNull($main, $name); self::assertNotNull($list, $name); $list->selection = [2 => true]; $this->game->wait(1.5); [$x, $y] = $main->controls()['stop']; $main->press($x + 2, $y + 2, new Pointer()); $this->game->run(1); $this->game->shot('skin-' . $name); $main->cancelPress(); $list->selection = []; $ui['compact']['active'] = true; $this->game->wait(0.5); $this->game->shot('skin-' . $name . '-compact'); $ui['compact']['active'] = false; unset($ui); } $this->wz->stop(); self::assertTrue($this->wz->useSkin('assets/skins/givre')); } }