on xenial help sign in
Some string-related improvements

- Use QString instead of raw char array - s/QLatin1String/QStringLiteral to optimize code

commit2cef79a4126c09e814b0a7e04d160fbb80d23f38 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateFri 22 Nov 2013, 11:37 (13 years ago) parent1bd33d8
3 files changed+11−6
tests/plugins/Ubuntu/Gestures/GestureTest.cpp+3−3 tests/plugins/Ubuntu/Gestures/GestureTest.h+2−2 tests/plugins/Ubuntu/Gestures/tst_DirectionalDragArea.cpp+6−1
tests/plugins/Ubuntu/Gestures/GestureTest.cpp+3−3
@@ -21,8 +21,8 @@
2121#include <QQuickView>
2222#include <QtTest>
2323
24−GestureTest::GestureTest(const char *qmlFile)
25− : QObject(), m_device(nullptr), m_view(nullptr), m_qmlFilename(qmlFile)
24+GestureTest::GestureTest(const QString &qmlFilename)
25+ : QObject(), m_device(nullptr), m_view(nullptr), m_qmlFilename(qmlFilename)
2626{
2727}
2828
@@ -39,7 +39,7 @@ void GestureTest::init()
3939{
4040 m_view = new QQuickView;
4141 m_view->setResizeMode(QQuickView::SizeViewToRootObject);
42− m_view->engine()->addImportPath(QLatin1String(UBUNTU_GESTURES_PLUGIN_DIR));
42+ m_view->engine()->addImportPath(QStringLiteral(UBUNTU_GESTURES_PLUGIN_DIR));
4343 m_view->setSource(QUrl::fromLocalFile(m_qmlFilename));
4444 m_view->show();
4545 QVERIFY(QTest::qWaitForWindowExposed(m_view));
tests/plugins/Ubuntu/Gestures/GestureTest.h+2−2
@@ -29,8 +29,8 @@ class GestureTest : public QObject
2929{
3030 Q_OBJECT
3131public:
32− // \param qmlFile name of the qml file to be loaded by the QQuickView
33− GestureTest(const char *qmlFile);
32+ // \param qmlFilename name of the qml file to be loaded by the QQuickView
33+ GestureTest(const QString &qmlFilename);
3434
3535protected Q_SLOTS:
3636 void initTestCase(); // will be called before the first test function is executed
tests/plugins/Ubuntu/Gestures/tst_DirectionalDragArea.cpp+6−1
@@ -66,7 +66,7 @@ class tst_DirectionalDragArea: public GestureTest
6666{
6767 Q_OBJECT
6868public:
69− tst_DirectionalDragArea() : GestureTest("tst_DirectionalDragArea.qml") {}
69+ tst_DirectionalDragArea();
7070private Q_SLOTS:
7171 void init(); // called right before each and every test function is executed
7272 void cleanup(); // called right after each and every test function is executed
@@ -90,6 +90,11 @@ private:
9090 QSharedPointer<FakeTimeSource> fakeTimeSource;
9191};
9292
93+tst_DirectionalDragArea::tst_DirectionalDragArea()
94+ : GestureTest(QStringLiteral("tst_DirectionalDragArea.qml"))
95+{
96+}
97+
9398void tst_DirectionalDragArea::init()
9499{
95100 GestureTest::init();