Skip to content

Commit 02134ac

Browse files
author
Mykola Tryshnivskyy
committed
Enable Quick2 for iOS; refactoring of testDataFolder variable using in order to compile VideoTest for iOS
1 parent 498cd49 commit 02134ac

File tree

6 files changed

+38
-47
lines changed

6 files changed

+38
-47
lines changed

platform/ios/.gitignore

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ xcuserdata/
1818
#Python modules
1919
MANIFEST
2020
dist/
21-
build/
21+
build*
2222

2323
# Backup files
2424
*~.nib
2525

2626
DerivedData/
27-
build*/
28-
29-
Makefile
27+
ui_*
28+
Release*
29+
Debug*
30+
*.xcodeproj
31+
Makefile*
32+
Info.plist
33+
*stash
3034

platform/ios/wd/wd.pro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SOURCES += \
2222
../../../src/Test/BasicKeyboardInterfaceTest.cc \
2323
../../../src/Test/TouchTest.cc \
2424
../../../src/Test/MenuTest.cc \
25-
#../../../src/Test/VideoTest.cc
25+
../../../src/Test/VideoTest.cc
2626

2727
HEADERS += \
2828
../../../src/Test/shutdown_command.h \
@@ -45,16 +45,16 @@ HEADERS += \
4545
../../../src/Test/BasicMouseInterfaceTest.h \
4646
../../../src/Test/BasicKeyboardInterfaceTest.h \
4747
../../../src/Test/TouchTest.h \
48-
../../../src/Test/TestVariables.h \
4948
../../../src/Test/MenuTest.h \
50-
#../../../src/Test/VideoTest.h
49+
../../../src/Test/VideoTest.h
5150

5251
INCLUDEPATH += ../../../inc
5352

5453
FORMS += \
5554
../../../src/Test/ElementSelectingTest.ui \
5655
../../../src/Test/ClickScrollingTest.ui
5756

57+
DEFINES += WD_ENABLE_PLAYER="1"
5858

5959
DESTDIR = build
6060
OBJECTS_DIR = build

src/Test/TestVariables.h

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Test/VideoTest.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#include "VideoTest.h"
2+
#include <string>
3+
4+
std::string testDataFolder;
25

36
VideoTestWidget::VideoTestWidget(QWidget *parent) :
47
QMainWindow(parent)
@@ -42,7 +45,7 @@ VideoTestWidget::VideoTestWidget(QWidget *parent) :
4245
controlsLayout->addWidget(positionSlider);
4346
controlsLayout->addWidget(volumeSlider);
4447

45-
QString videoPath(tests::testDataFolder.c_str());
48+
QString videoPath(testDataFolder.c_str());
4649
if(!videoPath.isEmpty()){
4750
if(!videoPath.endsWith("/"))
4851
videoPath.append("/");

src/Test/VideoTest.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
#ifndef MAINWINDOW_H
2-
#define MAINWINDOW_H
1+
#ifndef VIDEOTEST_H
2+
#define VIDEOTEST_H
33

44
#include <QtWidgets/QtWidgets>
55
#include <QtMultimediaWidgets/QVideoWidget>
66
#include <QtMultimedia/QMediaPlayer>
77
#include <QtNetwork/QNetworkRequest>
88

9-
#include "TestVariables.h"
10-
119
class VideoTestWidget;
1210
class QAbstractButton;
1311
class QMediaPlayer;
@@ -36,4 +34,4 @@ private slots:
3634

3735
};
3836

39-
#endif // MAINWINDOW_H
37+
#endif // VIDEOTEST_H

src/Test/main.cc

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
#include <iostream>
1818

19-
#include "TestVariables.h"
20-
std::string tests::testDataFolder;
21-
22-
2319
#include "WindowTest.h"
2420
#include "ClickTest.h"
2521
#include "ElementAttributeTest.h"
@@ -42,10 +38,10 @@ std::string tests::testDataFolder;
4238
#include "WindowWithDeclarativeViewTest.h"
4339
#endif
4440

45-
// Commented VideoTest due to error https://bugreports.qt-project.org/browse/QTBUG-32949
4641
#if (1 == WD_ENABLE_PLAYER) && (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
4742
#include "VideoTest.h"
48-
#endif//WD_ENABLE_PLAYER
43+
extern std::string testDataFolder;
44+
#endif //WD_ENABLE_PLAYER
4945

