Esempio n. 1
0
 function testClone2()
 {
     $a = new QColor(100, 200, 255);
     $b = clone $a;
     // create the reference
     echo "\ntesting clone";
     $b->setRed(75);
     $this->assertEquals($a->red(), 100, "Cloning an object does not work (error: original has changed)!");
     echo " passed (check original)";
 }
Esempio n. 2
0
 /**
  * copy an object using the copy constructor and check with them changing 
  * values of the original and the copy
  */
 function testCopyConstructor()
 {
     echo "testing copy constructor ";
     $color_a = new QColor(5, 3, 7);
     $color_b = new QColor($color_a);
     $this->assertEquals(7, $color_a->blue());
     $this->assertEquals(7, $color_b->blue());
     echo "passed\n";
     echo "testing changing the value at the copy ";
     $color_b->setBlue(24);
     $this->assertEquals(7, $color_a->blue());
     $this->assertEquals(24, $color_b->blue());
     echo "passed\n";
     echo "testing destroying the original ";
     $color_a->__destruct();
     unset($color_a);
     $this->assertEquals(24, $color_b->blue());
     echo "passed\n";
 }
Esempio n. 3
0
 function testObjectLifeCycle()
 {
     echo "testing deletion of object ";
     $color_a = new QColor(1, 3, 5);
     $color_a->__destruct();
     unset($color_a);
     $this->assertFalse(isset($color_a), "Object wasn't deleted properly\n");
     echo "passed\n";
     echo "testing returning a Stack item, checking values ";
     $widget_a = new QWidget();
     $widget_a->resize(24, 28);
     $size_a = $widget_a->size();
     $this->assertEquals($size_a->width(), $widget_a->width(), "return value of QWidget::size() is not correct\n");
     echo "passed\n";
     echo "testing returning a Stack item, changing values ";
     $widget_a->resize(26, 30);
     $size_b = $widget_a->size();
     $this->assertEquals($size_b->width(), 26, "");
     $this->assertEquals($size_a->width(), 24, "");
     //			$this->assertEquals( $widget_a->size(), $size_b->width() );
 }