Skip to content

Commit

Permalink
Theming: Fix tests for favicon containing multiple sizes
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Sep 23, 2017
1 parent 4fa99a7 commit 4c5b87b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions apps/theming/lib/IconBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public function __construct(
* @return string|false image blob
*/
public function getFavicon($app) {
if (!$this->themingDefaults->shouldReplaceIcons()) {
return false;
}
try {
$favicon = new Imagick();
$favicon->setFormat("ico");
Expand Down
9 changes: 6 additions & 3 deletions apps/theming/tests/IconBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,15 @@ public function testGetFavicon($app, $color, $file) {
->willReturn($color);

$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
$actualIcon = $this->iconBuilder->getFavicon($app);

$icon = new \Imagick();
$icon->readImageBlob($this->iconBuilder->getFavicon($app));
$icon->setFormat('ico');
$icon->readImageBlob($actualIcon);

$this->assertEquals(true, $icon->valid());
$this->assertEquals(32, $icon->getImageWidth());
$this->assertEquals(32, $icon->getImageHeight());
$this->assertEquals(128, $icon->getImageWidth());
$this->assertEquals(128, $icon->getImageHeight());
$icon->destroy();
$expectedIcon->destroy();
// FIXME: We may need some comparison of the generated and the test images
Expand Down

0 comments on commit 4c5b87b

Please sign in to comment.