Ejemplo n.º 1
0
 /**
  * @test
  */
 public function childrenWithRelativeWidthWillBePropelyHorizontallyResized()
 {
     $width = 100;
     $horizontalResize = 50;
     for ($i = 0; $i < 2; $i++) {
         $child = new Container();
         $child->setWidth(50);
         $child->setRelativeWidth('50%');
         $boundary = $this->objectMother->getBoundaryStub(50 * $i, 50, 50, 50);
         $this->invokeMethod($child, 'setBoundary', array($boundary));
         $this->node->add($child);
     }
     $boundary = $this->objectMother->getBoundaryStub(0, 50, $width, 50);
     $this->invokeMethod($this->node, 'setBoundary', array($boundary));
     $this->node->resize($horizontalResize, 0);
     $children = $this->node->getChildren();
     $expectedWidth = ($width + $horizontalResize) / 2;
     foreach ($children as $child) {
         $realWidth = $child->getDiagonalPoint()->getX() - $child->getFirstPoint()->getX();
         $this->assertEquals($expectedWidth, $realWidth);
     }
 }