Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -25,9 +25,12 @@
|
||||
package net.runelite.client.menus;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class TestMenuEntry implements MenuEntry
|
||||
@@ -39,6 +42,12 @@ public class TestMenuEntry implements MenuEntry
|
||||
private int param0;
|
||||
private int param1;
|
||||
private boolean forceLeftClick;
|
||||
@Setter
|
||||
private int itemOp = -1;
|
||||
@Setter
|
||||
private int itemId = -1;
|
||||
@Setter
|
||||
private Widget widget;
|
||||
|
||||
@Override
|
||||
public String getOption()
|
||||
@@ -205,4 +214,29 @@ public class TestMenuEntry implements MenuEntry
|
||||
{
|
||||
return MenuAction.of(this.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemOp()
|
||||
{
|
||||
return itemOp != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemOp()
|
||||
{
|
||||
return itemOp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemId()
|
||||
{
|
||||
return itemId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Widget getWidget()
|
||||
{
|
||||
return widget;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -164,10 +165,10 @@ public class ClueScrollPluginTest
|
||||
plugin.onGameTick(new GameTick());
|
||||
|
||||
// Simulate clicking on the STASH
|
||||
MenuOptionClicked menuOptionClicked = new MenuOptionClicked();
|
||||
menuOptionClicked.setMenuOption("Search");
|
||||
menuOptionClicked.setMenuTarget("<col=ffff>STASH unit (easy)");
|
||||
menuOptionClicked.setId(NullObjectID.NULL_28983);
|
||||
MenuOptionClicked menuOptionClicked = mock(MenuOptionClicked.class);
|
||||
when(menuOptionClicked.getMenuOption()).thenReturn("Search");
|
||||
lenient().when(menuOptionClicked.getMenuTarget()).thenReturn("<col=ffff>STASH unit (easy)");
|
||||
when(menuOptionClicked.getId()).thenReturn(NullObjectID.NULL_28983);
|
||||
plugin.onMenuOptionClicked(menuOptionClicked);
|
||||
|
||||
// Check that the STASH is stored after withdrawing
|
||||
|
||||
@@ -38,7 +38,6 @@ import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.events.ClientTick;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
@@ -332,14 +331,7 @@ public class MenuEntrySwapperPluginTest
|
||||
menu("Deposit-1", "Abyssal whip", MenuAction.CC_OP, 2),
|
||||
};
|
||||
|
||||
menuEntrySwapperPlugin.onMenuEntryAdded(new MenuEntryAdded(
|
||||
"Deposit-1",
|
||||
"Abyssal whip",
|
||||
MenuAction.CC_OP.getId(),
|
||||
2,
|
||||
-1,
|
||||
-1
|
||||
));
|
||||
menuEntrySwapperPlugin.onClientTick(new ClientTick());
|
||||
|
||||
ArgumentCaptor<MenuEntry[]> argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class);
|
||||
verify(client).setMenuEntries(argumentCaptor.capture());
|
||||
@@ -364,14 +356,7 @@ public class MenuEntrySwapperPluginTest
|
||||
menu("Deposit-1", "Rune arrow", MenuAction.CC_OP, 2),
|
||||
};
|
||||
|
||||
menuEntrySwapperPlugin.onMenuEntryAdded(new MenuEntryAdded(
|
||||
"Deposit-1",
|
||||
"Rune arrow",
|
||||
MenuAction.CC_OP.getId(),
|
||||
2,
|
||||
-1,
|
||||
-1
|
||||
));
|
||||
menuEntrySwapperPlugin.onClientTick(new ClientTick());
|
||||
|
||||
ArgumentCaptor<MenuEntry[]> argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class);
|
||||
verify(client).setMenuEntries(argumentCaptor.capture());
|
||||
|
||||
Reference in New Issue
Block a user