]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option cropping image
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 11:02:17 +0000 (12:02 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 11:02:17 +0000 (12:02 +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 74d813dad77ba069cf211930a11a4f383ed53282..9b59199f9ed269e856bd2c801476025fd76f73fa 100644 (file)
@@ -5,7 +5,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 33
+#define OPTION_COUNT 34
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
@@ -241,6 +241,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "CroppingMode");
                        _kds_s2000w_handler_opts_write_string_value(value_object, value);
                        break;
+               case 32:
+                       value_object = json_object_object_get(config, "CroppingImage");
+                       _kds_s2000w_handler_opts_write_string_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -394,6 +398,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 32:
+                       value_object = json_object_object_get(config, "CroppingImage");
+                       _kds_s2000w_handler_opts_write_string_value_to_json(value_object, value);
+                       break;
+               case 33:
                        _kds_s2000w_handler_opts_set_option_to_default(h);
                        _kds_s2000w_handler_opts_set_autostart_on(h);
 
index 84399c8f532cc316cbc000930a3f2a6054e87b10..187c1d38bc2b57a3056f3447e5fe6197164bdf54 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, 33);
+       assert_int_equal(value, 34);
 
        kds_s2000w_handler_free(h);
        h = NULL;
@@ -459,6 +459,21 @@ void sane_kds_s2000w_net_control_get_option_thirdyone_test(void** state)
 
        assert_string_equal(value, "AutomaticStraighten");
 
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
+
+void sane_kds_s2000w_net_control_get_option_thirdytwo_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, 32, SANE_ACTION_GET_VALUE, &value, NULL);
+
+       assert_string_equal(value, "EntireDocument");
+
        kds_s2000w_handler_free(h);
        h = NULL;
 }
\ No newline at end of file
index ad55d2e1166a47d3e5a64bf4b753be11b3d11154..b86873bf198e362ddedf0a4fbcf89d388d5c7790 100644 (file)
@@ -36,5 +36,6 @@ void sane_kds_s2000w_net_control_get_option_twentyeight_test(void** state);
 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);
 
 #endif
\ No newline at end of file
index abe677ee5ae007ad0faaa90bf11e9e0eadd6a5fa..e71af38730c283ee55a03d98bcb246229d25978b 100644 (file)
@@ -105,7 +105,8 @@ int main()
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentyeight_test, setup_default_get_option, teardown_default_get_option),
                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_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)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);