aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-10-25 16:57:20 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-10-25 16:57:20 +0200
commit9486e7f6c3394178bd886ebc9189835ab60221a8 (patch)
treebcd0231440692ec6b99446099adc0f463f5e707f
parentRemove breakpad gitmodule (diff)
downloadsmolbote-9486e7f6c3394178bd886ebc9189835ab60221a8.tar.xz
Add test/ meson.build
-rw-r--r--3rd-party/SingleApplication/meson.build6
-rw-r--r--meson.build5
-rw-r--r--test/meson.build27
-rw-r--r--test/singleapplication-40/main.cpp21
4 files changed, 55 insertions, 4 deletions
diff --git a/3rd-party/SingleApplication/meson.build b/3rd-party/SingleApplication/meson.build
index 0f0e918..1ac04f9 100644
--- a/3rd-party/SingleApplication/meson.build
+++ b/3rd-party/SingleApplication/meson.build
@@ -18,6 +18,6 @@ dep_SingleApplication = declare_dependency(
link_with: SingleApplication_lib
)
-#if cmake_system_name, 'MATCHES', 'Windows'
- # target_link_libraries(['SingleApplication', 'Advapi32'])
-#endif
+# On windows, SingleApplication needs to be linked against advapi32. This is
+# done by adding 'advapi32' to cpp_winlibs, where it should be by default.
+
diff --git a/meson.build b/meson.build
index 91e3bc1..93947bf 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project('smolbote', 'cpp',
# Qt 5
qt5 = import('qt5')
-dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets'])
+dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Test'])
# Boost
dep_boost = dependency('boost', modules: ['program_options'])
@@ -68,3 +68,6 @@ subdir('doc')
subdir('plugins/ConfigurationEditor')
subdir('plugins/ProfileEditor')
+
+subdir('test')
+
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..3849f07
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,27 @@
+# Adblock parsing test
+adblock = executable('AdblockTest',
+ dependencies: [dep_qt5, dep_urlfilter],
+ sources: ['adblock/adblocktest.cpp', qt5.preprocess(moc_headers: 'adblock/adblocktest.h', dependencies: dep_qt5)]
+)
+test('urlfilter-adblock', adblock)
+
+# Hostlist parsing test
+hostlist = executable('HostlistTest',
+ dependencies: [dep_qt5, dep_urlfilter],
+ sources: ['hostlist/hostlisttest.cpp', qt5.preprocess(moc_headers: 'hostlist/hostlisttest.h', dependencies: dep_qt5)]
+)
+test('urlfilter-hostlist', hostlist)
+
+# matching algorithms benchmark
+matcherbenchmark = executable('MatcherBenchmark',
+ dependencies: dep_qt5,
+ sources: ['matcherbenchmark/matcherbenchmark.cpp', qt5.preprocess(moc_headers: 'matcherbenchmark/matcherbenchmark.h', dependencies: dep_qt5)]
+)
+
+# SingleApplication issue#40 test app
+singleapp = executable('SingleApplication',
+ cpp_args: ['-DQAPPLICATION_CLASS=QApplication'],
+ dependencies: [dep_qt5, dep_SingleApplication],
+ sources: ['singleapplication-40/main.cpp']
+)
+
diff --git a/test/singleapplication-40/main.cpp b/test/singleapplication-40/main.cpp
new file mode 100644
index 0000000..246dd63
--- /dev/null
+++ b/test/singleapplication-40/main.cpp
@@ -0,0 +1,21 @@
+/* https://github.com/itay-grudev/SingleApplication/issues/40
+ * SingleApplication doesn't work when two processes are started with millisecond delay
+ *
+ * To reproduce: run the app twice with './test/singleapp & ./test/singleapp'
+ */
+#include <QCoreApplication>
+#include <QDebug>
+#include <QTimer>
+
+#include <singleapplication.h>
+
+int main(int argc, char *argv[])
+{
+ SingleApplication app(argc, argv);
+ qDebug() << "process started, pid:" << QCoreApplication::applicationPid();
+
+ QTimer::singleShot(3000, &app, SLOT(quit()));
+
+ return app.exec();
+}
+