haltests: Update 96/264596/2
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 14 Sep 2021 07:37:18 +0000 (16:37 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 27 Sep 2021 08:34:59 +0000 (17:34 +0900)
- Remove hard coded fps setting.
- Set supported values from device info before set format.

[Version] 0.0.15
[Issue Type] Update

Change-Id: I9901fa7fdd0ed5de6b039df5286fb3196f4e32d9
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/hal-api-camera.spec
tests/camera_hal_test.cpp

index 1379101e5aacda1a7060124257ff0ffec5724ef5..ce30bf02b64ea1e0a53a17aa9fe86a18c4cecf80 100644 (file)
@@ -4,7 +4,7 @@
 ### main package #########
 Name:       %{name}
 Summary:    %{name} interface
-Version:    0.0.14
+Version:    0.0.15
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
index 12e386d3f6909cbdeb56789b00fea4fc35c6c1a0..6cd9f62bdec4ebff6aaaa3d2435f4a08fbeac3db 100644 (file)
@@ -214,31 +214,35 @@ class CameraHalTest : public testing::Test
 
                int GetSupportedFormat(int index)
                {
+                       camera_device_info_s *d = NULL;
+
                        if (g_device_info_list.count < 1) {
                                cout << "no available camera device" << endl;
                                return CAMERA_ERROR_DEVICE_NOT_SUPPORTED;
                        }
 
+                       d = &g_device_info_list.device_info[index];
+
                        /* set preview format */
-                       g_preview_format.stream_format = g_device_info_list.device_info[index].format_list.formats[0];
-                       g_preview_format.stream_resolution.width = g_device_info_list.device_info[index].preview_list.resolutions[0].width;
-                       g_preview_format.stream_resolution.height = g_device_info_list.device_info[index].preview_list.resolutions[0].height;
-                       g_preview_format.stream_fps = 15;
+                       g_preview_format.stream_format = d->format_list.formats[0];
+                       g_preview_format.stream_resolution.width = d->preview_list.resolutions[0].width;
+                       g_preview_format.stream_resolution.height = d->preview_list.resolutions[0].height;
+                       g_preview_format.stream_fps = d->preview_fps_list[0].fps[0];
                        g_preview_format.stream_rotation = CAMERA_ROTATION_0;
-                       g_preview_format.capture_format = g_device_info_list.device_info[index].format_list.formats[0];
-                       g_preview_format.capture_resolution.width = g_device_info_list.device_info[index].capture_list.resolutions[0].width;
-                       g_preview_format.capture_resolution.height = g_device_info_list.device_info[index].capture_list.resolutions[0].height;
+                       g_preview_format.capture_format = d->format_list.formats[0];
+                       g_preview_format.capture_resolution.width = d->capture_list.resolutions[0].width;
+                       g_preview_format.capture_resolution.height = d->capture_list.resolutions[0].height;
                        g_preview_format.capture_quality = 95;
 
                        /* set video format */
-                       g_video_format.stream_format = g_device_info_list.device_info[index].format_list.formats[0];
-                       g_video_format.stream_resolution.width = g_device_info_list.device_info[index].video_list.resolutions[0].width;
-                       g_video_format.stream_resolution.height = g_device_info_list.device_info[index].video_list.resolutions[0].height;
-                       g_video_format.stream_fps = 15;
+                       g_video_format.stream_format = d->format_list.formats[0];
+                       g_video_format.stream_resolution.width = d->video_list.resolutions[0].width;
+                       g_video_format.stream_resolution.height = d->video_list.resolutions[0].height;
+                       g_video_format.stream_fps = d->video_fps_list[0].fps[0];;
                        g_video_format.stream_rotation = CAMERA_ROTATION_0;
-                       g_video_format.capture_format = g_device_info_list.device_info[index].format_list.formats[0];
-                       g_video_format.capture_resolution.width = g_device_info_list.device_info[index].capture_list.resolutions[0].width;
-                       g_video_format.capture_resolution.height = g_device_info_list.device_info[index].capture_list.resolutions[0].height;
+                       g_video_format.capture_format = d->format_list.formats[0];
+                       g_video_format.capture_resolution.width = d->capture_list.resolutions[0].width;
+                       g_video_format.capture_resolution.height = d->capture_list.resolutions[0].height;
                        g_video_format.capture_quality = 95;
 
                        return CAMERA_ERROR_NONE;
@@ -453,6 +457,8 @@ TEST_F(CameraHalTest, SetPreviewStreamFormatP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -513,6 +519,8 @@ TEST_F(CameraHalTest, GetPreviewStreamFormatP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -627,6 +635,8 @@ TEST_F(CameraHalTest, StartPreviewN)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -659,6 +669,8 @@ TEST_F(CameraHalTest, StopPreviewP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -694,6 +706,8 @@ TEST_F(CameraHalTest, StartCaptureP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -744,6 +758,8 @@ TEST_F(CameraHalTest, StartCaptureN)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -780,6 +796,8 @@ TEST_F(CameraHalTest, StopCaptureP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -961,6 +979,8 @@ TEST_F(CameraHalTest, StartRecordP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -1014,6 +1034,8 @@ TEST_F(CameraHalTest, StartRecordN)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -1058,6 +1080,8 @@ TEST_F(CameraHalTest, StopRecordP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -1244,6 +1268,8 @@ TEST_F(CameraHalTest, StartAutoFocusP)
        ret = hal_camera_add_message_callback(g_hal_handle, _MessageCb, nullptr, &cb_id);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -1299,6 +1325,8 @@ TEST_F(CameraHalTest, StopAutoFocusP)
        ret = hal_camera_add_message_callback(g_hal_handle, _MessageCb, nullptr, &cb_id);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -1344,6 +1372,8 @@ TEST_F(CameraHalTest, ReleasePreviewBufferP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -1384,6 +1414,8 @@ TEST_F(CameraHalTest, ReleaseVideoBufferP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);
 
@@ -1437,6 +1469,8 @@ TEST_F(CameraHalTest, SetUnsetExtraPreviewCallbackP)
        ret = hal_camera_open_device(g_hal_handle, g_device_info_list.device_info[0].index);
        ASSERT_EQ(ret, CAMERA_ERROR_NONE);
 
+       GetSupportedFormat(0);
+
        ret = hal_camera_set_preview_stream_format(g_hal_handle, &g_preview_format);
        EXPECT_EQ(ret, CAMERA_ERROR_NONE);