Browse Source

Added inRootMenu function to MenuManager.

feature-menu
Nick Stolbov 3 years ago
parent
commit
e1a6d09b6f
  1. 3
      src/main/java/Application/MenuManager.java
  2. 7
      src/test/java/Application/MenuManagerTest.java

3
src/main/java/Application/MenuManager.java

@ -18,5 +18,8 @@ public class MenuManager {
return this.currentMenu; return this.currentMenu;
} }
public boolean inRootMenu(){
return this.currentMenu.equals(this.rootMenu);
}
} }

7
src/test/java/Application/MenuManagerTest.java

@ -35,4 +35,11 @@ class MenuManagerTest {
mm.select(0); mm.select(0);
assertEquals(mm.getCurrentMenu(), rootMenu.getMenu(0).getMenu(0)); assertEquals(mm.getCurrentMenu(), rootMenu.getMenu(0).getMenu(0));
} }
@Test
void testIsRootMenuFunction(){
assertTrue(mm.inRootMenu());
mm.select(0);
assertFalse(mm.inRootMenu());
}
} }
Loading…
Cancel
Save