From d13c21f6f3433ded5c7d82a5ee3f65382a529e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eberhard=20Gr=C3=A4ther?= Date: Sun, 29 Mar 2020 23:32:49 +0200 Subject: [PATCH] ui/test: Manual testing fixes (#949) * Fixed tooltip list items not activated on click * Fixed crash when clearing focused graph edges after displaying graph with no edges * Updated and fixed manual graph view tests * Fixed previous location refocused when activating local symbol * Fixed crash in graph view after showing empty graph --- .../component/controller/CodeController.cpp | 1 + src/lib_gui/qt/element/code/QtCodeField.cpp | 5 +++ src/lib_gui/qt/graphics/graph/QtGraphEdge.cpp | 10 +++-- src/lib_gui/qt/graphics/graph/QtGraphEdge.h | 1 + src/lib_gui/qt/view/QtGraphView.cpp | 22 ++++++++-- src/lib_gui/qt/view/QtGraphView.h | 1 + testing/graph_view/data/controls_tests.cpp | 8 ++-- .../graph_view/data/custom_trail_tests.cpp | 8 ++-- testing/graph_view/data/depth_graph_tests.cpp | 2 +- testing/graph_view/data/overview_tests.cpp | 41 +------------------ .../search_view/search_view_tests.srctrlprj | 2 +- 11 files changed, 45 insertions(+), 56 deletions(-) diff --git a/src/lib/component/controller/CodeController.cpp b/src/lib/component/controller/CodeController.cpp index 6e598394..918b09dc 100644 --- a/src/lib/component/controller/CodeController.cpp +++ b/src/lib/component/controller/CodeController.cpp @@ -89,6 +89,7 @@ void CodeController::handleMessage(MessageActivateLocalSymbols* message) m_codeParams.activeLocalSymbolIds = message->symbolIds; m_codeParams.activeLocalSymbolType = LOCATION_LOCAL_SYMBOL; m_codeParams.currentActiveLocalLocationIds.clear(); + m_codeParams.locationIdToFocus = 0; showFiles(m_codeParams, CodeScrollParams(), !message->isReplayed()); } diff --git a/src/lib_gui/qt/element/code/QtCodeField.cpp b/src/lib_gui/qt/element/code/QtCodeField.cpp index 35a5f34d..9a5b3fbf 100644 --- a/src/lib_gui/qt/element/code/QtCodeField.cpp +++ b/src/lib_gui/qt/element/code/QtCodeField.cpp @@ -10,6 +10,7 @@ #include "ColorScheme.h" #include "MessageActivateLocalSymbols.h" #include "MessageActivateSourceLocations.h" +#include "MessageActivateTokenIds.h" #include "MessageTabOpenWith.h" #include "MessageTooltipShow.h" #include "QtContextMenu.h" @@ -561,6 +562,10 @@ void QtCodeField::activateAnnotations( { MessageActivateSourceLocations(locationIds, containsUnsolved).dispatch(); } + else if (tokenIds.size()) + { + MessageActivateTokenIds(utility::toVector(tokenIds)).dispatch(); + } else if (localSymbolIds.size()) { MessageActivateLocalSymbols(utility::toVector(localSymbolIds)).dispatch(); diff --git a/src/lib_gui/qt/graphics/graph/QtGraphEdge.cpp b/src/lib_gui/qt/graphics/graph/QtGraphEdge.cpp index 8c57a6d2..bbef2f2e 100644 --- a/src/lib_gui/qt/graphics/graph/QtGraphEdge.cpp +++ b/src/lib_gui/qt/graphics/graph/QtGraphEdge.cpp @@ -32,9 +32,16 @@ void QtGraphEdge::unfocusBezierEdge() if (s_focusedBezierEdge) { s_focusedBezierEdge->coFocusOut(); + s_focusedBezierEdge = nullptr; } } +void QtGraphEdge::clearFocusedEdges() +{ + s_focusedEdge = nullptr; + s_focusedBezierEdge = nullptr; +} + QtGraphEdge::QtGraphEdge( GraphFocusHandler* focusHandler, QtGraphNode* owner, @@ -63,9 +70,6 @@ QtGraphEdge::QtGraphEdge( m_owner = m_target; m_target = temp; } - - s_focusedEdge = nullptr; - s_focusedBezierEdge = nullptr; } QtGraphEdge::~QtGraphEdge() {} diff --git a/src/lib_gui/qt/graphics/graph/QtGraphEdge.h b/src/lib_gui/qt/graphics/graph/QtGraphEdge.h index c09b8671..b1291101 100644 --- a/src/lib_gui/qt/graphics/graph/QtGraphEdge.h +++ b/src/lib_gui/qt/graphics/graph/QtGraphEdge.h @@ -23,6 +23,7 @@ class QtGraphEdge public: static void unfocusBezierEdge(); + static void clearFocusedEdges(); QtGraphEdge( GraphFocusHandler* focusHandler, diff --git a/src/lib_gui/qt/view/QtGraphView.cpp b/src/lib_gui/qt/view/QtGraphView.cpp index 0c8ebc37..11f6fed3 100644 --- a/src/lib_gui/qt/view/QtGraphView.cpp +++ b/src/lib_gui/qt/view/QtGraphView.cpp @@ -323,7 +323,7 @@ void QtGraphView::rebuildGraph( const GraphParams params) { m_onQtThread([=]() { - if (m_transition && m_transition->currentTime() < m_transition->totalDuration()) + if (isTransitioning()) { m_transition->stop(); m_transition.reset(); @@ -383,6 +383,7 @@ void QtGraphView::rebuildGraph( } m_edges.clear(); + QtGraphEdge::clearFocusedEdges(); // create edges Graph::TrailMode trailMode = m_graph ? m_graph->getTrailMode() : Graph::TRAIL_NONE; @@ -558,7 +559,7 @@ void QtGraphView::scrollToValues(int xValue, int yValue) void QtGraphView::activateEdge(Id edgeId) { m_onQtThread([=]() { - if (m_transition && m_transition->currentTime() < m_transition->totalDuration()) + if (isTransitioning()) { m_transition->stop(); m_transition.reset(); @@ -629,11 +630,21 @@ void QtGraphView::focusView(bool focusIn) const std::list& QtGraphView::getGraphNodes() const { + if (isTransitioning()) + { + return m_nodes; + } + return m_oldNodes; } const std::list& QtGraphView::getGraphEdges() const { + if (isTransitioning()) + { + return m_edges; + } + return m_oldEdges; } @@ -745,7 +756,7 @@ void QtGraphView::scrolled(int) void QtGraphView::resized() { - if (m_transition && m_transition->currentTime() < m_transition->totalDuration()) + if (isTransitioning()) { return; } @@ -1469,3 +1480,8 @@ void QtGraphView::createTransition() m_transition.get(), &QPropertyAnimation::finished, this, &QtGraphView::finishedTransition); m_transition->start(); } + +bool QtGraphView::isTransitioning() const +{ + return m_transition && m_transition->currentTime() < m_transition->totalDuration(); +} diff --git a/src/lib_gui/qt/view/QtGraphView.h b/src/lib_gui/qt/view/QtGraphView.h index c63c3eb0..9a96e875 100644 --- a/src/lib_gui/qt/view/QtGraphView.h +++ b/src/lib_gui/qt/view/QtGraphView.h @@ -144,6 +144,7 @@ private: std::vector>* remainingNodes); void createTransition(); + bool isTransitioning() const; GraphFocusHandler m_focusHandler; bool m_hasFocus = false; diff --git a/testing/graph_view/data/controls_tests.cpp b/testing/graph_view/data/controls_tests.cpp index 8dbabe07..57797e79 100644 --- a/testing/graph_view/data/controls_tests.cpp +++ b/testing/graph_view/data/controls_tests.cpp @@ -51,10 +51,10 @@ namespace image_export -// TEST: move - WASD +// TEST: move - Ctrl + Arrows // START ---------------------------------------------------------------------- -// ACTION: Use WASD to scroll up, down, left, right +// ACTION: Use Ctrl + Arrows to scroll up, down, left, right // RESULT: graph is moved // END ------------------------------------------------------------------------ @@ -81,10 +81,10 @@ namespace image_export -// TEST: zoom - Shift + WS +// TEST: zoom - Shift + Ctrl + Up/Down // START ---------------------------------------------------------------------- -// ACTION: Hold Shift and press W/S +// ACTION: Hold Shift + Ctrl and press Up/Down // RESULT: Zoom Level changes, percentage in lower left corner // END ------------------------------------------------------------------------ diff --git a/testing/graph_view/data/custom_trail_tests.cpp b/testing/graph_view/data/custom_trail_tests.cpp index 9cce341b..5d5cb11d 100644 --- a/testing/graph_view/data/custom_trail_tests.cpp +++ b/testing/graph_view/data/custom_trail_tests.cpp @@ -12,7 +12,7 @@ // ACTION 2: Close with click on Cancel // RESULT 2: dialog closes -// ACTION 3: Use custom trail shortcut Ctrl + L +// ACTION 3: Use custom trail shortcut Ctrl + U // RESULT 3: dialog opens on top of window // ACTION 4: click on main window @@ -37,7 +37,7 @@ // RESULTS 6: // - Graph shows multiple paths -// - Graph contains: CustomD -> CustomB, CustomC -> CustomA -> func -> int +// - Graph contains: CustomD -> CustomB, CustomC -> CustomA, func2 -> func -> int // Action 7: Repeat search with: // - select vertical layout @@ -46,7 +46,7 @@ // RESULTS 7: // - Graph one call chain to func // - Graph goes top to bottom -// - Graph contains: CustomD -> CustomB -> CustomA, func2 -> func -> int +// - Graph contains: CustomD -> CustomB -> CustomA -> func -> int // END ------------------------------------------------------------------------ @@ -80,6 +80,6 @@ // RESULTS 6: // - Graph shows multiple paths -// - Graph contains: CustomB, CustomC -> CustomA, func2 -> func +// - Graph contains: CustomD -> CustomB, CustomC -> CustomA, func2 -> func // END ------------------------------------------------------------------------ diff --git a/testing/graph_view/data/depth_graph_tests.cpp b/testing/graph_view/data/depth_graph_tests.cpp index 11c60847..33e2395d 100644 --- a/testing/graph_view/data/depth_graph_tests.cpp +++ b/testing/graph_view/data/depth_graph_tests.cpp @@ -31,7 +31,7 @@ void level_1_func_1() // <- ACTION 1: activate // ACTION 3: hover and click edges // RESULTS 3: -// - hover highlight in grey +// - hover highlight in focus color // - click shows source location in code // ACTION 4: Reduce graph depth to 2 diff --git a/testing/graph_view/data/overview_tests.cpp b/testing/graph_view/data/overview_tests.cpp index b81aaca0..886f45e6 100644 --- a/testing/graph_view/data/overview_tests.cpp +++ b/testing/graph_view/data/overview_tests.cpp @@ -43,44 +43,5 @@ // END ------------------------------------------------------------------------ - -// TEST: overview letter index -// START ---------------------------------------------------------------------- - -// ACTION 1: activate overview -// ACTION 2: Click on Union bundle -// ACTION 3: Press letter keys on keyboard -// RESULT 3: the graph is scrolled to the respective letter pressed - -// END ------------------------------------------------------------------------ - - - -union A_Union_Type_Name_Making_A_Long_List {}; -union B_Union_Type_Name_Making_A_Long_List {}; -union C_Union_Type_Name_Making_A_Long_List {}; -union D_Union_Type_Name_Making_A_Long_List {}; -union E_Union_Type_Name_Making_A_Long_List {}; -union F_Union_Type_Name_Making_A_Long_List {}; -union G_Union_Type_Name_Making_A_Long_List {}; -union H_Union_Type_Name_Making_A_Long_List {}; -union I_Union_Type_Name_Making_A_Long_List {}; -union J_Union_Type_Name_Making_A_Long_List {}; -union K_Union_Type_Name_Making_A_Long_List {}; -union L_Union_Type_Name_Making_A_Long_List {}; -union M_Union_Type_Name_Making_A_Long_List {}; -union N_Union_Type_Name_Making_A_Long_List {}; -union O_Union_Type_Name_Making_A_Long_List {}; -union P_Union_Type_Name_Making_A_Long_List {}; -union Q_Union_Type_Name_Making_A_Long_List {}; -union R_Union_Type_Name_Making_A_Long_List {}; -union S_Union_Type_Name_Making_A_Long_List {}; -union T_Union_Type_Name_Making_A_Long_List {}; -union U_Union_Type_Name_Making_A_Long_List {}; -union V_Union_Type_Name_Making_A_Long_List {}; -union W_Union_Type_Name_Making_A_Long_List {}; -union X_Union_Type_Name_Making_A_Long_List {}; -union Y_Union_Type_Name_Making_A_Long_List {}; -union Z_Union_Type_Name_Making_A_Long_List {}; - +union A_Union_Type {}; int global_variable; diff --git a/testing/search_view/search_view_tests.srctrlprj b/testing/search_view/search_view_tests.srctrlprj index 925879bb..1d591faa 100644 --- a/testing/search_view/search_view_tests.srctrlprj +++ b/testing/search_view/search_view_tests.srctrlprj @@ -29,5 +29,5 @@ C++ Source Group - 7 + 8