diff --git a/gui/tests/CMakeLists.txt b/gui/tests/CMakeLists.txt index 3dc8e5a..e5f37e8 100644 --- a/gui/tests/CMakeLists.txt +++ b/gui/tests/CMakeLists.txt @@ -1,2 +1,3 @@ subdirs(GUITestUtils) declare_test(simple_graph simple_graph simple_graph/main.cpp "sciqlopgui;TestUtils;GUITestUtils;Qt5::Test") +declare_test(two_sync_graph two_sync_graph two_sync_graph/main.cpp "sciqlopgui;TestUtils;GUITestUtils;Qt5::Test") diff --git a/gui/tests/two_sync_graph/main.cpp b/gui/tests/two_sync_graph/main.cpp new file mode 100644 index 0000000..55a377d --- /dev/null +++ b/gui/tests/two_sync_graph/main.cpp @@ -0,0 +1,87 @@ +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + + +ALIAS_TEMPLATE_FUNCTION(isReady, static_cast(qApp)->variableController().isReady) + +#define A_SIMPLE_GRAPH_FIXTURE \ + VisualizationZoneWidget w;\ + PREPARE_GUI_TEST(w);\ + auto provider = std::make_shared >();\ + auto range = DateTimeRange::fromDateTime(QDate(2018, 8, 7), QTime(14, 00), QDate(2018, 8, 7),\ + QTime(16, 00));\ + auto var = static_cast(qApp)->variableController().createVariable(\ + "V1", {{"", "scalar"}}, provider, range);\ + while (!isReady(var))\ + QCoreApplication::processEvents();\ + //w.addVariable(var, range);\ + auto cent = center(&w); + + + +class A_SimpleGraph : public QObject { + Q_OBJECT +public: + explicit A_SimpleGraph(QObject *parent = Q_NULLPTR) : QObject(parent) {} + +private slots: + void scrolls_left_with_mouse() + { + A_SIMPLE_GRAPH_FIXTURE; + + while (!isReady(var)) + QCoreApplication::processEvents(); + auto r = var->range(); + /* + * Scrolling to the left implies going back in time + * Scroll only implies keeping the same delta T -> shit only transformation + */ + //QVERIFY(r.m_TEnd < range.m_TEnd); + //QVERIFY(SciQLop::numeric::almost_equal(r.delta(),range.delta(),1)); + } + + void scrolls_right_with_mouse() + { + A_SIMPLE_GRAPH_FIXTURE; + + while (!isReady(var)) + QCoreApplication::processEvents(); + auto r = var->range(); + /* + * Scrolling to the right implies going forward in time + * Scroll only implies keeping the same delta T -> shit only transformation + */ + //QVERIFY(r.m_TEnd > range.m_TEnd); + //QVERIFY(SciQLop::numeric::almost_equal(r.delta(),range.delta(),1)); + } +}; + +QT_BEGIN_NAMESPACE +QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS +QT_END_NAMESPACE +int main(int argc, char *argv[]) +{ + SqpApplication app{argc, argv}; + app.setAttribute(Qt::AA_Use96Dpi, true); + QTEST_DISABLE_KEYPAD_NAVIGATION; + QTEST_ADD_GPU_BLACKLIST_SUPPORT; + A_SimpleGraph tc; + QTEST_SET_MAIN_SOURCE_PATH; + return QTest::qExec(&tc, argc, argv); +} + +#include "main.moc"