Browse Source

Add test/ meson.build

Aqua-sama 1 month ago
parent
commit
9486e7f6c3
Signed by: Aqua-sama <aqua@iserlohn-fortress.net> GPG Key ID: 5378B8349C1D5ADA
4 changed files with 55 additions and 4 deletions
  1. 3
    3
      3rd-party/SingleApplication/meson.build
  2. 4
    1
      meson.build
  3. 27
    0
      test/meson.build
  4. 21
    0
      test/singleapplication-40/main.cpp

+ 3
- 3
3rd-party/SingleApplication/meson.build View File

@@ -18,6 +18,6 @@ dep_SingleApplication = declare_dependency(
18 18
     link_with: SingleApplication_lib
19 19
 )
20 20
 
21
-#if cmake_system_name, 'MATCHES', 'Windows'
22
-  # target_link_libraries(['SingleApplication', 'Advapi32'])
23
-#endif
21
+# On windows, SingleApplication needs to be linked against advapi32. This is
22
+# done by adding 'advapi32' to cpp_winlibs, where it should be by default.
23
+

+ 4
- 1
meson.build View File

@@ -5,7 +5,7 @@ project('smolbote', 'cpp',
5 5
 
6 6
 # Qt 5
7 7
 qt5 = import('qt5')
8
-dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets'])
8
+dep_qt5 = dependency('qt5', modules: ['Core', 'Network', 'Widgets', 'WebEngineWidgets', 'Test'])
9 9
 
10 10
 # Boost
11 11
 dep_boost = dependency('boost', modules: ['program_options'])
@@ -68,3 +68,6 @@ subdir('doc')
68 68
 
69 69
 subdir('plugins/ConfigurationEditor')
70 70
 subdir('plugins/ProfileEditor')
71
+
72
+subdir('test')
73
+

+ 27
- 0
test/meson.build View File

@@ -0,0 +1,27 @@
1
+# Adblock parsing test
2
+adblock = executable('AdblockTest',
3
+    dependencies: [dep_qt5, dep_urlfilter],
4
+    sources: ['adblock/adblocktest.cpp', qt5.preprocess(moc_headers: 'adblock/adblocktest.h', dependencies: dep_qt5)]
5
+)
6
+test('urlfilter-adblock', adblock)
7
+
8
+# Hostlist parsing test
9
+hostlist = executable('HostlistTest',
10
+    dependencies: [dep_qt5, dep_urlfilter],
11
+    sources: ['hostlist/hostlisttest.cpp', qt5.preprocess(moc_headers: 'hostlist/hostlisttest.h', dependencies: dep_qt5)]
12
+)
13
+test('urlfilter-hostlist', hostlist)
14
+
15
+# matching algorithms benchmark
16
+matcherbenchmark = executable('MatcherBenchmark',
17
+    dependencies: dep_qt5,
18
+    sources: ['matcherbenchmark/matcherbenchmark.cpp', qt5.preprocess(moc_headers: 'matcherbenchmark/matcherbenchmark.h', dependencies: dep_qt5)]
19
+)
20
+
21
+# SingleApplication issue#40 test app
22
+singleapp = executable('SingleApplication',
23
+    cpp_args: ['-DQAPPLICATION_CLASS=QApplication'],
24
+    dependencies: [dep_qt5, dep_SingleApplication],
25
+    sources: ['singleapplication-40/main.cpp']
26
+)
27
+

+ 21
- 0
test/singleapplication-40/main.cpp View File

@@ -0,0 +1,21 @@
1
+/* https://github.com/itay-grudev/SingleApplication/issues/40
2
+ * SingleApplication doesn't work when two processes are started with millisecond delay
3
+ * 
4
+ * To reproduce: run the app twice with './test/singleapp &  ./test/singleapp'
5
+ */
6
+#include <QCoreApplication>
7
+#include <QDebug>
8
+#include <QTimer>
9
+
10
+#include <singleapplication.h>
11
+
12
+int main(int argc, char *argv[])
13
+{
14
+    SingleApplication app(argc, argv);
15
+    qDebug() << "process started, pid:" << QCoreApplication::applicationPid();
16
+
17
+    QTimer::singleShot(3000, &app, SLOT(quit()));
18
+
19
+    return app.exec();
20
+}
21
+

Loading…
Cancel
Save