Show server, channel and client details on Android, and the server's on the desktop
Core's Details says what the info box tells, as TeamSpeak's info frame does: labelled facts, then a BBCode description. The desktop info panel now lays it out instead of building its own, and selecting the server row shows the server: address, version, clients, channels, creation date and its welcome and host messages, from the virtualserver_* properties kept since initserver. On Android the channel and client sheets show the same details, asking the server for a missing channel description or a client's variables; tapping the server row opens a server sheet. Descriptions render as TeamSpeak's do: BBCode now knows [hr], [left]/[right]/[justify], numbered and lettered lists and tables, which Android's HTML parser approximates — rules as dividers, table rows as lines, list items numbered, font sizes as big/small. Links are blue whatever the wallpaper. Push-to-talk in the bottom bar follows whichever server holds the microphone, and a server without it keeps its button to take it in a fixed slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package com.ts3client.net;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class DetailsTest {
|
||||
|
||||
@Test
|
||||
void serverTakesInitserverAndEditsAndBareKeys() {
|
||||
ServerModel model = new ServerModel();
|
||||
model.setServerName("Test");
|
||||
Map<String, String> init = new HashMap<>();
|
||||
init.put("virtualserver_version", "3.13.7");
|
||||
init.put("virtualserver_platform", "Linux");
|
||||
init.put("virtualserver_maxclients", "32");
|
||||
init.put("virtualserver_welcomemessage", "Hello");
|
||||
// An empty property comes as a bare key.
|
||||
init.put("virtualserver_hostmessage", null);
|
||||
model.putServerProperties(init);
|
||||
model.putServerProperties(Map.of("virtualserver_hostmessage", "Be nice", "invokerid", "5"));
|
||||
|
||||
Details d = Details.server(model, "host:9987");
|
||||
assertEquals("Test", d.title());
|
||||
assertEquals(new Details.Field("Version", "3.13.7 on Linux"), d.fields().get(1));
|
||||
assertEquals(new Details.Field("Clients", "0 / 32"), d.fields().get(2));
|
||||
assertEquals("Hello\n\nBe nice", d.description());
|
||||
assertEquals("", model.serverProperty("invokerid"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void channelDescriptionIsPendingUntilAnswered() {
|
||||
ChannelNode ch = new ChannelNode(1, "Lobby");
|
||||
ch.topic = "Entry";
|
||||
assertTrue(Details.channel(ch).pending());
|
||||
ch.descriptionLoaded = true;
|
||||
Details d = Details.channel(ch);
|
||||
assertFalse(d.pending());
|
||||
assertEquals(List.of(new Details.Field("Topic", "Entry")), d.fields());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ts3client.text;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/** The block tags TeamSpeak's own client renders in descriptions. */
|
||||
class BBCodeTagsTest {
|
||||
|
||||
@Test
|
||||
void rulesStandAlone() {
|
||||
assertEquals("a<hr>b", BBCode.toHtml("a[hr]b"));
|
||||
assertEquals("a<hr>b", BBCode.toHtml("a[hr][/hr]b"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void alignsBlocks() {
|
||||
assertEquals("<div align=\"right\">x</div><div align=\"justify\">y</div>",
|
||||
BBCode.toHtml("[right]x[/right][justify]y[/justify]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void numbersLists() {
|
||||
assertEquals("<ol><li>one</li><li>two</li></ol>", BBCode.toHtml("[list=1][*]one[*]two[/list]"));
|
||||
assertEquals("<ol type=\"a\"><li>x</li></ol>", BBCode.toHtml("[list=a][*]x[/list]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildsTablesOnlyWhereTheyNest() {
|
||||
assertEquals("<table><tr><th>h</th><td>d</td></tr></table>",
|
||||
BBCode.toHtml("[table][tr][th]h[/th][td]d[/td][/tr][/table]"));
|
||||
assertEquals("[td]loose[/td]", BBCode.toHtml("[td]loose[/td]"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user