]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add image border option
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 08:17:31 +0000 (09:17 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 08:17:31 +0000 (09:17 +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 cb59652c33c4f579f18120da4e3dab2d546e554b..3c7b0a68a91b0727570947d72d48044bcdbe2f97 100644 (file)
@@ -5,7 +5,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 27
+#define OPTION_COUNT 28
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
@@ -217,6 +217,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "EdgeFill");
                        _kds_s2000w_handler_opts_write_string_value(value_object, value);
                        break;
+               case 26:
+                       value_object = json_object_object_get(config, "ImageBorder");
+                       _kds_s2000w_handler_opts_write_string_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -345,6 +349,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 26:
+                       value_object = json_object_object_get(config, "ImageBorder");
+                       _kds_s2000w_handler_opts_write_string_value_to_json(value_object, value);
+                       break;
+               case 27:
                        _kds_s2000w_handler_opts_set_option_to_default(h);
                        _kds_s2000w_handler_opts_set_autostart_on(h);
 
index 2fa02d9573e17d776e77961c2d7fbbc91ea95379..30c700ebeadc00dce5db88613d25ce5f2cc32813 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, 27);
+       assert_int_equal(value, 28);
 
        kds_s2000w_handler_free(h);
        h = NULL;
@@ -370,6 +370,21 @@ void sane_kds_s2000w_net_control_get_option_twentyfive_test(void** state)
 
        assert_string_equal(value, "Automatic");
 
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
+
+void sane_kds_s2000w_net_control_get_option_twentysix_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, 26, SANE_ACTION_GET_VALUE, &value, NULL);
+
+       assert_string_equal(value, "None");
+
        kds_s2000w_handler_free(h);
        h = NULL;
 }
\ No newline at end of file
index 7ada635493b19a5ecba8444c488856d3f9d5d4c6..9decedbeac62a1e2c4f198160fee38ea7bacec98 100644 (file)
@@ -30,5 +30,6 @@ 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_twentyfour_test(void** state);
 void sane_kds_s2000w_net_control_get_option_twentyfive_test(void** state);
+void sane_kds_s2000w_net_control_get_option_twentysix_test(void** state);
 
 #endif
\ No newline at end of file
index 73a61c1995907ef5597d4abfb17328fe09a01ffa..d1c15dbbf9059fa62a1c12c029d6d6c469894afd 100644 (file)
@@ -99,7 +99,8 @@ int main()
                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_twentyfour_test, setup_default_get_option, teardown_default_get_option),
-               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentyfive_test, setup_default_get_option, teardown_default_get_option)
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentyfive_test, setup_default_get_option, teardown_default_get_option),
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentysix_test, setup_default_get_option, teardown_default_get_option)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);