/** * @param RelationCell $cell * @param int $row * @param int $col */ private function renderCell(RelationCell $cell, $row, $col) { $x = $this->getModuleCoordinate($col); $y = $this->getModuleCoordinate($row); $xc = $x + $this->getModuleSize() / 2; $yc = $y + $this->getModuleSize() / 2; if ($cell->isDark()) { $this->renderDarkCell($cell, $x, $y, $xc, $yc); } else { $this->renderLightCell($cell, $x, $y, $xc, $yc); } }
/** * @param int $l1 * @param int $l2 * @param int $l3 * @param int $l4 * @param int $l5 * @param int $l6 * @param int $l7 * @param int $l8 * @param int $l9 * @dataProvider combinationDataProvider */ public function testRelationCellValues($l1, $l2, $l3, $l4, $l5, $l6, $l7, $l8, $l9) { $relationCell = new RelationCell($l7, $l8, $l9, $l4, $l5, $l6, $l1, $l2, $l3); $expectedNeighborCount = $l2 + $l4 + $l6 + $l8; $expectedSurroundCount = $l1 + $l2 + $l3 + $l4 + $l6 + $l7 + $l8 + $l9; $this->assertEquals($l1, $relationCell->bottomLeft()); $this->assertEquals($l2, $relationCell->bottom()); $this->assertEquals($l3, $relationCell->bottomRight()); $this->assertEquals($l4, $relationCell->left()); $this->assertEquals($l5, $relationCell->isDark()); $this->assertEquals($l6, $relationCell->right()); $this->assertEquals($l7, $relationCell->topLeft()); $this->assertEquals($l8, $relationCell->top()); $this->assertEquals($l9, $relationCell->topRight()); $this->assertEquals($l1 || $l2 || $l4, $relationCell->anyBottomLeft()); $this->assertEquals($l2 || $l3 || $l6, $relationCell->anyBottomRight()); $this->assertEquals($l4 || $l7 || $l8, $relationCell->anyTopLeft()); $this->assertEquals($l8 || $l9 || $l6, $relationCell->anyTopRight()); $this->assertEquals($expectedNeighborCount, $relationCell->neighbourCount()); $this->assertEquals($expectedSurroundCount, $relationCell->surroundCount()); }