summaryrefslogtreecommitdiff
path: root/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes
diff options
context:
space:
mode:
authorkboskin <kboskin>2021-02-02 18:18:01 +0200
committerkboskin <kboskin>2021-02-02 18:18:01 +0200
commita4757db072a6e879de6eb220ffb5c2946e5dee78 (patch)
treebd3c88da25fb718425b5716a927fdf80d08db8cc /android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes
parent5f5da45a6a88e026b2b71fdf3368745f8990afbb (diff)
parent7f6db0821a3595745cff3ed34029e8a5f2552338 (diff)
downloadsdl_android-a4757db072a6e879de6eb220ffb5c2946e5dee78.tar.gz
Merge branch 'develop' into feature/0296_possibility_to_update_video_streaming_capabilities
# Conflicts: # android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java # android/sdl_android/src/androidTest/java/com/smartdevicelink/test/TestValues.java # android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java # android/sdl_android/src/main/java/com/smartdevicelink/encoder/VirtualDisplayEncoder.java # android/sdl_android/src/main/java/com/smartdevicelink/managers/video/VideoStreamManager.java # base/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java # base/src/main/java/com/smartdevicelink/streaming/video/VideoStreamingParameters.java
Diffstat (limited to 'android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes')
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeekStreamingIndicatorTests.java61
-rw-r--r--android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java7
2 files changed, 67 insertions, 1 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeekStreamingIndicatorTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeekStreamingIndicatorTests.java
new file mode 100644
index 000000000..924960adf
--- /dev/null
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/SeekStreamingIndicatorTests.java
@@ -0,0 +1,61 @@
+package com.smartdevicelink.test.rpc.datatypes;
+
+import com.smartdevicelink.proxy.rpc.SeekStreamingIndicator;
+import com.smartdevicelink.proxy.rpc.enums.SeekIndicatorType;
+import com.smartdevicelink.test.JsonUtils;
+import com.smartdevicelink.test.TestValues;
+
+import junit.framework.TestCase;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.Iterator;
+
+public class SeekStreamingIndicatorTests extends TestCase {
+
+ private SeekStreamingIndicator msg;
+
+ @Override
+ protected void setUp() throws Exception {
+ msg = new SeekStreamingIndicator();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ msg.setType(SeekIndicatorType.TRACK);
+ msg.setSeekTime(1);
+ }
+
+ public void testRpcValues() {
+ SeekIndicatorType indicator = msg.getType();
+ int seekTime = msg.getSeekTime();
+
+ assertEquals(TestValues.MATCH, SeekIndicatorType.TRACK, indicator);
+ assertEquals(TestValues.MATCH, 1, seekTime);
+
+ SeekStreamingIndicator msg = new SeekStreamingIndicator();
+ assertNotNull(TestValues.NOT_NULL, msg);
+
+ assertNull(TestValues.NULL, msg.getType());
+ assertNull(TestValues.NULL, msg.getSeekTime());
+ }
+
+ public void testJson() {
+ JSONObject reference = new JSONObject();
+
+ try {
+ reference.put(SeekStreamingIndicator.KEY_TYPE, SeekIndicatorType.TRACK);
+ reference.put(SeekStreamingIndicator.KEY_SEEK_TIME, 1);
+
+ JSONObject underTest = msg.serializeJSON();
+ assertEquals(TestValues.MATCH, reference.length(), underTest.length());
+
+ Iterator<?> iterator = reference.keys();
+ while (iterator.hasNext()) {
+ String key = (String) iterator.next();
+ assertEquals(TestValues.MATCH, JsonUtils.readObjectFromJsonObject(reference, key), JsonUtils.readObjectFromJsonObject(underTest, key));
+ }
+ } catch (JSONException e) {
+ fail(TestValues.JSON_FAIL);
+ }
+ }
+} \ No newline at end of file
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
index 5993ed69e..4781b332b 100644
--- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
+++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/datatypes/VideoStreamingCapabilityTests.java
@@ -4,6 +4,7 @@ import com.smartdevicelink.marshal.JsonRPCMarshaller;
import com.smartdevicelink.proxy.rpc.ImageResolution;
import com.smartdevicelink.proxy.rpc.VideoStreamingCapability;
import com.smartdevicelink.proxy.rpc.VideoStreamingFormat;
+import com.smartdevicelink.streaming.video.VideoStreamingParameters;
import com.smartdevicelink.test.JsonUtils;
import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;
@@ -34,6 +35,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
msg.setPixelPerInch(TestValues.GENERAL_DOUBLE);
msg.setScale(TestValues.GENERAL_DOUBLE);
msg.setAdditionalVideoStreamingCapabilities(TestValues.GENERAL_ADDITIONAL_CAPABILITY_LIST);
+ msg.setPreferredFPS(TestValues.GENERAL_INTEGER);
}
/**
@@ -49,6 +51,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
Double pixelPerInch = msg.getPixelPerInch();
Double scale = msg.getScale();
List<VideoStreamingCapability> additionalVideoStreamingCapabilities = msg.getAdditionalVideoStreamingCapabilities();
+ Integer preferredFPS = msg.getPreferredFPS();
// Valid Tests
assertEquals(TestValues.MATCH, (List<VideoStreamingFormat>) TestValues.GENERAL_VIDEOSTREAMINGFORMAT_LIST, format);
@@ -72,6 +75,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
assertNull(TestValues.NULL, msg.getPixelPerInch());
assertNull(TestValues.NULL, msg.getScale());
assertNull(TestValues.NULL, msg.getAdditionalVideoStreamingCapabilities());
+ assertNull(TestValues.NULL, msg.getPreferredFPS());
}
public void testJson() {
@@ -86,6 +90,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
reference.put(VideoStreamingCapability.KEY_DIAGONAL_SCREEN_SIZE, TestValues.GENERAL_DOUBLE);
reference.put(VideoStreamingCapability.KEY_PIXEL_PER_INCH, TestValues.GENERAL_DOUBLE);
reference.put(VideoStreamingCapability.KEY_SCALE, TestValues.GENERAL_DOUBLE);
+ reference.put(VideoStreamingCapability.KEY_PREFERRED_FPS, TestValues.GENERAL_INTEGER);
JSONObject underTest = msg.serializeJSON();
assertEquals(TestValues.MATCH, reference.length(), underTest.length());
@@ -94,7 +99,7 @@ public class VideoStreamingCapabilityTests extends TestCase {
while (iterator.hasNext()) {
String key = (String) iterator.next();
- if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE) || key.equals(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED)) {
+ if (key.equals(VideoStreamingCapability.KEY_MAX_BITRATE) || key.equals(VideoStreamingCapability.KEY_HAPTIC_SPATIAL_DATA_SUPPORTED) || key.equals(VideoStreamingCapability.KEY_PREFERRED_FPS)) {
assertTrue(TestValues.TRUE, JsonUtils.readIntegerFromJsonObject(reference, key) == JsonUtils.readIntegerFromJsonObject(underTest, key));
} else if (key.equals(VideoStreamingCapability.KEY_PREFERRED_RESOLUTION)) {
ImageResolution irReference = (ImageResolution) JsonUtils.readObjectFromJsonObject(reference, key);