Esempio n. 1
0
 private function setCellMarginIfNecessary(Cell $cell, $marginType)
 {
     $margin = $cell->getAttribute($marginType);
     if ($margin > $this->marginsOfCells[$marginType]) {
         $this->marginsOfCells[$marginType] = $margin;
     }
 }
Esempio n. 2
0
 /**
  * @test
  * @dataProvider cellsInRowsMarginsProvider
  */
 public function setColumnsMarginsWhenTableHasBeenNotifiedByCell(array $cellsMarginsLeft, array $cellsMarginsRight)
 {
     $numberOfColumns = count($cellsMarginsLeft);
     $expectedMarginsLeft = $expectedMarginsRight = array_fill(0, $numberOfColumns, 0);
     foreach ($cellsMarginsLeft as $columnNumber => $marginsLeft) {
         foreach ($marginsLeft as $rowNumber => $marginLeft) {
             $marginRight = $cellsMarginsRight[$columnNumber][$rowNumber];
             $cell = new Cell(array('margin-left' => $marginLeft, 'margin-right' => $marginRight));
             $cell->setNumberOfColumn($columnNumber);
             $expectedMarginsLeft[$columnNumber] = max($expectedMarginsLeft[$columnNumber], $marginLeft);
             $expectedMarginsRight[$columnNumber] = max($expectedMarginsRight[$columnNumber], $marginRight);
             $cells[] = $cell;
         }
     }
     foreach ($cells as $cell) {
         $this->table->attributeChanged($cell, 'margin-left', 0);
         $this->table->attributeChanged($cell, 'margin-right', 0);
     }
     $this->assertEquals($expectedMarginsLeft, $this->table->getMarginsLeftOfColumns());
     $this->assertEquals($expectedMarginsRight, $this->table->getMarginsRightOfColumns());
 }