diff options
author | Bilal Alsharifi <bilal.alsharifi@gmail.com> | 2021-09-14 12:18:39 -0400 |
---|---|---|
committer | Bilal Alsharifi <bilal.alsharifi@gmail.com> | 2021-09-14 12:18:39 -0400 |
commit | 919c3cb35416055e69152663a44f3abd70a9cbeb (patch) | |
tree | 9dfdef8834e747845fbdeb67acbfc6f5d9df6f31 | |
parent | deabce00f3a66cce9fcd6c623dd88a3a609f4140 (diff) | |
download | sdl_android-feature/java_version_test.tar.gz |
remove testsfeature/java_version_test
-rw-r--r-- | android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java index dd6bc6435..6a7637ea6 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/video/HapticInterfaceManagerTest.java @@ -114,114 +114,6 @@ public class HapticInterfaceManagerTest extends TestCase { assertEquals("Haptic Rects", 4, list.size()); } - @Test - public void testRefreshHapticDataNull() throws Exception { - hapticMgr.refreshHapticData(null); - verify(interalInterface).sendRPC(captor.capture()); - SendHapticData data = captor.getValue(); - assertNotNull("SendHapticData RPC", data); - List<HapticRect> list = data.getHapticRectData(); - assertTrue("List", list.isEmpty()); - } - - @Test - public void testRefreshHapticData_Scale_2_0() { - double scale = 2.0; - - final int buttonX = 60; - final int buttonY = 60; - final int buttonWidth = 150; - final int buttonHeight = 70; - - Rectangle expected = new Rectangle(); - expected.setX(120.0f); - expected.setY(120.0f); - expected.setWidth(300.0f); - expected.setHeight(140.0f); - - VideoStreamingCapability capability = new VideoStreamingCapability(); - capability.setScale(scale); - - assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability); - } - - - @Test - public void testRefreshHapticData_Scale_0_5() { - double scale = 0.5; - - final int buttonX = 60; - final int buttonY = 60; - final int buttonWidth = 150; - final int buttonHeight = 70; - - Rectangle expected = new Rectangle(); - expected.setX(30.0f); - expected.setY(30.0f); - expected.setWidth(75.0f); - expected.setHeight(35.0f); - - VideoStreamingCapability capability = new VideoStreamingCapability(); - capability.setScale(scale); - - assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability); - } - - - @Test - public void testRefreshHapticDataWithNullCapability() { - final int buttonX = 60; - final int buttonY = 60; - final int buttonWidth = 150; - final int buttonHeight = 70; - - Rectangle expected = new Rectangle(); - expected.setX(60.0f); - expected.setY(60.0f); - expected.setWidth(150.0f); - expected.setHeight(70.0f); - - assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, null); - } - - @Test - public void testRefreshHapticDataWithNullScale() { - final int buttonX = 60; - final int buttonY = 60; - final int buttonWidth = 150; - final int buttonHeight = 70; - - Rectangle expected = new Rectangle(); - expected.setX(60.0f); - expected.setY(60.0f); - expected.setWidth(150.0f); - expected.setHeight(70.0f); - - VideoStreamingCapability capability = new VideoStreamingCapability(); - capability.setScale(null); - - assertViewWithCapability(buttonX, buttonY, buttonWidth, buttonHeight, expected, capability); - } - - @Test - public void testRefreshWithUserData() throws Exception { - List<HapticRect> rects = new ArrayList<>(); - Rectangle rect = new Rectangle(); - rect.setX(10f); - rect.setY(10f); - rect.setWidth(50f); - rect.setHeight(20f); - HapticRect hRect = new HapticRect(); - hRect.setRect(rect); - rects.add(hRect); - hapticMgr.setHapticData(rects); - verify(interalInterface).sendRPC(any(SendHapticData.class)); - - View root = createViews(); - hapticMgr.refreshHapticData(root); - verify(interalInterface, times(1)).sendRPC(any(SendHapticData.class)); - } - private View createViews() { View view = mock(View.class); @@ -270,25 +162,4 @@ public class HapticInterfaceManagerTest extends TestCase { button.setBottom(h); return button; } - - private void assertViewWithCapability(int x, int y, int w, int h, Rectangle expected, VideoStreamingCapability capability) { - SystemCapabilityManager systemCapabilityManager = mock(SystemCapabilityManager.class); - when(systemCapabilityManager.getCapability(eq(SystemCapabilityType.VIDEO_STREAMING), (OnSystemCapabilityListener) isNull(), anyBoolean())).thenReturn(capability); - doReturn(systemCapabilityManager).when(interalInterface).getSystemCapabilityManager(); - - View button = createView(x, y, w, h); - - hapticMgr.refreshHapticData(button); - verify(interalInterface).sendRPC(captor.capture()); - - SendHapticData data = captor.getValue(); - List<HapticRect> list = data.getHapticRectData(); - assertEquals(1, list.size()); - Rectangle current = list.get(0).getRect(); - - assertEquals(expected.getX(), current.getX(), 0.0005); - assertEquals(expected.getY(), current.getY(), 0.0005); - assertEquals(expected.getWidth(), current.getWidth(), 0.0005); - assertEquals(expected.getHeight(), current.getHeight(), 0.0005); - } } |