]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option image offset x
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 17:51:25 +0000 (18:51 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 17:51:25 +0000 (18:51 +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 38a4ae08dbbd9879dc3834f4c427dd3b217c1f7d..6b95dc2d7677e47fa8d9e1bd7d18cab66029531c 100644 (file)
@@ -6,7 +6,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 39
+#define OPTION_COUNT 40
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
@@ -282,6 +282,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "ColorContrast");
                        _kds_s2000w_handler_opts_write_int_value(value_object, value);
                        break;
+               case 38:
+                       value_object = json_object_object_get(config, "ImageOffsetX");
+                       _kds_s2000w_handler_opts_write_int_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -461,6 +465,10 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                        _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
                        break;
                case 38:
+                       value_object = json_object_object_get(config, "ImageOffsetX");
+                       _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
+                       break;
+               case 39:
                        _kds_s2000w_handler_opts_set_option_to_default(h);
                        _kds_s2000w_handler_opts_set_autostart_on(h);
 
index 05a33a57ebee08dcbee0bfaa3460eb6fa99a7550..cf2cdeca39db6df935784711f13e80906fa118eb 100644 (file)
@@ -21,7 +21,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, 39);
+       assert_int_equal(value, 40);
 
        kds_s2000w_handler_free(h);
        h = NULL;
@@ -549,6 +549,21 @@ void sane_kds_s2000w_net_control_get_option_thirdyseven_test(void** state)
 
        assert_int_equal(value, 0);
 
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
+
+void sane_kds_s2000w_net_control_get_option_thirdyeight_test(void** state)
+{
+       handler* h = kds_s2000w_handler_init();
+       response* resp = (response*) *state;
+       h->current_scanner_config = json_tokener_parse(resp->data);
+       uint32_t value = -1;
+
+       sane_kds_s2000w_net_control_option(h, 38, SANE_ACTION_GET_VALUE, &value, NULL);
+
+       assert_int_equal(value, 0);
+
        kds_s2000w_handler_free(h);
        h = NULL;
 }
\ No newline at end of file
index 4d3e50789049a9ae60514e05e3a4fde8c081654d..742db4738bc51db9fe4db600cfe3003c6045dd47 100644 (file)
@@ -42,5 +42,6 @@ void sane_kds_s2000w_net_control_get_option_thirdyfour_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdyfive_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdysix_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdyseven_test(void** state);
+void sane_kds_s2000w_net_control_get_option_thirdyeight_test(void** state);
 
 #endif
\ No newline at end of file
index 1079514bdfc095e6429b54013117c11931047bd1..5c5d24573877e98c36b3b513737c4b8ef2ff825d 100644 (file)
@@ -111,7 +111,8 @@ int main()
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyfour_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyfive_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdysix_test, setup_default_get_option, teardown_default_get_option),
-               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyseven_test, setup_default_get_option, teardown_default_get_option)
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyseven_test, setup_default_get_option, teardown_default_get_option),
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyeight_test, setup_default_get_option, teardown_default_get_option)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);