game->engine->gl()->isAvailable()) { self::markTestSkipped('No OpenGL here: the 3D battle is not drawn.'); } Hd::$legacy = true; } protected function tearDown(): void { parent::tearDown(); Hd::$legacy = false; } public function testOnAnEngineWithoutHdTheBattleUsesTheKeyColour(): void { $this->game->start(PlayScene::class, ['faction' => 'elves', 'countdown' => 999, 'gold' => 600]); self::assertTrue($this->game->peek('use3d')); self::assertTrue(Paint::$keyed, 'the 3D is shown through the key colour'); /** @var Battle $battle */ $battle = $this->game->peek('battle'); $battle->build(0, 'elf_archer'); $battle->spawnEnemy('grunt')->distance = 120; $this->game->run(40); $this->game->shot('legacy-battle'); self::assertTrue(Paint::$keyed); self::assertSame([0, 0, 0, 90], \App\Ui\World3d::veil([20, 26, 46, 90]), 'only black is translucent over the 3D'); } public function testOnAnEngineWithoutHdTheSideCardsStillShowTheirVignettes(): void { // their 3D layer is over the 2D ('above'): no alpha composing needed; the pixel font's texts leave their room $this->game->start(FactionSelectScene::class, ['faction' => 'dwarves']); $this->game->run(20); self::assertTrue($this->game->peek('use3d')); self::assertFalse(Paint::$keyed); $this->game->shot('legacy-sides'); } }