5046
#include "base/at_exit.h"
5147
#include "webdriver_server.h"
@@ -55,7 +51,6 @@ std::string tests::testDataFolder;
5551
#include "shutdown_command.h"
5652
#include "webdriver_route_patterns.h"
5753

58-
#ifndef OS_IOS
5954
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
6055
// headers for Quick2 extension
6156
#include "extension_qt/quick2_view_creator.h"
@@ -67,13 +62,12 @@ std::string tests::testDataFolder;
6762
#include "extension_qt/qml_view_creator.h"
6863
#include "extension_qt/qml_view_executor.h"
6964
#include "extension_qt/qml_view_enumerator.h"
70-
#if (WD_TEST_ENABLE_WEB_VIEW == 1)
71-
#include "extension_qt/qdeclarativewebview.h"
72-
#include "extension_qt/qml_web_view_enumerator.h"
73-
#include "extension_qt/qml_web_view_executor.h"
74-
#endif
75-
#endif
76-
#endif //OS_IOS
65+
#if (WD_TEST_ENABLE_WEB_VIEW == 1)
66+
#include "extension_qt/qdeclarativewebview.h"
67+
#include "extension_qt/qml_web_view_enumerator.h"
68+
#include "extension_qt/qml_web_view_executor.h"
69+
#endif //WD_TEST_ENABLE_WEB_VIEW
70+
#endif //QT_VERSION
7771

7872
#if (WD_TEST_ENABLE_WEB_VIEW == 1)
7973
#include "extension_qt/web_view_creator.h"
@@ -87,8 +81,8 @@ std::string tests::testDataFolder;
8781
#include "WidgetAndWebViewTest.h"
8882
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
8983
#include "WindowWithSeparatedDeclarativeAndWebViewsTest.h"
90-
#endif
91-
#endif
84+
#endif //QT_VERSION
85+
#endif //WD_TEST_ENABLE_WEB_VIEW
9286

9387
#include "extension_qt/q_view_runner.h"
9488
#include "extension_qt/q_session_lifecycle_actions.h"
@@ -171,10 +165,9 @@ int main(int argc, char *argv[])
171165

172166
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
173167
widgetCreator->RegisterViewClass<WindowWithSeparatedDeclarativeAndWebViewsTestWidget>("WindowWithSeparatedDeclarativeAndWebViewsTestWidget");
174-
#endif
175-
#endif
168+
#endif // QT_VERSION
169+
#endif // WD_TEST_ENABLE_WEB_VIEW
176170

177-
#ifndef OS_IOS
178171
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
179172
// Quick2 extension
180173
webdriver::ViewCreator* qmlCreator = new webdriver::Quick2ViewCreator();
@@ -205,8 +198,7 @@ int main(int argc, char *argv[])
205198
#endif
206199

207200
#endif
208-
#endif //OS_IOS
209-
201+
210202
webdriver::ViewFactory::GetInstance()->AddViewCreator(widgetCreator);
211203

212204
webdriver::ViewEnumerator::AddViewEnumeratorImpl(new webdriver::WidgetViewEnumeratorImpl());
@@ -232,14 +224,18 @@ int main(int argc, char *argv[])
232224
return 0;
233225
}
234226

227+
#if (1 == WD_ENABLE_PLAYER) && (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
235228
// check if --test_data_folder CL argument is present
236229
std::string testDataFolderSwitch = "test_data_folder";
230+
237231
if (cmd_line.HasSwitch(testDataFolderSwitch)) {
238-
tests::testDataFolder = cmd_line.GetSwitchValueASCII(testDataFolderSwitch);
232+
testDataFolder = cmd_line.GetSwitchValueASCII(testDataFolderSwitch);
239233
} else {
240-
tests::testDataFolder = "./";
234+
testDataFolder = "./";
241235
}
242-
std::cout << "Using "<< tests::testDataFolder << " as test data folder" << std::endl;
236+
237+
std::cout << "Using "<< testDataFolder << " as test data folder" << std::endl;
238+
#endif //WD_ENABLE_PLAYER
243239

244240
#if defined(OS_WIN)
245241
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))

0 commit comments

Comments
 (0)