~abreu-alexandre/oxide/add-ua-to-downloadrequested

« back to all changes in this revision

Viewing changes to qt/tests/qmltests/oxide_qml_testing_plugin.cc

  • Committer: Chris Coulson
  • Date: 2014-09-08 16:44:17 UTC
  • Revision ID: chris.coulson@canonical.com-20140908164417-lcssminogx8bszfq
Give each test its own datadir. Should hopefully fix LP: #1278315

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 
18
18
#include <QCoreApplication>
19
 
#include <QDir>
20
19
#include <QLatin1String>
21
20
#include <QQmlContext>
22
21
#include <QQmlExtensionPlugin>
23
22
#include <QString>
24
23
#include <QtGlobal>
25
24
#include <QtQml>
26
 
#include <QUrl>
27
25
#include <QVariant>
28
26
 
29
27
class DestructionObserver : public QObject {
60
58
 
61
59
class OxideTestingUtils : public QObject {
62
60
  Q_OBJECT
63
 
  Q_PROPERTY(QUrl DATA_PATH READ dataPath CONSTANT)
64
61
 
65
62
 public:
66
63
  OxideTestingUtils() {}
67
64
 
68
 
  QUrl dataPath() const {
69
 
    static QUrl url;
70
 
    static bool initialized = false;
71
 
 
72
 
    if (initialized) {
73
 
      return url;
74
 
    }
75
 
 
76
 
    initialized = true;
77
 
 
78
 
    QString path(QString(qgetenv("OXIDE_TESTING_DATA_PATH")));
79
 
    if (!path.isEmpty()) {
80
 
      QDir dir(path);
81
 
      url = QUrl::fromLocalFile(dir.absolutePath());
82
 
    }
83
 
 
84
 
    return url;
85
 
  }
86
 
 
87
65
  Q_INVOKABLE QObject* qObjectParent(QObject* object) {
88
66
    if (!object) {
89
67
      return NULL;