Fix Windows channel tree ordering
This commit is contained in:
@@ -8,6 +8,28 @@ namespace VoiceCat.Tests;
|
||||
|
||||
public class WindowsManagedClientTests
|
||||
{
|
||||
private static readonly AudioConfigInfo DefaultAudio = new(0, false, 48_000, 64_000, 20, 0, true, 10, false, 10, false);
|
||||
|
||||
[Fact]
|
||||
public void ChannelHierarchyUsesServerSortOrderAndKeepsIdsWithDisplayedChannels()
|
||||
{
|
||||
ChannelInfo[] channels =
|
||||
[
|
||||
new(10, 0, "Zulu", "", false, 0, -10, DefaultAudio),
|
||||
new(20, 0, "Alpha", "", false, 0, 20, DefaultAudio),
|
||||
new(11, 10, "Zulu child", "", false, 0, 10, DefaultAudio),
|
||||
new(12, 10, "Alpha child", "", false, 0, 0, DefaultAudio),
|
||||
new(30, 0, "Beta", "", false, 0, 20, DefaultAudio),
|
||||
];
|
||||
|
||||
IReadOnlyList<ChannelHierarchyItem> roots = ChannelHierarchy.Build(channels);
|
||||
|
||||
Assert.Equal([(10U, "Zulu"), (20U, "Alpha"), (30U, "Beta")],
|
||||
roots.Select(item => (item.Channel.Id, item.Channel.Name)));
|
||||
Assert.Equal([(12U, "Alpha child"), (11U, "Zulu child")],
|
||||
roots[0].Children.Select(item => (item.Channel.Id, item.Channel.Name)));
|
||||
}
|
||||
|
||||
private static async Task Until(Client client, Func<bool> predicate)
|
||||
{
|
||||
using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(10));
|
||||
|
||||
Reference in New Issue
Block a user