##// END OF EJS Templates
Switched to new TS impl but quite broken!...
Switched to new TS impl but quite broken! Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1420:3c3e24550401
r1420:3c3e24550401
Show More
main.cpp
95 lines | 2.8 KiB | text/x-c | CppLexer
Switched to new TS impl but quite broken!...
r1420 #include <QMainWindow>
Started UI unit testing...
r1359 #include <QObject>
#include <QScreen>
Switched to new TS impl but quite broken!...
r1420 #include <QString>
Added GUI Test Utils lib to share boilerplate code for UI testing...
r1360 #include <QWheelEvent>
Switched to new TS impl but quite broken!...
r1420 #include <QtTest>
Started UI unit testing...
r1359
Added GUI Test Utils lib to share boilerplate code for UI testing...
r1360 #include <qcustomplot.h>
Started UI unit testing...
r1359
Switched to new TS impl but quite broken!...
r1420 #include <Common/cpp_utils.h>
Started UI unit testing...
r1359 #include <SqpApplication.h>
#include <Variable/VariableController2.h>
Added GUI Test Utils lib to share boilerplate code for UI testing...
r1360 #include <GUITestUtils.h>
Switched to new TS impl but quite broken!...
r1420 #include <TestProviders.h>
#include <Variable/Variable2.h>
#include <Visualization/VisualizationGraphWidget.h>
simple graph unit test: simple scroll implemented...
r1361
Switched to new TS impl but quite broken!...
r1420 std::tuple<std::unique_ptr<VisualizationGraphWidget>, std::shared_ptr<Variable2>, DateTimeRange>
Some test refac and prepared synchronized graph test...
r1369 build_simple_graph_test()
{
auto w = std::make_unique<VisualizationGraphWidget>();
Switched to new TS impl but quite broken!...
r1420 auto provider = std::make_shared<SimpleRange<10>>();
auto range = DateTimeRange::fromDateTime(
QDate(2018, 8, 7), QTime(14, 00), QDate(2018, 8, 7), QTime(16, 00));
auto var = static_cast<SqpApplication*>(qApp)->variableController().createVariable(
"V1", { { "", "scalar" } }, provider, range);
while (!isReady(var))
QCoreApplication::processEvents();
Some test refac and prepared synchronized graph test...
r1369 w->addVariable(var, range);
Switched to new TS impl but quite broken!...
r1420 while (!isReady(var))
QCoreApplication::processEvents();
return { std::move(w), var, range };
Some test refac and prepared synchronized graph test...
r1369 }
simple graph unit test: simple scroll implemented...
r1361
Switched to new TS impl but quite broken!...
r1420 class A_SimpleGraph : public QObject
{
Started UI unit testing...
r1359 Q_OBJECT
public:
Switched to new TS impl but quite broken!...
r1420 explicit A_SimpleGraph(QObject* parent = Q_NULLPTR) : QObject(parent) {}
Started UI unit testing...
r1359
private slots:
More refactoring and added back plot tooltip...
r1363 void scrolls_left_with_mouse()
Started UI unit testing...
r1359 {
Some test refac and prepared synchronized graph test...
r1369 auto [w, var, range] = build_simple_graph_test();
QVERIFY(prepare_gui_test(w.get()));
Switched to new TS impl but quite broken!...
r1420 for (auto i = 0; i < 100; i++)
{
More GUI tests refactoring, this will allow more complex tests and ease sync graph tests...
r1370 scroll_graph(w.get(), 200);
waitForVar(var);
Added GUI Test Utils lib to share boilerplate code for UI testing...
r1360 }
simple graph unit test: simple scroll implemented...
r1361 auto r = var->range();
Partly reimplemented Graph event handling + bugfix...
r1362 /*
* Scrolling to the left implies going back in time
* Scroll only implies keeping the same delta T -> shit only transformation
Switched to new TS impl but quite broken!...
r1420 */
simple graph unit test: simple scroll implemented...
r1361 QVERIFY(r.m_TEnd < range.m_TEnd);
Switched to new TS impl but quite broken!...
r1420 QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(), range.delta(), 1));
Started UI unit testing...
r1359 }
More refactoring and added back plot tooltip...
r1363
void scrolls_right_with_mouse()
{
Some test refac and prepared synchronized graph test...
r1369 auto [w, var, range] = build_simple_graph_test();
QVERIFY(prepare_gui_test(w.get()));
Switched to new TS impl but quite broken!...
r1420 for (auto i = 0; i < 100; i++)
{
More GUI tests refactoring, this will allow more complex tests and ease sync graph tests...
r1370 scroll_graph(w.get(), -200);
waitForVar(var);
More refactoring and added back plot tooltip...
r1363 }
auto r = var->range();
/*
* Scrolling to the right implies going forward in time
* Scroll only implies keeping the same delta T -> shit only transformation
Switched to new TS impl but quite broken!...
r1420 */
More refactoring and added back plot tooltip...
r1363 QVERIFY(r.m_TEnd > range.m_TEnd);
Switched to new TS impl but quite broken!...
r1420 QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(), range.delta(), 1));
More refactoring and added back plot tooltip...
r1363 }
Started UI unit testing...
r1359 };
QT_BEGIN_NAMESPACE
QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
simple graph unit test: simple scroll implemented...
r1361 QT_END_NAMESPACE
Switched to new TS impl but quite broken!...
r1420 int main(int argc, char* argv[])
Started UI unit testing...
r1359 {
Switched to new TS impl but quite broken!...
r1420 SqpApplication app { argc, argv };
Started UI unit testing...
r1359 app.setAttribute(Qt::AA_Use96Dpi, true);
More refactoring and added back plot tooltip...
r1363 QTEST_DISABLE_KEYPAD_NAVIGATION;
QTEST_ADD_GPU_BLACKLIST_SUPPORT;
Started UI unit testing...
r1359 A_SimpleGraph tc;
More refactoring and added back plot tooltip...
r1363 QTEST_SET_MAIN_SOURCE_PATH;
Started UI unit testing...
r1359 return QTest::qExec(&tc, argc, argv);
}
#include "main.moc"