Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2022-02-06 10:12:29 +01:00
24 changed files with 512 additions and 162 deletions

View File

@@ -24,6 +24,8 @@
*/
package net.runelite.client.plugins;
import com.google.common.graph.GraphBuilder;
import com.google.common.graph.MutableGraph;
import com.google.common.reflect.ClassPath;
import com.google.common.reflect.ClassPath.ClassInfo;
import com.google.inject.Guice;
@@ -40,6 +42,7 @@ import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import net.runelite.api.Client;
@@ -51,6 +54,7 @@ import net.runelite.client.eventbus.EventBus;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -89,7 +93,7 @@ public class PluginManagerTest
.thenThrow(new RuntimeException("in plugin manager test"));
Injector injector = Guice.createInjector(Modules
.override(new RuneLiteModule(okHttpClient, () -> null, true, false,
.override(new RuneLiteModule(okHttpClient, () -> null, () -> null, true, false,
RuneLite.DEFAULT_SESSION_FILE,
RuneLite.DEFAULT_CONFIG_FILE))
.with(BoundFieldModule.of(this)));
@@ -208,4 +212,23 @@ public class PluginManagerTest
}
}
@Test
public void testTopologicalSort()
{
MutableGraph<Integer> graph = GraphBuilder
.directed()
.build();
graph.addNode(1);
graph.addNode(2);
graph.addNode(3);
graph.putEdge(1, 2);
graph.putEdge(1, 3);
List<Integer> sorted = PluginManager.topologicalSort(graph);
assertTrue(sorted.indexOf(1) < sorted.indexOf(2));
assertTrue(sorted.indexOf(1) < sorted.indexOf(3));
}
}