diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-08 01:05:24 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-03-08 09:51:03 +0100 |
commit | c8d7a5acaabb5c2f8bae1ccb70ce9c76cfd86c5c (patch) | |
tree | c03f1e5331a6133b879775857c19c9bfd47ee5bd /tests | |
parent | b6691b35c7be946f038a6c8c6d221e64c60788f4 (diff) | |
download | nextcloud-server-c8d7a5acaabb5c2f8bae1ccb70ce9c76cfd86c5c.tar.gz nextcloud-server-c8d7a5acaabb5c2f8bae1ccb70ce9c76cfd86c5c.zip |
fix(AppManager): Allow to query dark **or** bright icon
The navigation needs the bright icon, while the notifications and activity need a dark icon.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/App/AppManagerTest.php | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index 09a64f84469..dfbaedff957 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -135,12 +135,16 @@ class AppManagerTest extends TestCase { /** * @dataProvider dataGetAppIcon */ - public function testGetAppIcon($callback, string|null $expected) { + public function testGetAppIcon($callback, ?bool $dark, string|null $expected) { $this->urlGenerator->expects($this->atLeastOnce()) ->method('imagePath') ->willReturnCallback($callback); - $this->assertEquals($expected, $this->manager->getAppIcon('test')); + if ($dark !== null) { + $this->assertEquals($expected, $this->manager->getAppIcon('test', $dark)); + } else { + $this->assertEquals($expected, $this->manager->getAppIcon('test')); + } } public function dataGetAppIcon(): array { @@ -162,36 +166,59 @@ class AppManagerTest extends TestCase { return [ 'does not find anything' => [ $nothing, + false, + null, + ], + 'nothing if request dark but only bright available' => [ + $createCallback(['app.svg']), + true, null, ], - 'only app.svg' => [ + 'nothing if request bright but only dark available' => [ + $createCallback(['app-dark.svg']), + false, + null, + ], + 'bright and only app.svg' => [ $createCallback(['app.svg']), + false, '/path/app.svg', ], - 'only app-dark.svg' => [ + 'dark and only app-dark.svg' => [ $createCallback(['app-dark.svg']), + true, '/path/app-dark.svg', ], - 'only appname -dark.svg' => [ + 'dark only appname -dark.svg' => [ $createCallback(['test-dark.svg']), + true, '/path/test-dark.svg', ], - 'only appname.svg' => [ + 'bright and only appname.svg' => [ $createCallback(['test.svg']), + false, '/path/test.svg', ], 'priotize custom over default' => [ $createCallback(['app.svg', 'test.svg']), + false, '/path/test.svg', ], - 'priotize default over dark' => [ - $createCallback(['test-dark.svg', 'app-dark.svg', 'app.svg']), - '/path/app.svg', + 'defaults to bright' => [ + $createCallback(['test-dark.svg', 'test.svg']), + null, + '/path/test.svg', ], - 'priotize custom over default' => [ - $createCallback(['test.svg', 'test-dark.svg', 'app-dark.svg']), + 'no dark icon on default' => [ + $createCallback(['test-dark.svg', 'test.svg', 'app-dark.svg', 'app.svg']), + false, '/path/test.svg', ], + 'no bright icon on dark' => [ + $createCallback(['test-dark.svg', 'test.svg', 'app-dark.svg', 'app.svg']), + true, + '/path/test-dark.svg', + ], ]; } |