1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 18:14:26 +02:00

Fix for faulty srcset height value when using overrides and a default. Tests added.

This commit is contained in:
Cameron
2020-03-02 11:03:28 -08:00
parent 89f58fafa6
commit 6d0fb9e218
2 changed files with 49 additions and 10 deletions

View File

@@ -247,12 +247,9 @@ TMP;
{
}
public function testThumbSrcSet()
{
}
*/
public function testToDB()
{
@@ -787,13 +784,49 @@ TMP;
//var_dump($result);
}
}
/*
public function testToImage()
{
$src = "{e_PLUGIN}gallery/images/butterfly.jpg";
$this->tp->setThumbSize(80,80); // set defaults.
// test with defaults set above.
$result = $this->tp->toImage($src);
$this->assertStringContainsString('butterfly.jpg&w=80&h=80', $result); // src
$this->assertStringContainsString('butterfly.jpg&w=320&h=320', $result); // srcset 4x the size on small images.
// test overriding of defaults.
$override = array('w'=>800, 'h'=>0);
$result2 = $this->tp->toImage($src, $override);
$this->assertStringContainsString('butterfly.jpg&w=800&h=0', $result2); // src
$this->assertStringContainsString('Fbutterfly.jpg&w=1600&h=0', $result2); // srcset
$override = array('w'=>0, 'h'=>0); // display image without resizing
$result3 = $this->tp->toImage($src, $override);
$this->assertStringContainsString('Fbutterfly.jpg&w=0&h=0', $result3); // src
}
public function testThumbSrcSet()
{
$src = "{e_PLUGIN}gallery/images/butterfly.jpg";
$parms = array('w'=>800, 'h'=>0, 'size'=>'2x');
$result = $this->tp->thumbSrcSet($src, $parms);
$this->assertStringContainsString('butterfly.jpg&w=1600&h=0', $result);
$this->tp->setThumbSize(80,80); // set defaults.
$result2 = $this->tp->thumbSrcSet($src, $parms); // testing overrides
$this->assertStringContainsString('butterfly.jpg&w=1600&h=0', $result2);
$result3 = $this->tp->thumbSrcSet($src, array('w'=>800, 'size'=>'2x')); // testing overrides without 'h' being set.
$this->assertStringContainsString('butterfly.jpg&w=1600&h=0', $result3);
$result4 = $this->tp->thumbSrcSet($src); // no overrides
$this->assertStringContainsString('butterfly.jpg&w=160&h=160', $result4);
}
*/
public function testIsBBcode()
{