コード例 #1
0
ファイル: ModeTest.php プロジェクト: LordOfTheRats/php_xrandr
 /**
  * @covers \Xrandr\Mode::getProbableResolution
  * @covers \Xrandr\Mode::__construct
  * @afterClass \Xrandr\Geometry
  */
 public function testGetProbableResolution()
 {
     $object = new Mode("1366x768", "", false, false);
     $expectedObject = Geometry::parseString("1366x768");
     $this->assertEquals($expectedObject, $object->getProbableResolution());
     $object = new Mode("800x600_60.00", "", false, false);
     $expectedObject = Geometry::parseString("800x600");
     $this->assertEquals($expectedObject, $object->getProbableResolution());
 }
コード例 #2
0
 /**
  * @covers \Xrandr\Geometry::parseString
  * @covers \Xrandr\Geometry::__construct
  */
 public function testParseString()
 {
     $object = Geometry::parseString("1360x768+200+50");
     $this->assertAttributeEquals(1360, "width", $object);
     $this->assertAttributeEquals(768, "height", $object);
     $this->assertAttributeEquals(200, "x", $object);
     $this->assertAttributeEquals(50, "y", $object);
     $object = Geometry::parseString("1360x768-200-50");
     $this->assertAttributeEquals(1360, "width", $object);
     $this->assertAttributeEquals(768, "height", $object);
     $this->assertAttributeEquals(-200, "x", $object);
     $this->assertAttributeEquals(-50, "y", $object);
     $object = Geometry::parseString("1360x768");
     $this->assertAttributeEquals(1360, "width", $object);
     $this->assertAttributeEquals(768, "height", $object);
     $this->assertAttributeEquals(0, "x", $object);
     $this->assertAttributeEquals(0, "y", $object);
     $object = Geometry::parseString("+200-50");
     $this->assertAttributeEquals(0, "width", $object);
     $this->assertAttributeEquals(0, "height", $object);
     $this->assertAttributeEquals(200, "x", $object);
     $this->assertAttributeEquals(-50, "y", $object);
     $object = Geometry::parseString("200-50");
     $this->assertAttributeEquals(0, "width", $object);
     $this->assertAttributeEquals(0, "height", $object);
     $this->assertAttributeEquals(200, "x", $object);
     $this->assertAttributeEquals(-50, "y", $object);
     $object = Geometry::parseString("-200+50");
     $this->assertAttributeEquals(0, "width", $object);
     $this->assertAttributeEquals(0, "height", $object);
     $this->assertAttributeEquals(-200, "x", $object);
     $this->assertAttributeEquals(50, "y", $object);
     $object = Geometry::parseString("200y50");
     $this->assertNull($object);
 }