diff options
author | BrettyWhite <geekman3454@protonmail.com> | 2019-04-24 16:14:23 -0400 |
---|---|---|
committer | BrettyWhite <geekman3454@protonmail.com> | 2019-04-24 16:14:23 -0400 |
commit | 0a8ceb4ada774313be6e5fb81bdbec7a124b4233 (patch) | |
tree | 0a07aa7b91eee37d0c47341d958a966e1111ef88 | |
parent | fdd0019e5b92dc9a9cbcdee7020f62b9e2f230c5 (diff) | |
download | sdl_android-0a8ceb4ada774313be6e5fb81bdbec7a124b4233.tar.gz |
menu cell tests
2 files changed, 47 insertions, 11 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/cells/MenuCellTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/cells/MenuCellTests.java index 086530676..da53bce3a 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/cells/MenuCellTests.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/menu/cells/MenuCellTests.java @@ -32,26 +32,24 @@ package com.smartdevicelink.managers.screen.menu.cells; -import android.content.Context; - import com.smartdevicelink.AndroidTestCase2; -import com.smartdevicelink.proxy.interfaces.ISdl; - -import static org.mockito.Mockito.mock; +import com.smartdevicelink.managers.screen.menu.MenuSelectionListener; +import com.smartdevicelink.proxy.rpc.enums.TriggerSource; +import com.smartdevicelink.test.Test; public class MenuCellTests extends AndroidTestCase2 { - private MenuCell MenuCell; + private MenuSelectionListener menuSelectionListener = new MenuSelectionListener() { + @Override + public void onTriggered(TriggerSource trigger) { + // stuff + } + }; @Override public void setUp() throws Exception{ super.setUp(); - - ISdl internalInterface = mock(ISdl.class); - - Context context = getContext(); - } @Override @@ -59,4 +57,37 @@ public class MenuCellTests extends AndroidTestCase2 { super.tearDown(); } + public void testSettersAndGetters(){ + + // set everything + MenuCell menuCell = new MenuCell(Test.GENERAL_STRING); + menuCell.setIcon(Test.GENERAL_ARTWORK); + menuCell.setVoiceCommands(Test.GENERAL_STRING_LIST); + menuCell.setSubCells(Test.GENERAL_MENUCELL_LIST); + menuCell.setMenuSelectionListener(menuSelectionListener); + + // use getters and assert equality + assertEquals(menuCell.getTitle(), Test.GENERAL_STRING); + assertEquals(menuCell.getIcon(), Test.GENERAL_ARTWORK); + assertEquals(menuCell.getVoiceCommands(), Test.GENERAL_STRING_LIST); + assertEquals(menuCell.getSubCells(), Test.GENERAL_MENUCELL_LIST); + assertEquals(menuCell.getMenuSelectionListener(), menuSelectionListener); + } + + public void testConstructors(){ + + // first constructor was tested in previous method, use the last two here + + MenuCell menuCell2 =new MenuCell(Test.GENERAL_STRING, Test.GENERAL_ARTWORK, Test.GENERAL_MENUCELL_LIST); + assertEquals(menuCell2.getTitle(), Test.GENERAL_STRING); + assertEquals(menuCell2.getIcon(), Test.GENERAL_ARTWORK); + assertEquals(menuCell2.getSubCells(), Test.GENERAL_MENUCELL_LIST); + + MenuCell menuCell3 =new MenuCell(Test.GENERAL_STRING, Test.GENERAL_ARTWORK, Test.GENERAL_STRING_LIST, menuSelectionListener); + assertEquals(menuCell3.getTitle(), Test.GENERAL_STRING); + assertEquals(menuCell3.getIcon(), Test.GENERAL_ARTWORK); + assertEquals(menuCell3.getVoiceCommands(), Test.GENERAL_STRING_LIST); + assertEquals(menuCell3.getMenuSelectionListener(), menuSelectionListener); + } + } diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java index 62176744f..aaa1f51a3 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/Test.java @@ -5,7 +5,9 @@ import android.util.Log; import com.smartdevicelink.R; import com.smartdevicelink.SdlConnection.SdlSession2; +import com.smartdevicelink.managers.file.filetypes.SdlArtwork; import com.smartdevicelink.managers.lockscreen.LockScreenConfig; +import com.smartdevicelink.managers.screen.menu.cells.MenuCell; import com.smartdevicelink.protocol.SdlProtocol; import com.smartdevicelink.protocol.enums.FunctionID; import com.smartdevicelink.proxy.SdlProxyBase; @@ -393,6 +395,8 @@ public class Test { public static final AudioControlData GENERAL_AUDIOCONTROLDATA = new AudioControlData(); public static final LightControlData GENERAL_LIGHTCONTROLDATA = new LightControlData(); public static final HMISettingsControlData GENERAL_HMISETTINGSCONTROLDATA = new HMISettingsControlData(); + public static final SdlArtwork GENERAL_ARTWORK = new SdlArtwork(); + public static final MenuCell GENERAL_MENUCELL = new MenuCell(GENERAL_STRING); public static final HMICapabilities GENERAL_HMICAPABILITIES = new HMICapabilities(); @@ -449,6 +453,7 @@ public class Test { public static final List<WeatherData> GENERAL_WEATHERDATA_LIST = Arrays.asList(GENERAL_WEATHERDATA); public static final List<WeatherAlert> GENERAL_WEATHERALERT_LIST = Arrays.asList(GENERAL_WEATHERALERT); public static final List<NavigationInstruction> GENERAL_NAVIGATION_INSTRUCTION_LIST = Arrays.asList(GENERAL_NAVIGATION_INSTRUCTION); + public static final List<MenuCell> GENERAL_MENUCELL_LIST = Arrays.asList(GENERAL_MENUCELL); public static final JSONArray JSON_TURNS = new JSONArray(); |