##// END OF EJS Templates
Some test refac and prepared synchronized graph test...
jeandet -
r1369:8a5759a257ef
parent child
Show More
@@ -1,3 +1,3
1 subdirs(GUITestUtils)
1 subdirs(GUITestUtils)
2 declare_test(simple_graph simple_graph simple_graph/main.cpp "sciqlopgui;TestUtils;GUITestUtils;Qt5::Test")
2 declare_test(simple_graph simple_graph simple_graph/main.cpp "sciqlopgui;TestUtils;GUITestUtils;Qt5::Test")
3 declare_test(two_sync_graph two_sync_graph two_sync_graph/main.cpp "sciqlopgui;TestUtils;GUITestUtils;Qt5::Test")
3 declare_test(multiple_sync_graph multiple_sync_graph multiple_sync_graph/main.cpp "sciqlopgui;TestUtils;GUITestUtils;Qt5::Test")
@@ -1,148 +1,151
1 #ifndef GUITESTUTILS_H
1 #ifndef GUITESTUTILS_H
2 #define GUITESTUTILS_H
2 #define GUITESTUTILS_H
3
3
4 #include <Common/cpp_utils.h>
4 #include <Common/cpp_utils.h>
5 #include <QPoint>
5 #include <QPoint>
6 #include <QCursor>
6 #include <QCursor>
7 #include <QMouseEvent>
7 #include <QMouseEvent>
8 #include <QCoreApplication>
8 #include <QCoreApplication>
9 #include <QtTest>
9 #include <QtTest>
10 #include <QDesktopWidget>
10 #include <QDesktopWidget>
11
11
12 #include <qcustomplot.h>
12 #include <qcustomplot.h>
13
13
14 template <typename T>
14 template <typename T>
15 QPoint center(T* widget)
15 QPoint center(T* widget)
16 {
16 {
17 return QPoint{widget->width()/2,widget->height()/2};
17 return QPoint{widget->width()/2,widget->height()/2};
18 }
18 }
19
19
20 HAS_METHOD(viewport)
20 HAS_METHOD(viewport)
21
21
22 template <typename T>
22 template <typename T>
23 static inline constexpr bool is_QWidgetOrDerived = std::is_base_of<QWidget,T>::value;
23 static inline constexpr bool is_QWidgetOrDerived = std::is_base_of<QWidget,T>::value;
24
24
25 template <typename T> using viewport_type = decltype(std::declval<T>().viewport());
25 template <typename T> using viewport_type = decltype(std::declval<T>().viewport());
26
26
27 HAS_METHOD(topLevelItem)
27 HAS_METHOD(topLevelItem)
28
28
29 template<typename T>
29 template<typename T>
30 void mouseMove(T* widget, QPoint pos, Qt::MouseButton mouseModifier)
30 void mouseMove(T* widget, QPoint pos, Qt::MouseButton mouseModifier)
31 {
31 {
32 QCursor::setPos(widget->mapToGlobal(pos));
32 QCursor::setPos(widget->mapToGlobal(pos));
33 QMouseEvent event(QEvent::MouseMove, pos, Qt::NoButton, mouseModifier, Qt::NoModifier);
33 QMouseEvent event(QEvent::MouseMove, pos, Qt::NoButton, mouseModifier, Qt::NoModifier);
34 if constexpr(has_viewport<T>)
34 if constexpr(has_viewport<T>)
35 {
35 {
36 if constexpr(is_QWidgetOrDerived<viewport_type<T>>)
36 if constexpr(is_QWidgetOrDerived<viewport_type<T>>)
37 {
37 {
38 qApp->sendEvent(widget->viewport(), &event);
38 qApp->sendEvent(widget->viewport(), &event);
39 }
39 }
40 else
40 else
41 {
41 {
42 qApp->sendEvent(widget, &event);
42 qApp->sendEvent(widget, &event);
43 }
43 }
44 }
44 }
45 else
45 else
46 {
46 {
47 qApp->sendEvent(widget, &event);
47 qApp->sendEvent(widget, &event);
48 }
48 }
49 qApp->processEvents();
49 qApp->processEvents();
50 }
50 }
51
51
52
52
53 template <typename T>
53 template <typename T>
54 void setMouseTracking(T* widget)
54 void setMouseTracking(T* widget)
55 {
55 {
56 if constexpr(has_viewport<T>)
56 if constexpr(has_viewport<T>)
57 {
57 {
58 if constexpr(is_QWidgetOrDerived<viewport_type<T>>)
58 if constexpr(is_QWidgetOrDerived<viewport_type<T>>)
59 {
59 {
60 widget->viewport()->setMouseTracking(true);
60 widget->viewport()->setMouseTracking(true);
61 }
61 }
62 else
62 else
63 {
63 {
64 widget->setMouseTracking(true);
64 widget->setMouseTracking(true);
65 }
65 }
66 }
66 }
67 else
67 else
68 {
68 {
69 widget->setMouseTracking(true);
69 widget->setMouseTracking(true);
70 }
70 }
71 }
71 }
72
72
73 template <typename T, typename T2>
73 template <typename T, typename T2>
74 auto getItem(T* widget, T2 itemIndex)
74 auto getItem(T* widget, T2 itemIndex)
75 {
75 {
76 if constexpr(has_topLevelItem<T>)
76 if constexpr(has_topLevelItem<T>)
77 {
77 {
78 return widget->topLevelItem(itemIndex);
78 return widget->topLevelItem(itemIndex);
79 }
79 }
80 else
80 else
81 {
81 {
82 return widget->item(itemIndex);
82 return widget->item(itemIndex);
83 }
83 }
84 }
84 }
85
85
86 #define SELECT_ITEM(widget, itemIndex, item)\
86 #define SELECT_ITEM(widget, itemIndex, item)\
87 auto item = getItem(widget, itemIndex);\
87 auto item = getItem(widget, itemIndex);\
88 {\
88 {\
89 auto itemCenterPos = widget->visualItemRect(item).center();\
89 auto itemCenterPos = widget->visualItemRect(item).center();\
90 QTest::mouseClick(widget->viewport(), Qt::LeftButton, Qt::NoModifier, itemCenterPos);\
90 QTest::mouseClick(widget->viewport(), Qt::LeftButton, Qt::NoModifier, itemCenterPos);\
91 QVERIFY(widget->selectedItems().size() > 0);\
91 QVERIFY(widget->selectedItems().size() > 0);\
92 QVERIFY(widget->selectedItems().contains(item));\
92 QVERIFY(widget->selectedItems().contains(item));\
93 }
93 }
94
94
95
95
96 #define GET_CHILD_WIDGET_FOR_GUI_TESTS(parent, child, childType, childName)\
96 #define GET_CHILD_WIDGET_FOR_GUI_TESTS(parent, child, childType, childName)\
97 childType* child = parent.findChild<childType*>(childName); \
97 childType* child = parent.findChild<childType*>(childName); \
98 QVERIFY(child!=Q_NULLPTR); \
98 QVERIFY(child!=Q_NULLPTR); \
99 setMouseTracking(child);
99 setMouseTracking(child);
100
100
101 template<typename T1, typename T2, typename T3, typename T4=void>
101 template<typename T1, typename T2, typename T3, typename T4=void>
102 void dragnDropItem(T1* sourceWidget, T2* destWidget, T3* item, T4* destItem=Q_NULLPTR)
102 void dragnDropItem(T1* sourceWidget, T2* destWidget, T3* item, T4* destItem=Q_NULLPTR)
103 {
103 {
104 auto itemCenterPos = sourceWidget->visualItemRect(item).center();
104 auto itemCenterPos = sourceWidget->visualItemRect(item).center();
105 if constexpr(has_viewport<T1>)
105 if constexpr(has_viewport<T1>)
106 {
106 {
107 QTest::mousePress(sourceWidget->viewport(), Qt::LeftButton, Qt::NoModifier, itemCenterPos);
107 QTest::mousePress(sourceWidget->viewport(), Qt::LeftButton, Qt::NoModifier, itemCenterPos);
108 }
108 }
109 else
109 else
110 {
110 {
111 QTest::mousePress(sourceWidget, Qt::LeftButton, Qt::NoModifier, itemCenterPos);
111 QTest::mousePress(sourceWidget, Qt::LeftButton, Qt::NoModifier, itemCenterPos);
112 }
112 }
113 mouseMove(sourceWidget,itemCenterPos, Qt::LeftButton);
113 mouseMove(sourceWidget,itemCenterPos, Qt::LeftButton);
114 itemCenterPos+=QPoint(0,-10);
114 itemCenterPos+=QPoint(0,-10);
115 QTimer::singleShot(100,[destWidget,destItem](){
115 QTimer::singleShot(100,[destWidget,destItem](){
116 mouseMove(destWidget, destWidget->rect().center(),Qt::LeftButton);
116 mouseMove(destWidget, destWidget->rect().center(),Qt::LeftButton);
117 mouseMove(destWidget, destWidget->rect().center()+QPoint(0,-10),Qt::LeftButton);
117 mouseMove(destWidget, destWidget->rect().center()+QPoint(0,-10),Qt::LeftButton);
118 if constexpr(!std::is_same_v<void, T4>)
118 if constexpr(!std::is_same_v<void, T4>)
119 {
119 {
120 auto destItemCenterPos = destWidget->visualItemRect(destItem).center();
120 auto destItemCenterPos = destWidget->visualItemRect(destItem).center();
121 QTest::mouseRelease(destWidget, Qt::LeftButton, Qt::NoModifier, destItemCenterPos);
121 QTest::mouseRelease(destWidget, Qt::LeftButton, Qt::NoModifier, destItemCenterPos);
122 }
122 }
123 else if constexpr(has_viewport<T2>)
123 else if constexpr(has_viewport<T2>)
124 {
124 {
125 QTest::mouseRelease(destWidget->viewport(), Qt::LeftButton);
125 QTest::mouseRelease(destWidget->viewport(), Qt::LeftButton);
126 }
126 }
127 else
127 else
128 {
128 {
129 QTest::mouseRelease(destWidget, Qt::LeftButton);
129 QTest::mouseRelease(destWidget, Qt::LeftButton);
130 }
130 }
131 QTest::mouseRelease(destWidget->viewport(), Qt::LeftButton);
131 QTest::mouseRelease(destWidget->viewport(), Qt::LeftButton);
132 });
132 });
133 mouseMove(sourceWidget,itemCenterPos,Qt::LeftButton);
133 mouseMove(sourceWidget,itemCenterPos,Qt::LeftButton);
134 }
134 }
135
135
136 #define PREPARE_GUI_TEST(main_widget)\
136 template<typename T>
137 main_widget.setGeometry(QRect(QPoint(QApplication::desktop()->geometry().center() - QPoint(250, 250)),\
137 bool prepare_gui_test(T* w)
138 QSize(500, 500)));\
138 {
139 main_widget.show();\
139 w->setGeometry(QRect(QPoint(QApplication::desktop()->geometry().center() - QPoint(250, 250)),
140 qApp->setActiveWindow(&main_widget);\
140 QSize(500, 500)));
141 QVERIFY(QTest::qWaitForWindowActive(&main_widget))
141 w->show();
142 qApp->setActiveWindow(w);
143 return QTest::qWaitForWindowActive(w);
144 }
142
145
143 #define GET_CHILD_WIDGET_FOR_GUI_TESTS(parent, child, childType, childName)\
146 #define GET_CHILD_WIDGET_FOR_GUI_TESTS(parent, child, childType, childName)\
144 childType* child = parent.findChild<childType*>(childName); \
147 childType* child = parent.findChild<childType*>(childName); \
145 QVERIFY(child!=Q_NULLPTR); \
148 QVERIFY(child!=Q_NULLPTR); \
146 setMouseTracking(child);
149 setMouseTracking(child);
147
150
148 #endif
151 #endif
@@ -1,87 +1,104
1 #include <QtTest>
1 #include <QtTest>
2 #include <QObject>
2 #include <QObject>
3 #include <QString>
3 #include <QString>
4 #include <QScreen>
4 #include <QScreen>
5 #include <QMainWindow>
5 #include <QMainWindow>
6 #include <QWheelEvent>
6 #include <QWheelEvent>
7
7
8 #include <qcustomplot.h>
8 #include <qcustomplot.h>
9
9
10 #include <SqpApplication.h>
10 #include <SqpApplication.h>
11 #include <Variable/VariableController2.h>
11 #include <Variable/VariableController2.h>
12 #include <Common/cpp_utils.h>
12 #include <Common/cpp_utils.h>
13
13
14 #include <Visualization/VisualizationZoneWidget.h>
14 #include <Visualization/VisualizationZoneWidget.h>
15 #include <Visualization/VisualizationGraphWidget.h>
15 #include <TestProviders.h>
16 #include <TestProviders.h>
16 #include <GUITestUtils.h>
17 #include <GUITestUtils.h>
17
18
18
19
19 ALIAS_TEMPLATE_FUNCTION(isReady, static_cast<SqpApplication *>(qApp)->variableController().isReady)
20 ALIAS_TEMPLATE_FUNCTION(isReady, static_cast<SqpApplication *>(qApp)->variableController().isReady)
20
21
21 #define A_SIMPLE_GRAPH_FIXTURE \
22 template <int GraphCount=2>
22 VisualizationZoneWidget w;\
23 std::tuple< std::unique_ptr<VisualizationZoneWidget>,
23 PREPARE_GUI_TEST(w);\
24 std::vector<std::shared_ptr<Variable>>,
24 auto provider = std::make_shared<SimpleRange<10> >();\
25 std::vector<VisualizationGraphWidget*> >
25 auto range = DateTimeRange::fromDateTime(QDate(2018, 8, 7), QTime(14, 00), QDate(2018, 8, 7),\
26 build_multi_graph_test()
26 QTime(16, 00));\
27 {
27 auto var = static_cast<SqpApplication *>(qApp)->variableController().createVariable(\
28 auto w = std::make_unique<VisualizationZoneWidget>();
28 "V1", {{"", "scalar"}}, provider, range);\
29 auto provider = std::make_shared<SimpleRange<10> >();
29 while (!isReady(var))\
30 auto range = DateTimeRange::fromDateTime(QDate(2018, 8, 7), QTime(14, 00), QDate(2018, 8, 7),QTime(16, 00));
30 QCoreApplication::processEvents();\
31 std::vector<std::shared_ptr<Variable>> variables;
31 //w.addVariable(var, range);\
32 std::vector<VisualizationGraphWidget*> graphs;
32 auto cent = center(&w);
33 for(auto i=0;i<GraphCount;i++)
33
34 {
35 auto var = static_cast<SqpApplication *>(qApp)->variableController().createVariable(
36 QString("V%1").arg(i), {{"", "scalar"}}, provider, range);
37 auto graph = new VisualizationGraphWidget();
38 graph->addVariable(var, range);
39 while (!isReady(var))
40 QCoreApplication::processEvents();
41 variables.push_back(var);
42 graphs.push_back(graph);
43 w->addGraph(graph);
44 }
45 auto cent = center(w.get());
46 return {std::move(w), variables, graphs};
47 }
34
48
35
49
36 class A_SimpleGraph : public QObject {
50 class A_MultipleSyncGraphs : public QObject {
37 Q_OBJECT
51 Q_OBJECT
38 public:
52 public:
39 explicit A_SimpleGraph(QObject *parent = Q_NULLPTR) : QObject(parent) {}
53 explicit A_MultipleSyncGraphs(QObject *parent = Q_NULLPTR) : QObject(parent) {}
40
54
41 private slots:
55 private slots:
42 void scrolls_left_with_mouse()
56 void scrolls_left_with_mouse()
43 {
57 {
44 A_SIMPLE_GRAPH_FIXTURE;
58 auto [w, variables, graphs] = build_multi_graph_test<3>();
59 QVERIFY(prepare_gui_test(w.get()));
45
60
46 while (!isReady(var))
47 QCoreApplication::processEvents();
48 auto r = var->range();
49 /*
61 /*
50 * Scrolling to the left implies going back in time
62 * Scrolling to the left implies going back in time
51 * Scroll only implies keeping the same delta T -> shit only transformation
63 * Scroll only implies keeping the same delta T -> shit only transformation
52 */
64 */
53 //QVERIFY(r.m_TEnd < range.m_TEnd);
65 //QVERIFY(r.m_TEnd < range.m_TEnd);
54 //QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
66 //QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
55 }
67 }
56
68
57 void scrolls_right_with_mouse()
69 void scrolls_right_with_mouse()
58 {
70 {
59 A_SIMPLE_GRAPH_FIXTURE;
71 auto [w, variables, graphs] = build_multi_graph_test<3>();
72 QVERIFY(prepare_gui_test(w.get()));
73 w->show();
74 for(int i=0;i<10000;i++)
75 {
76 QThread::usleep(1000);
77 qApp->processEvents();
78 }
60
79
61 while (!isReady(var))
62 QCoreApplication::processEvents();
63 auto r = var->range();
64 /*
80 /*
65 * Scrolling to the right implies going forward in time
81 * Scrolling to the right implies going forward in time
66 * Scroll only implies keeping the same delta T -> shit only transformation
82 * Scroll only implies keeping the same delta T -> shit only transformation
67 */
83 */
68 //QVERIFY(r.m_TEnd > range.m_TEnd);
84 //QVERIFY(r.m_TEnd > range.m_TEnd);
69 //QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
85 //QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
70 }
86 }
71 };
87 };
72
88
89
73 QT_BEGIN_NAMESPACE
90 QT_BEGIN_NAMESPACE
74 QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
91 QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
75 QT_END_NAMESPACE
92 QT_END_NAMESPACE
76 int main(int argc, char *argv[])
93 int main(int argc, char *argv[])
77 {
94 {
78 SqpApplication app{argc, argv};
95 SqpApplication app{argc, argv};
79 app.setAttribute(Qt::AA_Use96Dpi, true);
96 app.setAttribute(Qt::AA_Use96Dpi, true);
80 QTEST_DISABLE_KEYPAD_NAVIGATION;
97 QTEST_DISABLE_KEYPAD_NAVIGATION;
81 QTEST_ADD_GPU_BLACKLIST_SUPPORT;
98 QTEST_ADD_GPU_BLACKLIST_SUPPORT;
82 A_SimpleGraph tc;
99 A_MultipleSyncGraphs tc;
83 QTEST_SET_MAIN_SOURCE_PATH;
100 QTEST_SET_MAIN_SOURCE_PATH;
84 return QTest::qExec(&tc, argc, argv);
101 return QTest::qExec(&tc, argc, argv);
85 }
102 }
86
103
87 #include "main.moc"
104 #include "main.moc"
@@ -1,101 +1,107
1 #include <QtTest>
1 #include <QtTest>
2 #include <QObject>
2 #include <QObject>
3 #include <QString>
3 #include <QString>
4 #include <QScreen>
4 #include <QScreen>
5 #include <QMainWindow>
5 #include <QMainWindow>
6 #include <QWheelEvent>
6 #include <QWheelEvent>
7
7
8 #include <qcustomplot.h>
8 #include <qcustomplot.h>
9
9
10 #include <SqpApplication.h>
10 #include <SqpApplication.h>
11 #include <Variable/VariableController2.h>
11 #include <Variable/VariableController2.h>
12 #include <Common/cpp_utils.h>
12 #include <Common/cpp_utils.h>
13
13
14 #include <Visualization/VisualizationGraphWidget.h>
14 #include <Visualization/VisualizationGraphWidget.h>
15 #include <TestProviders.h>
15 #include <TestProviders.h>
16 #include <GUITestUtils.h>
16 #include <GUITestUtils.h>
17
17
18
18
19 ALIAS_TEMPLATE_FUNCTION(isReady, static_cast<SqpApplication *>(qApp)->variableController().isReady)
19 ALIAS_TEMPLATE_FUNCTION(isReady, static_cast<SqpApplication *>(qApp)->variableController().isReady)
20
20
21 #define A_SIMPLE_GRAPH_FIXTURE \
21 std::tuple< std::unique_ptr<VisualizationGraphWidget>,
22 VisualizationGraphWidget w;\
22 std::shared_ptr<Variable>,
23 PREPARE_GUI_TEST(w);\
23 DateTimeRange >
24 auto provider = std::make_shared<SimpleRange<10> >();\
24 build_simple_graph_test()
25 auto range = DateTimeRange::fromDateTime(QDate(2018, 8, 7), QTime(14, 00), QDate(2018, 8, 7),\
25 {
26 QTime(16, 00));\
26 auto w = std::make_unique<VisualizationGraphWidget>();
27 auto var = static_cast<SqpApplication *>(qApp)->variableController().createVariable(\
27 auto provider = std::make_shared<SimpleRange<10> >();
28 "V1", {{"", "scalar"}}, provider, range);\
28 auto range = DateTimeRange::fromDateTime(QDate(2018, 8, 7), QTime(14, 00), QDate(2018, 8, 7),QTime(16, 00));
29 while (!isReady(var))\
29 auto var = static_cast<SqpApplication *>(qApp)->variableController().createVariable("V1", {{"", "scalar"}}, provider, range);
30 QCoreApplication::processEvents();\
30 w->addVariable(var, range);
31 w.addVariable(var, range);\
31 while (!isReady(var))
32 auto cent = center(&w);
32 QCoreApplication::processEvents();
33
33 auto cent = center(w.get());
34 return {std::move(w), var, range};
35 }
34
36
35
37
36 class A_SimpleGraph : public QObject {
38 class A_SimpleGraph : public QObject {
37 Q_OBJECT
39 Q_OBJECT
38 public:
40 public:
39 explicit A_SimpleGraph(QObject *parent = Q_NULLPTR) : QObject(parent) {}
41 explicit A_SimpleGraph(QObject *parent = Q_NULLPTR) : QObject(parent) {}
40
42
41 private slots:
43 private slots:
42 void scrolls_left_with_mouse()
44 void scrolls_left_with_mouse()
43 {
45 {
44 A_SIMPLE_GRAPH_FIXTURE;
46 auto [w, var, range] = build_simple_graph_test();
47 QVERIFY(prepare_gui_test(w.get()));
48 auto cent = center(w.get());
45
49
46 for (auto i = 0; i < 100; i++) {
50 for (auto i = 0; i < 100; i++) {
47 QTest::mousePress(&w, Qt::LeftButton, Qt::NoModifier, cent, 1);
51 QTest::mousePress(w.get(), Qt::LeftButton, Qt::NoModifier, cent, 1);
48 mouseMove(&w, {cent.x() + 200, cent.y()}, Qt::LeftButton);
52 mouseMove(w.get(), {cent.x() + 200, cent.y()}, Qt::LeftButton);
49 QTest::mouseRelease(&w, Qt::LeftButton);
53 QTest::mouseRelease(w.get(), Qt::LeftButton);
50 while (!isReady(var))
54 while (!isReady(var))
51 QCoreApplication::processEvents();
55 QCoreApplication::processEvents();
52 }
56 }
53 while (!isReady(var))
57 while (!isReady(var))
54 QCoreApplication::processEvents();
58 QCoreApplication::processEvents();
55 auto r = var->range();
59 auto r = var->range();
56 /*
60 /*
57 * Scrolling to the left implies going back in time
61 * Scrolling to the left implies going back in time
58 * Scroll only implies keeping the same delta T -> shit only transformation
62 * Scroll only implies keeping the same delta T -> shit only transformation
59 */
63 */
60 QVERIFY(r.m_TEnd < range.m_TEnd);
64 QVERIFY(r.m_TEnd < range.m_TEnd);
61 QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
65 QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
62 }
66 }
63
67
64 void scrolls_right_with_mouse()
68 void scrolls_right_with_mouse()
65 {
69 {
66 A_SIMPLE_GRAPH_FIXTURE;
70 auto [w, var, range] = build_simple_graph_test();
71 QVERIFY(prepare_gui_test(w.get()));
72 auto cent = center(w.get());
67
73
68 for (auto i = 0; i < 100; i++) {
74 for (auto i = 0; i < 100; i++) {
69 QTest::mousePress(&w, Qt::LeftButton, Qt::NoModifier, cent, 1);
75 QTest::mousePress(w.get(), Qt::LeftButton, Qt::NoModifier, cent, 1);
70 mouseMove(&w, {cent.x() - 200, cent.y()}, Qt::LeftButton);
76 mouseMove(w.get(), {cent.x() - 200, cent.y()}, Qt::LeftButton);
71 QTest::mouseRelease(&w, Qt::LeftButton);
77 QTest::mouseRelease(w.get(), Qt::LeftButton);
72 while (!isReady(var))
78 while (!isReady(var))
73 QCoreApplication::processEvents();
79 QCoreApplication::processEvents();
74 }
80 }
75 while (!isReady(var))
81 while (!isReady(var))
76 QCoreApplication::processEvents();
82 QCoreApplication::processEvents();
77 auto r = var->range();
83 auto r = var->range();
78 /*
84 /*
79 * Scrolling to the right implies going forward in time
85 * Scrolling to the right implies going forward in time
80 * Scroll only implies keeping the same delta T -> shit only transformation
86 * Scroll only implies keeping the same delta T -> shit only transformation
81 */
87 */
82 QVERIFY(r.m_TEnd > range.m_TEnd);
88 QVERIFY(r.m_TEnd > range.m_TEnd);
83 QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
89 QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
84 }
90 }
85 };
91 };
86
92
87 QT_BEGIN_NAMESPACE
93 QT_BEGIN_NAMESPACE
88 QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
94 QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
89 QT_END_NAMESPACE
95 QT_END_NAMESPACE
90 int main(int argc, char *argv[])
96 int main(int argc, char *argv[])
91 {
97 {
92 SqpApplication app{argc, argv};
98 SqpApplication app{argc, argv};
93 app.setAttribute(Qt::AA_Use96Dpi, true);
99 app.setAttribute(Qt::AA_Use96Dpi, true);
94 QTEST_DISABLE_KEYPAD_NAVIGATION;
100 QTEST_DISABLE_KEYPAD_NAVIGATION;
95 QTEST_ADD_GPU_BLACKLIST_SUPPORT;
101 QTEST_ADD_GPU_BLACKLIST_SUPPORT;
96 A_SimpleGraph tc;
102 A_SimpleGraph tc;
97 QTEST_SET_MAIN_SOURCE_PATH;
103 QTEST_SET_MAIN_SOURCE_PATH;
98 return QTest::qExec(&tc, argc, argv);
104 return QTest::qExec(&tc, argc, argv);
99 }
105 }
100
106
101 #include "main.moc"
107 #include "main.moc"
General Comments 0
You need to be logged in to leave comments. Login now