##// END OF EJS Templates
Bump core...
Bump core Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1371:ae26ed165253
r1419:bb9b768e92ec
Show More
main.cpp
109 lines | 3.4 KiB | text/x-c | CppLexer
Added test skel for two synchronized graph widgets...
r1368 #include <QtTest>
#include <QObject>
#include <QString>
#include <QScreen>
#include <QMainWindow>
#include <QWheelEvent>
#include <qcustomplot.h>
#include <SqpApplication.h>
#include <Variable/VariableController2.h>
#include <Common/cpp_utils.h>
#include <Visualization/VisualizationZoneWidget.h>
Some test refac and prepared synchronized graph test...
r1369 #include <Visualization/VisualizationGraphWidget.h>
Added test skel for two synchronized graph widgets...
r1368 #include <TestProviders.h>
#include <GUITestUtils.h>
Some test refac and prepared synchronized graph test...
r1369 template <int GraphCount=2>
std::tuple< std::unique_ptr<VisualizationZoneWidget>,
std::vector<std::shared_ptr<Variable>>,
Multi-graph test is ready, just need to implement synchronization...
r1371 std::vector<VisualizationGraphWidget*>,
DateTimeRange>
Some test refac and prepared synchronized graph test...
r1369 build_multi_graph_test()
{
auto w = std::make_unique<VisualizationZoneWidget>();
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));
std::vector<std::shared_ptr<Variable>> variables;
std::vector<VisualizationGraphWidget*> graphs;
for(auto i=0;i<GraphCount;i++)
{
auto var = static_cast<SqpApplication *>(qApp)->variableController().createVariable(
QString("V%1").arg(i), {{"", "scalar"}}, provider, range);
auto graph = new VisualizationGraphWidget();
graph->addVariable(var, range);
while (!isReady(var))
QCoreApplication::processEvents();
variables.push_back(var);
graphs.push_back(graph);
w->addGraph(graph);
}
Multi-graph test is ready, just need to implement synchronization...
r1371 return {std::move(w), variables, graphs, range};
Some test refac and prepared synchronized graph test...
r1369 }
Added test skel for two synchronized graph widgets...
r1368
Some test refac and prepared synchronized graph test...
r1369 class A_MultipleSyncGraphs : public QObject {
Added test skel for two synchronized graph widgets...
r1368 Q_OBJECT
public:
Some test refac and prepared synchronized graph test...
r1369 explicit A_MultipleSyncGraphs(QObject *parent = Q_NULLPTR) : QObject(parent) {}
Added test skel for two synchronized graph widgets...
r1368
private slots:
void scrolls_left_with_mouse()
{
Multi-graph test is ready, just need to implement synchronization...
r1371 auto [w, variables, graphs, range] = build_multi_graph_test<3>();
auto var = variables.front();
auto graph = graphs.front();
Some test refac and prepared synchronized graph test...
r1369 QVERIFY(prepare_gui_test(w.get()));
Multi-graph test is ready, just need to implement synchronization...
r1371 for (auto i = 0; i < 100; i++) {
scroll_graph(graph, -200);
waitForVar(var);
}
auto r = variables.back()->range();
Added test skel for two synchronized graph widgets...
r1368
/*
* Scrolling to the left implies going back in time
* Scroll only implies keeping the same delta T -> shit only transformation
*/
Multi-graph test is ready, just need to implement synchronization...
r1371 QVERIFY(r.m_TEnd < range.m_TEnd);
QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
Added test skel for two synchronized graph widgets...
r1368 }
void scrolls_right_with_mouse()
{
Multi-graph test is ready, just need to implement synchronization...
r1371 auto [w, variables, graphs, range] = build_multi_graph_test<3>();
auto var = variables.front();
auto graph = graphs.front();
Some test refac and prepared synchronized graph test...
r1369 QVERIFY(prepare_gui_test(w.get()));
Multi-graph test is ready, just need to implement synchronization...
r1371 for (auto i = 0; i < 100; i++) {
scroll_graph(graph, 200);
waitForVar(var);
}
auto r = variables.back()->range();
Added test skel for two synchronized graph widgets...
r1368
/*
* Scrolling to the right implies going forward in time
* Scroll only implies keeping the same delta T -> shit only transformation
*/
Multi-graph test is ready, just need to implement synchronization...
r1371 QVERIFY(r.m_TEnd > range.m_TEnd);
QVERIFY(SciQLop::numeric::almost_equal<double>(r.delta(),range.delta(),1));
Added test skel for two synchronized graph widgets...
r1368 }
};
Some test refac and prepared synchronized graph test...
r1369
Added test skel for two synchronized graph widgets...
r1368 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;
Some test refac and prepared synchronized graph test...
r1369 A_MultipleSyncGraphs tc;
Added test skel for two synchronized graph widgets...
r1368 QTEST_SET_MAIN_SOURCE_PATH;
return QTest::qExec(&tc, argc, argv);
}
#include "main.moc"