Share icon packs between desktop and Android
The Android app's Material icons become a TeamSpeak-format pack shipped in core, which the desktop offers next to the TeamSpeak packs. Android now draws its icons from packs too and imports TeamSpeak's own zips, falling back to the Material pack for what they lack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ts3client.gfx;
|
||||
|
||||
import com.ts3client.net.ClientStatus;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
@@ -124,4 +125,36 @@ class IconPackTest {
|
||||
assertNull(IconPack.load(Files.createDirectory(dir.resolve("empty")).toFile()));
|
||||
assertNull(IconPack.load(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shipsAMaterialPackForEveryIconTheTreeDraws() {
|
||||
IconPack pack = IconPacks.material();
|
||||
assertNotNull(pack);
|
||||
assertEquals("Material", pack.name());
|
||||
assertFalse(pack.fallsBack());
|
||||
assertNull(pack.source());
|
||||
for (ClientStatus status : ClientStatus.values()) {
|
||||
String key = IconKeys.client(status);
|
||||
assertTrue(pack.isVector(key, 16), key);
|
||||
assertNotNull(pack.icon(key, 16), key);
|
||||
}
|
||||
for (boolean password : new boolean[]{false, true}) {
|
||||
for (boolean full : new boolean[]{false, true}) {
|
||||
for (boolean subscribed : new boolean[]{false, true}) {
|
||||
for (String key : IconKeys.channel(password, full, subscribed)) {
|
||||
assertNotNull(pack.icon(key, 16), key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void setsTheColourVectorArtPaintsWith() {
|
||||
byte[] svg = "<svg fill=\"currentColor\"><path fill=\"#123456\"/></svg>".getBytes(StandardCharsets.UTF_8);
|
||||
assertEquals("<svg fill=\"#0A0B0C\"><path fill=\"#123456\"/></svg>",
|
||||
new String(IconPack.withCurrentColor(svg, 0xFF0A0B0C), StandardCharsets.UTF_8));
|
||||
byte[] fixed = "<svg/>".getBytes(StandardCharsets.UTF_8);
|
||||
assertTrue(fixed == IconPack.withCurrentColor(fixed, 0));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user