From b0f1e85c2e5fc9137a70d1659f978f6e43310591 Mon Sep 17 00:00:00 2001 From: Ganom Date: Thu, 5 Mar 2020 07:37:01 -0500 Subject: [PATCH] project: upstream fixes. --- buildSrc/src/main/kotlin/Dependencies.kt | 4 +- .../itemstats/ItemStatOverlayTest.java | 171 ------------------ 2 files changed, 2 insertions(+), 173 deletions(-) delete mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/itemstats/ItemStatOverlayTest.java diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index c5626f0aa4..c4592e3599 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -25,9 +25,9 @@ object ProjectVersions { const val launcherVersion = "2.0.4" - const val rlVersion = "1.6.8" + const val rlVersion = "1.6.9" - const val openosrsVersion = "3.0.6" + const val openosrsVersion = "3.0.7" const val rsversion = 188 const val cacheversion = 165 diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemstats/ItemStatOverlayTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemstats/ItemStatOverlayTest.java deleted file mode 100644 index b3826df992..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemstats/ItemStatOverlayTest.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2020 Jordan - * 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.client.plugins.itemstats; - -import com.google.inject.Guice; -import com.google.inject.Inject; -import com.google.inject.testing.fieldbinder.Bind; -import com.google.inject.testing.fieldbinder.BoundFieldModule; -import java.awt.Color; -import net.runelite.api.Client; -import net.runelite.api.EquipmentInventorySlot; -import net.runelite.api.InventoryID; -import net.runelite.api.Item; -import net.runelite.api.ItemContainer; -import net.runelite.client.game.ItemManager; -import net.runelite.client.util.Text; -import net.runelite.http.api.item.ItemEquipmentStats; -import net.runelite.http.api.item.ItemStats; -import org.apache.commons.lang3.StringUtils; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class ItemStatOverlayTest -{ - // Weapon definitions - private static final ItemStats ABYSSAL_DAGGER = new ItemStats(false, true, 0.453, 8, - ItemEquipmentStats.builder() - .slot(EquipmentInventorySlot.WEAPON.getSlotIdx()) - .astab(75) - .aslash(40) - .acrush(-4) - .amagic(1) - .dmagic(1) - .str(75) - .aspeed(4) - .build()); - private static final ItemStats KATANA = new ItemStats(false, true, 0, 8, - ItemEquipmentStats.builder() - .slot(EquipmentInventorySlot.WEAPON.getSlotIdx()) - .astab(7) - .aslash(45) - .dstab(3) - .dslash(7) - .dcrush(7) - .drange(-3) - .str(40) - .aspeed(4) - .build()); - private static final ItemStats BLOWPIPE = new ItemStats(false, true, 0, 0, - ItemEquipmentStats.builder() - .slot(EquipmentInventorySlot.WEAPON.getSlotIdx()) - .arange(60) - .rstr(40) - .aspeed(3) - .build()); - private static final ItemStats HEAVY_BALLISTA = new ItemStats(false, true, 4, 8, - ItemEquipmentStats.builder() - .slot(EquipmentInventorySlot.WEAPON.getSlotIdx()) - .arange(110) - .aspeed(7) - .build()); - - @Inject - ItemStatOverlay overlay; - - @Mock - @Bind - Client client; - - @Mock - @Bind - ItemStatConfig config; - - @Mock - @Bind - ItemManager itemManager; - - @Before - public void before() - { - Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); - - when(config.colorBetterUncapped()).thenReturn(new Color(0)); - when(config.colorWorse()).thenReturn(new Color(0)); - } - - @Test - public void testUnarmedAttackSpeed() - { - assertEquals(ItemStatOverlay.UNARMED.getEquipment().getAspeed(), ABYSSAL_DAGGER.getEquipment().getAspeed()); - assertEquals(ItemStatOverlay.UNARMED.getEquipment().getAspeed(), KATANA.getEquipment().getAspeed()); - assertEquals(-1, BLOWPIPE.getEquipment().getAspeed() - ItemStatOverlay.UNARMED.getEquipment().getAspeed()); - assertEquals(3, HEAVY_BALLISTA.getEquipment().getAspeed() - ItemStatOverlay.UNARMED.getEquipment().getAspeed()); - } - - @Test - public void testBuildStatBonusString() - { - // Empty equipment (fully unarmed) - final ItemContainer equipment = mock(ItemContainer.class); - when(equipment.getItems()).thenReturn(new Item[0]); - when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipment); - - String tooltip; - String sanitizedTooltip; - - tooltip = overlay.buildStatBonusString(ABYSSAL_DAGGER); - sanitizedTooltip = Text.sanitizeMultilineText(tooltip); - assertTrue(sanitizedTooltip.contains("Stab: +75")); - assertTrue(sanitizedTooltip.contains("Slash: +40")); - assertTrue(sanitizedTooltip.contains("Crush: -4")); - assertEquals(2, StringUtils.countMatches(sanitizedTooltip, "Magic: +1")); // Attack and defense - assertTrue(sanitizedTooltip.contains("Melee Str: +75")); - assertFalse(sanitizedTooltip.contains("Speed:")); - - tooltip = overlay.buildStatBonusString(KATANA); - sanitizedTooltip = Text.sanitizeMultilineText(tooltip); - assertTrue(sanitizedTooltip.contains("Stab: +7")); - assertTrue(sanitizedTooltip.contains("Slash: +45")); - assertTrue(sanitizedTooltip.contains("Stab: +3")); // Defense - assertTrue(sanitizedTooltip.contains("Slash: +7")); // Defense - assertTrue(sanitizedTooltip.contains("Crush: +7")); // Defense - assertTrue(sanitizedTooltip.contains("Range: -3")); // Defense - assertTrue(sanitizedTooltip.contains("Melee Str: +40")); - assertFalse(sanitizedTooltip.contains("Speed:")); - - tooltip = overlay.buildStatBonusString(BLOWPIPE); - sanitizedTooltip = Text.sanitizeMultilineText(tooltip); - assertTrue(sanitizedTooltip.contains("Range: +60")); - assertTrue(sanitizedTooltip.contains("Range Str: +40")); - assertTrue(sanitizedTooltip.contains("Speed: -1")); - assertFalse(sanitizedTooltip.contains("Stab:")); - - tooltip = overlay.buildStatBonusString(HEAVY_BALLISTA); - sanitizedTooltip = Text.sanitizeMultilineText(tooltip); - assertTrue(sanitizedTooltip.contains("Range: +110")); - assertTrue(sanitizedTooltip.contains("Speed: +3")); - assertFalse(sanitizedTooltip.contains("Stab:")); - } -}