##// END OF EJS Templates
Added test skel for two synchronized graph widgets...
jeandet -
r1368:903248ef5e63
parent child
Show More
@@ -0,0 +1,87
1 #include <QtTest>
2 #include <QObject>
3 #include <QString>
4 #include <QScreen>
5 #include <QMainWindow>
6 #include <QWheelEvent>
7
8 #include <qcustomplot.h>
9
10 #include <SqpApplication.h>
11 #include <Variable/VariableController2.h>
12 #include <Common/cpp_utils.h>
13
14 #include <Visualization/VisualizationZoneWidget.h>
15 #include <TestProviders.h>
16 #include <GUITestUtils.h>
17
18
19 ALIAS_TEMPLATE_FUNCTION(isReady, static_cast<SqpApplication *>(qApp)->variableController().isReady)
20
21 #define A_SIMPLE_GRAPH_FIXTURE \
22 VisualizationZoneWidget w;\
23 PREPARE_GUI_TEST(w);\
24 auto provider = std::make_shared<SimpleRange<10> >();\
25 auto range = DateTimeRange::fromDateTime(QDate(2018, 8, 7), QTime(14, 00), QDate(2018, 8, 7),\
26 QTime(16, 00));\
27 auto var = static_cast<SqpApplication *>(qApp)->variableController().createVariable(\
28 "V1", {{"", "scalar"}}, provider, range);\
29 while (!isReady(var))\
30 QCoreApplication::processEvents();\
31 //w.addVariable(var, range);\
32 auto cent = center(&w);
33
34
35
36 class A_SimpleGraph : public QObject {
37 Q_OBJECT
38 public:
39 explicit A_SimpleGraph(QObject *parent = Q_NULLPTR) : QObject(parent) {}
40
41 private slots:
42 void scrolls_left_with_mouse()
43 {
44 A_SIMPLE_GRAPH_FIXTURE;
45
46 while (!isReady(var))
47 QCoreApplication::processEvents();
48 auto r = var->range();
49 /*
50 * Scrolling to the left implies going back in time
51 * Scroll only implies keeping the same delta T -> shit only transformation
52 */
53 //QVERIFY(r.m_TEnd < range.m_TEnd);
54 //QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
55 }
56
57 void scrolls_right_with_mouse()
58 {
59 A_SIMPLE_GRAPH_FIXTURE;
60
61 while (!isReady(var))
62 QCoreApplication::processEvents();
63 auto r = var->range();
64 /*
65 * Scrolling to the right implies going forward in time
66 * Scroll only implies keeping the same delta T -> shit only transformation
67 */
68 //QVERIFY(r.m_TEnd > range.m_TEnd);
69 //QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
70 }
71 };
72
73 QT_BEGIN_NAMESPACE
74 QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
75 QT_END_NAMESPACE
76 int main(int argc, char *argv[])
77 {
78 SqpApplication app{argc, argv};
79 app.setAttribute(Qt::AA_Use96Dpi, true);
80 QTEST_DISABLE_KEYPAD_NAVIGATION;
81 QTEST_ADD_GPU_BLACKLIST_SUPPORT;
82 A_SimpleGraph tc;
83 QTEST_SET_MAIN_SOURCE_PATH;
84 return QTest::qExec(&tc, argc, argv);
85 }
86
87 #include "main.moc"
@@ -1,2 +1,3
1 1 subdirs(GUITestUtils)
2 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")
General Comments 0
You need to be logged in to leave comments. Login now