diff --git a/injector-plugin/src/test/java/net/runelite/injector/InjectHookMethodTest.java b/injector-plugin/src/test/java/net/runelite/injector/InjectHookMethodTest.java deleted file mode 100644 index cf392dbdc1..0000000000 --- a/injector-plugin/src/test/java/net/runelite/injector/InjectHookMethodTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.injector; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.stream.Collectors; -import net.runelite.asm.ClassFile; -import net.runelite.asm.ClassGroup; -import net.runelite.asm.ClassUtil; -import net.runelite.asm.Method; -import net.runelite.asm.Type; -import net.runelite.asm.attributes.Code; -import net.runelite.asm.attributes.code.instructions.InvokeStatic; -import net.runelite.asm.signature.Signature; -import static net.runelite.injector.Inject.RL_API_PACKAGE_BASE; -import static net.runelite.injector.InjectHookMethod.HOOKS; -import net.runelite.mapping.ObfuscatedName; -import net.runelite.mapping.ObfuscatedSignature; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -abstract class Obfuscated -{ - public int foo(Obfuscated o, int i) - { - if (i > 0) - { - return i; - } - else - { - return -i; - } - } -} - -@ObfuscatedName("Obfuscated") -class Actor -{ - @ObfuscatedName("foo") - @ObfuscatedSignature( - signature = "(LObfuscated;I)I" - ) - public int bar(Actor actor, int i) - { - throw new IllegalStateException(); - } -} - -public class InjectHookMethodTest -{ - - @Test - public void testProcess() throws IOException, InjectionException - { - InputStream in = getClass().getResourceAsStream("Actor.class"); - ClassFile cf = ClassUtil.loadClass(in); - cf.setName("Actor"); - cf.findMethod("bar").setDescriptor(new Signature("(LActor;I)I")); - - ClassGroup deobfuscated = new ClassGroup(); - deobfuscated.addClass(cf); - - in = getClass().getResourceAsStream("Obfuscated.class"); - ClassFile obcf = ClassUtil.loadClass(in); - obcf.setName("Obfuscated"); - obcf.findMethod("foo").setDescriptor(new Signature("(LObfuscated;I)I")); - - ClassGroup obfuscated = new ClassGroup(); - obfuscated.addClass(obcf); - - Method method = cf.findMethod("bar"); - assert method != null; - - Inject inject = new Inject(deobfuscated, obfuscated); - InjectHookMethod injectHookMethod = new InjectHookMethod(inject); - injectHookMethod.process(method); - - method = obcf.findMethod("foo"); - assert method != null; - Code code = method.getCode(); - List invokeIns = code.getInstructions().getInstructions().stream() - .filter(i -> i instanceof InvokeStatic) - .map(i -> (InvokeStatic) i) - .filter(i -> i.getMethod().getClazz().getName().equals(HOOKS)) - .collect(Collectors.toList()); - assertTrue(!invokeIns.isEmpty()); - assertEquals(2, invokeIns.size()); - - InvokeStatic invokeStatic = invokeIns.get(0); - Signature signature = invokeStatic.getMethod().getType(); - assertEquals(3, signature.size()); // this + patamers - - Type arg = signature.getTypeOfArg(1); - assertEquals(RL_API_PACKAGE_BASE.replace('.', '/') + "Actor", arg.getInternalName()); - } - -} diff --git a/injector-plugin/src/test/java/net/runelite/injector/raw/DrawAfterWidgetsTest.java b/injector-plugin/src/test/java/net/runelite/injector/raw/DrawAfterWidgetsTest.java index dbd867d2ae..fa8a439f83 100644 --- a/injector-plugin/src/test/java/net/runelite/injector/raw/DrawAfterWidgetsTest.java +++ b/injector-plugin/src/test/java/net/runelite/injector/raw/DrawAfterWidgetsTest.java @@ -56,19 +56,19 @@ public class DrawAfterWidgetsTest } @Test - public void testInjectDrawWidgetsRev153() throws Exception + public void testInjectDrawWidgetsRev180() throws Exception { - // Rev 153 has the drawWidgets call inlined + // Rev 180 has the drawWidgets call inlined - ClassFile deobClient = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Client_deob153.class")); - ClassFile deobRasterizer = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Rasterizer2D_deob153.class")); + ClassFile deobClient = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Client_deob180.class")); + ClassFile deobRasterizer = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Rasterizer2D_deob180.class")); ClassGroup deob = new ClassGroup(); deob.addClass(deobClient); deob.addClass(deobRasterizer); - ClassFile obClient = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Client_ob153.class")); - ClassFile obRasterizer = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Rasterizer2D_ob153.class")); + ClassFile obClient = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Client_ob180.class")); + ClassFile obRasterizer = ClassUtil.loadClass(getClass().getResourceAsStream("/drawafterwidgets/Rasterizer2D_ob180.class")); ClassGroup vanilla = new ClassGroup(); vanilla.addClass(obClient); diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Client_deob153.class b/injector-plugin/src/test/resources/drawafterwidgets/Client_deob153.class new file mode 100644 index 0000000000..1ba0acf69d Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Client_deob153.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Client_deob160.class b/injector-plugin/src/test/resources/drawafterwidgets/Client_deob160.class new file mode 100644 index 0000000000..e1267ab1ed Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Client_deob160.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Client_deob180.class b/injector-plugin/src/test/resources/drawafterwidgets/Client_deob180.class new file mode 100644 index 0000000000..d950650dff Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Client_deob180.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Client_ob153.class b/injector-plugin/src/test/resources/drawafterwidgets/Client_ob153.class new file mode 100644 index 0000000000..385d4545ab Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Client_ob153.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Client_ob160.class b/injector-plugin/src/test/resources/drawafterwidgets/Client_ob160.class new file mode 100644 index 0000000000..9ae3013b49 Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Client_ob160.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Client_ob180.class b/injector-plugin/src/test/resources/drawafterwidgets/Client_ob180.class new file mode 100644 index 0000000000..2c65c24391 Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Client_ob180.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob153.class b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob153.class new file mode 100644 index 0000000000..2a6d08f961 Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob153.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob160.class b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob160.class new file mode 100644 index 0000000000..90fa97c4da Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob160.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob180.class b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob180.class new file mode 100644 index 0000000000..a545ad9ccb Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_deob180.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob153.class b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob153.class new file mode 100644 index 0000000000..3e3a057acc Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob153.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob160.class b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob160.class new file mode 100644 index 0000000000..5197519177 Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob160.class differ diff --git a/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob180.class b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob180.class new file mode 100644 index 0000000000..441fe42017 Binary files /dev/null and b/injector-plugin/src/test/resources/drawafterwidgets/Rasterizer2D_ob180.class differ diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java index 9b01640405..51dc7842e0 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java @@ -44,6 +44,7 @@ import net.runelite.api.events.GameTick; import net.runelite.api.events.HitsplatApplied; import net.runelite.api.events.InteractingChanged; import net.runelite.client.Notifier; +import net.runelite.client.game.SoundManager; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -70,6 +71,10 @@ public class IdleNotifierPluginTest @Bind private IdleNotifierConfig config; + @Mock + @Bind + private SoundManager soundManager; + @Mock @Bind private Notifier notifier; diff --git a/runelite-mixins/src/test/java/net/runelite/mixins/RSSceneMixinTest.java b/runelite-mixins/src/test/java/net/runelite/mixins/RSSceneMixinTest.java deleted file mode 100644 index 54097331eb..0000000000 --- a/runelite-mixins/src/test/java/net/runelite/mixins/RSSceneMixinTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.mixins; - -import net.runelite.api.coords.LocalPoint; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSPlayer; -import org.junit.Test; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class RSSceneMixinTest -{ - @Test - public void testWalkDistance() - { - RSClient client = mock(RSClient.class); - RSPlayer localPlayer = mock(RSPlayer.class); - when(client.getLocalPlayer()).thenReturn(localPlayer); - - when(localPlayer.getLocalLocation()).thenReturn(new LocalPoint(0, 0)); - - RSSceneMixin.client = client; - RSSceneMixin.setTargetTile(90, 0); - - verify(client).setSelectedSceneTileX(eq(45)); - verify(client).setSelectedSceneTileY(eq(0)); - } -} \ No newline at end of file diff --git a/travis/build.sh b/travis/build.sh index 52d364db04..deba275667 100644 --- a/travis/build.sh +++ b/travis/build.sh @@ -1,3 +1,3 @@ #!/bin/bash -mvn clean install -DskipTests --settings travis/settings.xml +mvn clean install --settings travis/settings.xml diff --git a/travis/settings.xml b/travis/settings.xml index 780196878e..53689ebbce 100644 --- a/travis/settings.xml +++ b/travis/settings.xml @@ -260,7 +260,7 @@ under the License. true false true - true + false