]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add set option post scan rotation
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 07:42:42 +0000 (08:42 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 07:42:42 +0000 (08:42 +0100)
src/kds_s2000w_handler_opts.c
tests/kds_s2000w_net_get_opt_tests.c
tests/kds_s2000w_net_get_opt_tests.h
tests/kds_s2000w_net_get_opt_tests_run.c

index 40a607f2a217c9b5c9b5c9ab3d6fe2ecb0d59016..25a103ff06fa4d4d72e8600b7e32b11ed4d7ca5a 100644 (file)
@@ -5,7 +5,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 25
+#define OPTION_COUNT 26
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
@@ -209,6 +209,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "MultifeedResponse");
                        _kds_s2000w_handler_opts_write_string_value(value_object, value);
                        break;
+               case 24:
+                       value_object = json_object_object_get(config, "PostScanRotation");
+                       _kds_s2000w_handler_opts_write_string_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -329,6 +333,10 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                        _kds_s2000w_handler_opts_write_string_value_to_json(value_object, value);
                        break;
                case 24:
+                       value_object = json_object_object_get(config, "PostScanRotation");
+                       _kds_s2000w_handler_opts_write_string_value_to_json(value_object, value);
+                       break;
+               case 25:
                        _kds_s2000w_handler_opts_set_option_to_default(h);
                        _kds_s2000w_handler_opts_set_autostart_on(h);
 
index 5d91d6bd15d0e62559b31810159c1a9205b65959..03cca143d9e5c57d44e12c0bddabcf47b75ccb58 100644 (file)
@@ -22,7 +22,7 @@ void sane_kds_s2000w_net_control_get_option_zero_test(void** state)
 
        sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &value, NULL);
 
-       assert_int_equal(value, 25);
+       assert_int_equal(value, 26);
 
        kds_s2000w_handler_free(h);
        h = NULL;
@@ -343,3 +343,18 @@ void sane_kds_s2000w_net_control_get_option_twentythree_test(void** state)
        kds_s2000w_handler_free(h);
        h = NULL;
 }
+
+void sane_kds_s2000w_net_control_get_option_twentyfoure_test(void** state)
+{
+       handler* h = kds_s2000w_handler_init();
+       response* resp = (response*) *state;
+       h->current_scanner_config = json_tokener_parse(resp->data);
+       char* value[50] = {0};
+
+       sane_kds_s2000w_net_control_option(h, 24, SANE_ACTION_GET_VALUE, &value, NULL);
+
+       assert_string_equal(value, "Automatic");
+
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
\ No newline at end of file
index 9fb01ca3a61fab275ccba0d10f3c1cf9ff70111a..1186f63b2c7daa3f94a7820b842b8986e939d47d 100644 (file)
@@ -28,5 +28,6 @@ void sane_kds_s2000w_net_control_get_option_twenty_test(void** state);
 void sane_kds_s2000w_net_control_get_option_twentyone_test(void** state);
 void sane_kds_s2000w_net_control_get_option_twentytwo_test(void** state);
 void sane_kds_s2000w_net_control_get_option_twentythree_test(void** state);
+void sane_kds_s2000w_net_control_get_option_twentyfoure_test(void** state);
 
 #endif
\ No newline at end of file
index 7b63573e9e447a2b42df8575ec1422cc0014dc56..aeb5be4c106b135ba884e38b1caf7ff11c4ce303 100644 (file)
@@ -97,7 +97,8 @@ int main()
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twenty_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentyone_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentytwo_test, setup_default_get_option, teardown_default_get_option),
-               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentythree_test, setup_default_get_option, teardown_default_get_option)
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentythree_test, setup_default_get_option, teardown_default_get_option),
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentyfoure_test, setup_default_get_option, teardown_default_get_option)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);