]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change image processing option group position
authorBastian Dehn <hhaalo@arcor.de>
Tue, 18 Feb 2025 16:10:15 +0000 (17:10 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 18 Feb 2025 16:10:15 +0000 (17:10 +0100)
src/kds_s2000w_handler_opts.c
src/kds_s2000w_option_descriptors.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
tests/kds_s2000w_option_descriptor_tests.c

index fa36f030c470c3d50666ac1f68581ce11db67848..e21aaaa707316e27202e521eddd5ac746fe837ca 100644 (file)
@@ -246,10 +246,6 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "BinarizationContrast");
                        _kds_s2000w_handler_opts_write_int_value(value_object, value);
                        break;
-               case 32:
-                       value_object = json_object_object_get(config, "JpegQuality");
-                       _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);
@@ -298,6 +294,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "SkipBlankPages");
                        _kds_s2000w_handler_opts_write_int_value(value_object, value);
                        break;
+               case 45:
+                       value_object = json_object_object_get(config, "JpegQuality");
+                       _kds_s2000w_handler_opts_write_string_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -451,10 +451,6 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                                *info = RELOAD_OPTIONS | RELOAD_PARAMS;
                        return;
                        break;
-               case 32:
-                       value_object = json_object_object_get(config, "JpegQuality");
-                       _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);
@@ -503,6 +499,10 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "SkipBlankPages");
                        _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
                        break;
+               case 45:
+                       value_object = json_object_object_get(config, "JpegQuality");
+                       _kds_s2000w_handler_opts_write_string_value_to_json(value_object, value);
+                       break;
                default:
                        break;
        }
index 01da38993e08d948fefab7b7edd411e7d216130e..3670b2b348edfce84c058de949acd079bbeb9db4 100644 (file)
@@ -1084,7 +1084,7 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_processing_group()
                SANE_TYPE_GROUP,
                SANE_UNIT_NONE,
                0,
-               SANE_CAP_SOFT_DETECT,
+               SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED,
                SANE_CONSTRAINT_NONE
        };
 
@@ -1128,7 +1128,7 @@ void kds_s2000w_option_descriptors_init()
        descriptor_array[29] = _kds_s2000w_option_descriptor_color_sharpen();
        descriptor_array[30] = _kds_s2000w_option_descriptor_binarization_contrast();
        descriptor_array[31] = _kds_s2000w_option_descriptor_config_reset();
-       descriptor_array[32] = _kds_s2000w_option_descriptor_jpeg_quality();
+       descriptor_array[32] = _kds_s2000w_option_descriptor_image_processing_group();
        descriptor_array[33] = _kds_s2000w_option_descriptor_skip_blank_page_content();
        descriptor_array[34] = _kds_s2000w_option_descriptor_multifeed_sensitivity();
        descriptor_array[35] = _kds_s2000w_option_descriptor_max_document_length();
@@ -1141,7 +1141,7 @@ void kds_s2000w_option_descriptors_init()
        descriptor_array[42] = _kds_s2000w_option_descriptor_edge_fill();
        descriptor_array[43] = _kds_s2000w_option_descriptor_transport_handling();
        descriptor_array[44] = _kds_s2000w_option_descriptor_skip_blank_pages();
-       descriptor_array[45] = _kds_s2000w_option_descriptor_image_processing_group();
+       descriptor_array[45] = _kds_s2000w_option_descriptor_jpeg_quality();
 }
 
 void kds_s2000w_option_descriptors_free()
index 1bfa8f2590e081ab9bc13f78e8e4d69e217c3338..06ab7a4d4389ceb675b4f262bd513bbece8f01a0 100644 (file)
@@ -420,21 +420,6 @@ void sane_kds_s2000w_net_control_get_option_thirdy_test(void** state)
        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, "Good");
-
-       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();
@@ -611,6 +596,21 @@ void sane_kds_s2000w_net_control_get_option_fourtyfour_test(void** state)
 
        assert_int_equal(value, 0);
 
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
+
+void sane_kds_s2000w_net_control_get_option_fourtyfive_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, 45, SANE_ACTION_GET_VALUE, &value, NULL);
+
+       assert_string_equal(value, "Good");
+
        kds_s2000w_handler_free(h);
        h = NULL;
 }
\ No newline at end of file
index d7a389dfcb0ad2b071e0f71854d4ac03a4059677..9e5c1b0b0bd060433d9f3ad702ad861af0abd0b4 100644 (file)
@@ -33,7 +33,6 @@ void sane_kds_s2000w_net_control_get_option_twentyseven_test(void** state);
 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_thirdytwo_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdythree_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdyfour_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdyfive_test(void** state);
