Пример #1
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function bordercolorWithInvalidColor()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->bordercolor('grenish')->out('test-1920x1200.png')->getCommand();
 }
Пример #2
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return crop
  */
 public function rotateWithInvalidDegreeArgument()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->rotate('two')->out('test-200x200.png')->getCommand();
 }
Пример #3
0
 /**
  * Test
  *
  * @test
  *
  * @return void
  */
 public function validProgram()
 {
     $this->assertTrue(Karla::perform(PATH_TO_IMAGEMAGICK)->composite()->validProgram('composite'));
     $this->assertFalse(Karla::perform(PATH_TO_IMAGEMAGICK)->composite()->validProgram('git'));
 }
Пример #4
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function typeUnsupported()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->type('Christmas')->out('test-200x200.png')->getCommand();
 }
Пример #5
0
 /**
  * Test
  *
  * @test
  *
  * @return void
  */
 public function backgroundWithHexColor()
 {
     $actual = Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->background('#666666')->out('test-1920x1200.png')->getCommand();
     $expected = 'export PATH=$PATH:' . PATH_TO_IMAGEMAGICK . ';convert -background "#666666" "' . $this->testDataPath . '/demo.jpg" "./test-1920x1200.png"';
     $this->assertEquals($expected, $actual);
 }
Пример #6
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function getHashWithInvalidAlgorithm()
 {
     $this->object = Karla::perform(PATH_TO_IMAGEMAGICK)->identify()->in($this->testDataPath . '/demo.jpg')->execute(true, false);
     $this->object->getHash('sha');
 }
Пример #7
0
 /**
  * Test
  *
  * @test
  */
 public function setCache()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK, new \Karla\Cache\File($this->cacheDataPath))->convert()->in($this->testDataPath . '/demo.jpg')->crop(100, 100)->background('red')->out($this->testDataPath . '/cached.png')->execute();
     $this->assertTrue(file_exists($this->cacheDataPath . '/324dc866d046ff712607f3c4decf1559.png'));
 }
Пример #8
0
 /**
  * Test
  *
  * @test
  * @covers Karla\Program\Convert::resize
  *
  * @return void
  */
 public function resizeWithoutMaintainingAspectRatio()
 {
     $actual = Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->resize(200, 200, false)->out('test-200x200.png')->getCommand();
     $expected = 'export PATH=$PATH:' . PATH_TO_IMAGEMAGICK . ';convert -resize 200x200\\>! "' . $this->testDataPath . '/demo.jpg" "./test-200x200.png"';
     $this->assertEquals($expected, $actual);
 }
Пример #9
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function gravity()
 {
     $actual = Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->gravity('Nowhere')->out('test-1920x1200.png')->getCommand();
     $expected = 'export PATH=$PATH:' . PATH_TO_IMAGEMAGICK . ';convert "' . $this->testDataPath . '/demo.jpg" -density 72x72 "./test-1920x1200.png"';
     $this->assertEquals($expected, $actual);
 }
Пример #10
0
 /**
  * Test
  *
  * @test
  *
  * @return void
  */
 public function validProgram()
 {
     $this->assertTrue(Karla::perform(PATH_TO_IMAGEMAGICK)->identify()->validProgram('identify'));
     $this->assertFalse(Karla::perform(PATH_TO_IMAGEMAGICK)->identify()->validProgram('git'));
 }
Пример #11
0
 /**
  * Test
  *
  * @test
  * @expectedException RangeException
  *
  * @return void
  */
 public function qualityNotAValidQuality()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->quality(102)->out('test-200x200.png')->getCommand();
 }
Пример #12
0
 /**
  * @When /^I perform the identify action$/
  */
 public function iPerformTheIdentifyAction()
 {
     $this->output = Karla::perform(PATH_TO_IMAGEMAGICK)->identify()->in('tests/_data/demo.jpg')->execute();
 }
Пример #13
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return crop
  */
 public function callDensityWithInvalidOutputSelection()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->density(72, 72, 3)->out('test-200x200.png')->getCommand();
 }
Пример #14
0
 /**
  * Test
  *
  * @test
  *
  * @return void
  */
 public function composite()
 {
     $karla = Karla::perform(PATH_TO_IMAGEMAGICK);
     $this->assertInstanceOf('Karla\\Program\\Composite', $karla->composite());
 }
Пример #15
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function layersWithIvalidMethod()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->layers('christmas')->out('test-200x200.png')->getCommand();
 }
Пример #16
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function sepiaInvalidThresholdNumber()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->sepia(120)->out('test-200x200.png')->getCommand();
 }
Пример #17
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function polaroidToBigAngle()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->polaroid(400)->out('test-200x200.png')->getCommand();
 }
Пример #18
0
 /**
  * Test
  *
  * @return void
  * @todo not working
  */
 public function resampleWithOnlyOriginalWidth()
 {
     $actual = Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->resample(200, 200, 72)->out('test-200x200.png')->getCommand();
     $expected = 'export PATH=$PATH:' . PATH_TO_IMAGEMAGICK . ';convert -density 72x72 -resample \'200x200\' "' . $this->testDataPath . '/demo.jpg" "./test-200x200.png"';
     $this->assertEquals($expected, $actual);
 }
Пример #19
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return void
  */
 public function colorspaceInvalid()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->colorspace('brg')->out('test-200x200.png')->getCommand();
 }
Пример #20
0
 /**
  * Test
  *
  * @test
  * @expectedException InvalidArgumentException
  *
  * @return crop
  */
 public function cropWithInvalidYOffset()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->crop(100, 100, 0, 'chrismas')->out('test-200x200.png')->getCommand();
 }
Пример #21
0
 /**
  * Test
  *
  * @test
  * @expectedException BadMethodCallException
  *
  * @return void
  */
 public function stripTwice()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->strip()->strip()->out('test-200x200.png')->getCommand();
 }
Пример #22
0
 /**
  * Test
  *
  * @test
  * @expectedException LogicException
  *
  * @return crop
  */
 public function profileWithBothPathAndProfilenameAsArgument()
 {
     Karla::perform(PATH_TO_IMAGEMAGICK)->convert()->in($this->testDataPath . '/demo.jpg')->profile('tests/_data/sRGB_Color_Space_Profile.icm', 'sRGB.icc')->out('test-200x200.png')->getCommand();
 }