]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option skip blank page content
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 13:17:33 +0000 (14:17 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 13:32:39 +0000 (14:32 +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 afc24741291c67fc02538ec998999ceeac160b5a..5f356d9898a78833a696f0fa2b4bb63691083e9c 100644 (file)
@@ -6,7 +6,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 34
+#define OPTION_COUNT 35
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
@@ -262,6 +262,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "CroppingImage");
                        _kds_s2000w_handler_opts_write_string_value(value_object, value);
                        break;
+               case 33:
+                       value_object = json_object_object_get(config, "SkipBlankPagesContent");
+                       _kds_s2000w_handler_opts_write_int_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -298,7 +302,6 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                case 3:
                        value_object = json_object_object_get(config, "ColorMode");
                        _kds_s2000w_handler_opts_write_string_value_to_json(value_object, value);
-                       value_object = NULL;
 
                        if (info != NULL)
                                *info = RELOAD_PARAMS;
@@ -310,12 +313,10 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                case 5:
                        value_object = json_object_object_get(config, "ScanSide");
                        _kds_s2000w_handler_opts_write_string_value_to_json(value_object, value);
-                       value_object = NULL;
                        break;
                case 7:
                        value_object = json_object_object_get(config, "SkipBlankPages");
                        _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
-                       value_object = NULL;
                        break;
                case 8:
                        value_object = json_object_object_get(config, "ColorDropOut");
@@ -408,7 +409,6 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                case 30:
                        value_object = json_object_object_get(config, "HoleFill");
                        _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
-                       value_object = NULL;
                        break;
                case 31:
                        value_object = json_object_object_get(config, "CroppingMode");
@@ -425,6 +425,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 33:
+                       value_object = json_object_object_get(config, "SkipBlankPagesContent");
+                       _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
+                       break;
+               case 34:
                        _kds_s2000w_handler_opts_set_option_to_default(h);
                        _kds_s2000w_handler_opts_set_autostart_on(h);
 
index 187c1d38bc2b57a3056f3447e5fe6197164bdf54..957cfa66e9c3afdd5ea258c1c088b89d4c544c97 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, 34);
+       assert_int_equal(value, 35);
 
        kds_s2000w_handler_free(h);
        h = NULL;
@@ -474,6 +474,21 @@ void sane_kds_s2000w_net_control_get_option_thirdytwo_test(void** state)
 
        assert_string_equal(value, "EntireDocument");
 
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
+
+void sane_kds_s2000w_net_control_get_option_thirdythree_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, 33, SANE_ACTION_GET_VALUE, &value, NULL);
+
+       assert_int_equal(value, 5);
+
        kds_s2000w_handler_free(h);
        h = NULL;
 }
\ No newline at end of file
index b86873bf198e362ddedf0a4fbcf89d388d5c7790..29540dea59718c2134da517b07bb920a606531ae 100644 (file)
@@ -37,5 +37,6 @@ void sane_kds_s2000w_net_control_get_option_twentynine_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdy_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdyone_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdytwo_test(void** state);
+void sane_kds_s2000w_net_control_get_option_thirdythree_test(void** state);
 
 #endif
\ No newline at end of file
index e71af38730c283ee55a03d98bcb246229d25978b..8dbb28ba37e893300d7c36003ec81bdc17f914e7 100644 (file)
@@ -106,7 +106,8 @@ int main()
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentynine_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdy_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyone_test, setup_default_get_option, teardown_default_get_option),
-               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdytwo_test, setup_default_get_option, teardown_default_get_option)
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdytwo_test, setup_default_get_option, teardown_default_get_option),
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdythree_test, setup_default_get_option, teardown_default_get_option)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);