@@ -46,5 +45,6 @@ void sane_kds_s2000w_net_control_get_option_fourtyone_test(void** state);
 void sane_kds_s2000w_net_control_get_option_fourtytwo_test(void** state);
 void sane_kds_s2000w_net_control_get_option_fourtythree_test(void** state);
 void sane_kds_s2000w_net_control_get_option_fourtyfour_test(void** state);
+void sane_kds_s2000w_net_control_get_option_fourtyfive_test(void** state);
 
 #endif
\ No newline at end of file
index abaf83d5ef01fca6393b4eb5496ef1f9d43dfaea..f4a28d530ff2e5b1ff3f1c585cc6ce123d5c6b9e 100644 (file)
@@ -107,7 +107,6 @@ 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_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),
                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),
@@ -119,7 +118,8 @@ int main()
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtyone_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtytwo_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtythree_test, setup_default_get_option, teardown_default_get_option),
-               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtyfour_test, setup_default_get_option, teardown_default_get_option)
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtyfour_test, setup_default_get_option, teardown_default_get_option),
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_fourtyfive_test, setup_default_get_option, teardown_default_get_option)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);
index a71e4772a49930f495203d2b4354db8b6891f75c..c1189c406b84f98d3371acb68aaab9797d3c4f6e 100644 (file)
@@ -569,20 +569,14 @@ void kds_s2000w_option_get_descriptor_thirdytwo_test()
 {
        SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(32);
 
-       assert_string_equal("jpeg-quality", option->name);
-       assert_string_equal("jpeg quality", option->title);
-       assert_string_equal("jpeg quality", option->desc);
-       assert_int_equal(SANE_TYPE_STRING, option->type);
+       assert_string_equal("image-processing-options", option->name);
+       assert_string_equal("Image Processing Options", option->title);
+       assert_string_equal("Image Processing Options", option->desc);
+       assert_int_equal(SANE_TYPE_GROUP, option->type);
        assert_int_equal(SANE_UNIT_NONE, option->unit);
-       assert_int_equal(sizeof(SANE_String_Const*) * 6, option->size);
-       assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, option->cap);
-       assert_int_equal(SANE_CONSTRAINT_STRING_LIST, option->constraint_type);
-       assert_string_equal("Draft", option->constraint.string_list[0]);
-       assert_string_equal("Good", option->constraint.string_list[1]);
-       assert_string_equal("Better", option->constraint.string_list[2]);
-       assert_string_equal("Best", option->constraint.string_list[3]);
-       assert_string_equal("Superior", option->constraint.string_list[4]);
-       assert_null(option->constraint.string_list[5]);
+       assert_int_equal(0,  option->size);
+       assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_ADVANCED, option->cap);
+       assert_int_equal(SANE_CONSTRAINT_NONE, option->constraint_type);
 }
 
 void kds_s2000w_option_get_descriptor_thirdythree_test()
@@ -797,14 +791,20 @@ void kds_s2000w_option_get_descriptor_fourtyfive_test()
 {
        SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(45);
 
-       assert_string_equal("image-processing-options", option->name);
-       assert_string_equal("Image Processing Options", option->title);
-       assert_string_equal("Image Processing Options", option->desc);
-       assert_int_equal(SANE_TYPE_GROUP, option->type);
+       assert_string_equal("jpeg-quality", option->name);
+       assert_string_equal("jpeg quality", option->title);
+       assert_string_equal("jpeg quality", option->desc);
+       assert_int_equal(SANE_TYPE_STRING, option->type);
        assert_int_equal(SANE_UNIT_NONE, option->unit);
-       assert_int_equal(0,  option->size);
-       assert_int_equal(SANE_CAP_SOFT_DETECT, option->cap);
-       assert_int_equal(SANE_CONSTRAINT_NONE, option->constraint_type);
+       assert_int_equal(sizeof(SANE_String_Const*) * 6, option->size);
+       assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED, option->cap);
+       assert_int_equal(SANE_CONSTRAINT_STRING_LIST, option->constraint_type);
+       assert_string_equal("Draft", option->constraint.string_list[0]);
+       assert_string_equal("Good", option->constraint.string_list[1]);
+       assert_string_equal("Better", option->constraint.string_list[2]);
+       assert_string_equal("Best", option->constraint.string_list[3]);
+       assert_string_equal("Superior", option->constraint.string_list[4]);
+       assert_null(option->constraint.string_list[5]);
 }
 
 void kds_s2000w_option_get_descriptor_get_by_name_test()