From eb82f341703f47d9429f931fc56d115fe4bfb744 Mon Sep 17 00:00:00 2001 From: ThomasGoering <62179683+ThomasGoering@users.noreply.github.com> Date: Mon, 25 Mar 2024 18:12:20 +0100 Subject: [PATCH 1/2] AutoTest tool UI fixes - Test case preferences (in drop down menu) is now disabled when the system is not valid. - Generate tests for open classes is now disabled when there are no open classes. - Create test case (left most button in toolbar) and create manual test (in drop down menu) now don't report an exception when no system is available or the compiler is already running. --- .../tools/testing/es_testing_tool_panel.e | 94 +++++++++++-------- 1 file changed, 55 insertions(+), 39 deletions(-) diff --git a/Src/Eiffel/interface/graphical/tools/testing/es_testing_tool_panel.e b/Src/Eiffel/interface/graphical/tools/testing/es_testing_tool_panel.e index 7c9e82b47d8..914ae0f771b 100644 --- a/Src/Eiffel/interface/graphical/tools/testing/es_testing_tool_panel.e +++ b/Src/Eiffel/interface/graphical/tools/testing/es_testing_tool_panel.e @@ -243,7 +243,7 @@ feature {NONE} -- Access: test creation create l_item.make_with_text_and_action (locale.translation (generate_all_text) + l_suffix, agent on_generate_test (l_launch_wizard)) Result.extend (l_item) - if not l_system_valid then + if not l_system_valid or else open_classes.is_empty then -- Can only be used if we have a valid system. l_item.disable_sensitive end @@ -271,6 +271,10 @@ feature {NONE} -- Access: test creation create l_item.make_with_text_and_action (locale.translation (preferences_text) + "...", agent on_launch_creation_preferences) + if not l_system_valid then + -- Can only be used if we have a valid system. + l_item.disable_sensitive + end Result.extend (l_item) end @@ -307,6 +311,38 @@ feature {NONE} -- Status setting: stones end end +feature {NONE} -- Query + + open_classes: STRING + -- Classes currently open in editor pane + do + create Result.make (200) + if attached window_manager.windows as l_windows then + if attached {EB_DEVELOPMENT_WINDOW} l_windows.item as l_window and then l_window.is_interface_usable then + if attached l_window.editors_manager.editors as l_editors then + from l_editors.start until l_editors.after loop + if + attached l_editors.item as l_editor and then + l_editor.is_interface_usable and then + attached {CLASSI_STONE} l_editor.stone as l_class + then + -- We have the class stone + if attached l_class.class_i as l_class_i then + if l_class_i.is_compiled then + if not Result.is_empty then + Result.append_character (',') + end + Result.append (l_class_i.name) + end + end + end + l_editors.forth + end + end + end + end + end + feature -- Basic operations set_test_tree_filter (a_filter: STRING_GENERAL) @@ -326,22 +362,26 @@ feature {NONE} -- Events: test creation -- -- `a_launch_wizard': True if wizard should be launched in advance, False otherwise. local + l_system_available: BOOLEAN l_composition: ES_TEST_WIZARD_COMPOSITION l_wizard: ES_TEST_LAUNCH_WIZARD l_launch: BOOLEAN do - if a_launch_wizard then - create l_composition.make (locale.translation ("Create manual test"), {ARRAY [ES_TEST_WIZARD_PAGE]} << - create {ES_TEST_MANUAL_WIZARD_PAGE}, - create {ES_TEST_TAGS_WIZARD_PAGE}, - create {ES_TEST_GENERAL_WIZARD_PAGE} >>) - create l_wizard.make (l_composition, develop_window.window) - l_launch := l_wizard.is_launch_requested - else - l_launch := True - end - if l_launch and attached session_manager.service as l_service then - launch_session_type ({ETEST_MANUAL_CREATION}, agent launch_manual_test_creation (?, l_service)) + l_system_available := Workbench.is_in_stable_state and then not Workbench.is_compiling + if l_system_available then + if a_launch_wizard then + create l_composition.make (locale.translation ("Create manual test"), {ARRAY [ES_TEST_WIZARD_PAGE]} << + create {ES_TEST_MANUAL_WIZARD_PAGE}, + create {ES_TEST_TAGS_WIZARD_PAGE}, + create {ES_TEST_GENERAL_WIZARD_PAGE} >>) + create l_wizard.make (l_composition, develop_window.window) + l_launch := l_wizard.is_launch_requested + else + l_launch := True + end + if l_launch and attached session_manager.service as l_service then + launch_session_type ({ETEST_MANUAL_CREATION}, agent launch_manual_test_creation (?, l_service)) + end end end @@ -355,31 +395,7 @@ feature {NONE} -- Events: test creation l_launch: BOOLEAN l_types: STRING do - create l_types.make (200) - if attached window_manager.windows as l_windows then - if attached {EB_DEVELOPMENT_WINDOW} l_windows.item as l_window and then l_window.is_interface_usable then - if attached l_window.editors_manager.editors as l_editors then - from l_editors.start until l_editors.after loop - if - attached l_editors.item as l_editor and then - l_editor.is_interface_usable and then - attached {CLASSI_STONE} l_editor.stone as l_class - then - -- We have the class stone - if attached l_class.class_i as l_class_i then - if l_class_i.is_compiled then - if not l_types.is_empty then - l_types.append_character (',') - end - l_types.append (l_class_i.name) - end - end - end - l_editors.forth - end - end - end - end + l_types := open_classes if not l_types.is_empty and attached session_manager.service as l_session_service then l_session_service.retrieve (True).set_value (l_types, {TEST_SESSION_CONSTANTS}.temporary_types) if a_launch_wizard then @@ -768,7 +784,7 @@ feature {NONE} -- Internationalization tt_debug_selected: STRING = "Run selected tests" note - copyright: "Copyright (c) 1984-2018, Eiffel Software" + copyright: "Copyright (c) 1984-2024, Eiffel Software" license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" licensing_options: "http://www.eiffel.com/licensing" copying: "[ From e2412c3a586d8ce09efb26b3b466ae0668edb115 Mon Sep 17 00:00:00 2001 From: ThomasGoering <62179683+ThomasGoering@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:23:30 +0200 Subject: [PATCH 2/2] AutoTest tool test class location selection fix Folders under recursive clusters are displayed in the location tree for the test classes. But selecting these folders did not store the path correctly. This is now fixed. --- .../pages/es_test_general_wizard_page_panel.e | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Src/Eiffel/interface/graphical/tools/testing/wizard/pages/es_test_general_wizard_page_panel.e b/Src/Eiffel/interface/graphical/tools/testing/wizard/pages/es_test_general_wizard_page_panel.e index 01c3ba215bb..c3e1c5e0933 100644 --- a/Src/Eiffel/interface/graphical/tools/testing/wizard/pages/es_test_general_wizard_page_panel.e +++ b/Src/Eiffel/interface/graphical/tools/testing/wizard/pages/es_test_general_wizard_page_panel.e @@ -101,7 +101,8 @@ feature {NONE} -- Initialization initialize_with_session (a_service: SESSION_MANAGER_S) -- local - l_name, l_path: STRING + l_name: STRING + l_path: READABLE_STRING_32 l_cluster: detachable CONF_CLUSTER l_global_session, l_session: SESSION_I do @@ -123,7 +124,7 @@ feature {NONE} -- Initialization class_name.set_text (l_name) if - attached {STRING} l_session.value_or_default ({TEST_SESSION_CONSTANTS}.cluster_name, + attached {READABLE_STRING_32} l_session.value_or_default ({TEST_SESSION_CONSTANTS}.cluster_name, {TEST_SESSION_CONSTANTS}.cluster_name_default) as l_cluster_name then if not l_cluster_name.is_empty then @@ -133,7 +134,7 @@ feature {NONE} -- Initialization if l_cluster /= Void then l_path := {TEST_SESSION_CONSTANTS}.path_default - if attached {STRING} l_session.value ({TEST_SESSION_CONSTANTS}.path) as l_spath then + if attached {READABLE_STRING_32} l_session.value ({TEST_SESSION_CONSTANTS}.path) as l_spath then l_path := l_spath end class_tree.show_subfolder (l_cluster, l_path) @@ -165,7 +166,7 @@ feature {NONE} -- Access create Result end - selected_cluster: detachable STRING + selected_cluster: detachable IMMUTABLE_STRING_32 -- Name of selected cluster, Void if no cluster is selected selected_path: detachable IMMUTABLE_STRING_32 @@ -244,16 +245,16 @@ feature {ES_TEST_WIZARD_PAGE} -- Basic operations -- local l_global_session, l_session: SESSION_I - l_cluster, l_path: STRING + l_cluster, l_path: READABLE_STRING_32 do l_session := a_service.retrieve (True) l_global_session := a_service.retrieve (False) l_session.set_value (class_name.text.to_string_8, {TEST_SESSION_CONSTANTS}.class_name) l_cluster := {TEST_SESSION_CONSTANTS}.cluster_name_default l_path := {TEST_SESSION_CONSTANTS}.path_default - if attached {STRING} selected_cluster as l_scluster then + if attached {READABLE_STRING_32} selected_cluster as l_scluster then l_cluster := l_scluster - if attached {STRING} selected_path as l_spath then + if attached {READABLE_STRING_32} selected_path as l_spath then l_path := l_spath end end @@ -271,7 +272,7 @@ feature {NONE} -- Internationalization launch_wizard_text: STRING = "Always show wizard before launching test creation" note - copyright: "Copyright (c) 1984-2020, Eiffel Software" + copyright: "Copyright (c) 1984-2024, Eiffel Software" license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" licensing_options: "http://www.eiffel.com/licensing" copying: "[