diff --git a/kmymoney/reports/tests/chart-test.cpp b/kmymoney/reports/tests/chart-test.cpp index afa02be34..e3c9f59c1 100644 --- a/kmymoney/reports/tests/chart-test.cpp +++ b/kmymoney/reports/tests/chart-test.cpp @@ -1,54 +1,54 @@ /*************************************************************************** reportcharttest.cpp ------------------- copyright : (C) 2017 by Ralf Habacker email : ralf.habacker@freenet.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ -#include +#include "chart-test.h" + +#include #include #include #include #include -using namespace KChart; - -int main( int argc, char** argv ) +void ChartTest::createChart() { - QApplication app( argc, argv ); + using namespace KChart; Widget widget; widget.resize( 600, 600 ); QVector< double > vec0, vec1, vec2; vec0 << 5 << 1 << 3 << 4 << 1; vec1 << 3 << 6 << 2 << 4 << 8; vec2 << 0 << 7 << 1 << 2 << 1; widget.setDataset( 0, vec0, "vec0" ); widget.setDataset( 1, vec1, "vec1" ); widget.setDataset( 2, vec2, "vec2" ); CartesianAxis *xAxis = new CartesianAxis( widget.lineDiagram() ); CartesianAxis *yAxis = new CartesianAxis (widget.lineDiagram() ); xAxis->setPosition ( CartesianAxis::Bottom ); yAxis->setPosition ( CartesianAxis::Left ); xAxis->setTitleText ( "Abscissa bottom position" ); yAxis->setTitleText ( "Ordinate left position" ); widget.lineDiagram()->addAxis( xAxis ); widget.lineDiagram()->addAxis( yAxis ); - widget.show(); - // make sure the test terminates - QTimer::singleShot(5000, &widget, SLOT(close())); - return app.exec(); + widget.show(); + QVERIFY(QTest::qWaitForWindowActive(&widget)); } + +QTEST_MAIN(ChartTest) diff --git a/kmymoney/reports/tests/chart-test.h b/kmymoney/reports/tests/chart-test.h new file mode 100644 index 000000000..274de79a4 --- /dev/null +++ b/kmymoney/reports/tests/chart-test.h @@ -0,0 +1,26 @@ +/*************************************************************************** + reportcharttest.cpp + ------------------- + copyright : (C) 2017 by Ralf Habacker + email : ralf.habacker@freenet.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include + +class ChartTest: public QObject +{ + Q_OBJECT + +private slots: + void createChart(); + +};