Mistral <00:11.20>gagnant'; self::assertSame('Mistral gagnant', Karaoke::plain($line)); [$syllables, $times] = Karaoke::timing($line, 10.0, 14.0); self::assertSame(['Mis', 'tral ', 'ga', 'gnant'], $syllables); self::assertSame(10.0, $times[0]); self::assertSame(11.2, $times[2], 'the word "gagnant" at its own moment'); } public function testAMenuNearTheRightEdgeOpensToTheLeftAndItsSubmenusToo(): void { $sub = [['label' => 'a'], ['label' => 'b']]; $items = [['label' => 'Zoom', 'sub' => $sub], ['label' => 'Quitter']]; $screen = [0.0, 0.0, 1000.0, 700.0]; $left = new \App\Gui\PopupMenu($items, 950, 100, 1000, 700, $screen); self::assertTrue($left->leftwards); self::assertEqualsWithDelta(950 - \App\Gui\PopupMenu::WIDTH, $left->x, 0.01, 'to the left of the pointer'); $left->hoverAt($left->x + 20, $left->y + 8, 1000, 700); self::assertNotNull($left->child); self::assertLessThan($left->x, $left->child->x, 'its submenu to the left too'); $right = new \App\Gui\PopupMenu($items, 30, 100, 1000, 700, $screen); self::assertFalse($right->leftwards); self::assertEqualsWithDelta(30, $right->x, 0.01, 'near the left edge: to the right'); $low = new \App\Gui\PopupMenu($items, 30, 690, 1000, 700, $screen); self::assertLessThanOrEqual(690, $low->y + $low->height(), 'near the bottom: upwards'); } }