summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/4 qt
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test cases/frameworks/4 qt/main.cpp55
-rw-r--r--test cases/frameworks/4 qt/mainWindow.cpp8
-rw-r--r--test cases/frameworks/4 qt/mainWindow.h20
-rw-r--r--test cases/frameworks/4 qt/mainWindow.ui54
-rw-r--r--test cases/frameworks/4 qt/manualinclude.cpp26
-rw-r--r--test cases/frameworks/4 qt/manualinclude.h22
-rw-r--r--test cases/frameworks/4 qt/meson.build158
-rw-r--r--test cases/frameworks/4 qt/meson_options.txt2
-rw-r--r--test cases/frameworks/4 qt/plugin/plugin.cpp12
-rw-r--r--test cases/frameworks/4 qt/plugin/plugin.h14
-rw-r--r--test cases/frameworks/4 qt/plugin/plugin.json3
-rw-r--r--test cases/frameworks/4 qt/pluginInterface/plugin_if.h21
-rw-r--r--test cases/frameworks/4 qt/q5core.cpp28
-rw-r--r--test cases/frameworks/4 qt/qt4_lang.qrc6
-rw-r--r--test cases/frameworks/4 qt/qt4core_fr.ts12
-rw-r--r--test cases/frameworks/4 qt/qt4embedded_fr.ts12
-rw-r--r--test cases/frameworks/4 qt/qt5_lang.qrc6
-rw-r--r--test cases/frameworks/4 qt/qt5core_fr.ts12
-rw-r--r--test cases/frameworks/4 qt/qt5embedded_fr.ts12
-rw-r--r--test cases/frameworks/4 qt/qt6_lang.qrc6
-rw-r--r--test cases/frameworks/4 qt/qt6core_fr.ts12
-rw-r--r--test cases/frameworks/4 qt/qt6embedded_fr.ts12
-rw-r--r--test cases/frameworks/4 qt/qtinterface.cpp8
-rw-r--r--test cases/frameworks/4 qt/stuff.qrc6
-rw-r--r--test cases/frameworks/4 qt/stuff2.qrc6
-rw-r--r--test cases/frameworks/4 qt/subfolder/generator.py6
-rw-r--r--test cases/frameworks/4 qt/subfolder/main.cpp29
-rw-r--r--test cases/frameworks/4 qt/subfolder/meson.build32
-rw-r--r--test cases/frameworks/4 qt/subfolder/resources/stuff3.qrc6
-rw-r--r--test cases/frameworks/4 qt/subfolder/resources/stuff4.qrc.in8
-rw-r--r--test cases/frameworks/4 qt/subfolder/resources/thing.pngbin0 -> 40303 bytes
-rw-r--r--test cases/frameworks/4 qt/test.json12
-rw-r--r--test cases/frameworks/4 qt/thing.pngbin0 -> 40303 bytes
-rw-r--r--test cases/frameworks/4 qt/thing2.pngbin0 -> 40303 bytes
34 files changed, 626 insertions, 0 deletions
diff --git a/test cases/frameworks/4 qt/main.cpp b/test cases/frameworks/4 qt/main.cpp
new file mode 100644
index 0000000..3c141b9
--- /dev/null
+++ b/test cases/frameworks/4 qt/main.cpp
@@ -0,0 +1,55 @@
+#include <QApplication>
+#include <QTranslator>
+#include <QDebug>
+#include "mainWindow.h"
+
+#if QT_VERSION > 0x050000
+// include some random private headers
+// As you're not supposed to use it, your system may miss
+// qobject_p.h. To locate it try one of these commands:
+// - dnf provides */private/qobject_p.h
+// - apt-file search qobject_p.h
+ #include <private/qobject_p.h>
+#endif
+
+int main(int argc, char **argv) {
+ #ifndef UNITY_BUILD
+ Q_INIT_RESOURCE(stuff);
+ Q_INIT_RESOURCE(stuff2);
+ #endif
+ QApplication app(argc, argv);
+
+ auto *translator = new QTranslator;
+ if (translator->load(QLocale(), QT "embedded", "_", ":/lang"))
+ qApp->installTranslator(translator);
+
+ qDebug() << QObject::tr("Translate me!");
+
+ MainWindow *win = new MainWindow();
+ QImage qi(":/thing.png");
+ if(qi.width() != 640) {
+ return 1;
+ }
+ QImage qi2(":/thing2.png");
+ if(qi2.width() != 640) {
+ return 1;
+ }
+ win->setWindowTitle("Meson Qt5 build test");
+ QLabel *label_stuff = win->findChild<QLabel *>("label_stuff");
+ if(label_stuff == nullptr) {
+ return 1;
+ }
+ int w = label_stuff->width();
+ int h = label_stuff->height();
+ label_stuff->setPixmap(QPixmap::fromImage(qi).scaled(w,h,Qt::KeepAspectRatio));
+ QLabel *label_stuff2 = win->findChild<QLabel *>("label_stuff2");
+ if(label_stuff2 == nullptr) {
+ return 1;
+ }
+ w = label_stuff2->width();
+ h = label_stuff2->height();
+ label_stuff2->setPixmap(QPixmap::fromImage(qi2).scaled(w,h,Qt::KeepAspectRatio));
+ win->show();
+ return app.exec();
+ return 0;
+}
diff --git a/test cases/frameworks/4 qt/mainWindow.cpp b/test cases/frameworks/4 qt/mainWindow.cpp
new file mode 100644
index 0000000..cc82c4f
--- /dev/null
+++ b/test cases/frameworks/4 qt/mainWindow.cpp
@@ -0,0 +1,8 @@
+#include "mainWindow.h"
+
+MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
+ setupUi(this);
+}
+
+MainWindow::~MainWindow() {
+}
diff --git a/test cases/frameworks/4 qt/mainWindow.h b/test cases/frameworks/4 qt/mainWindow.h
new file mode 100644
index 0000000..7f6d906
--- /dev/null
+++ b/test cases/frameworks/4 qt/mainWindow.h
@@ -0,0 +1,20 @@
+#ifndef MES_MAINWINDOW
+#define MES_MAINWINDOW
+
+#include <QObject>
+#include <QMainWindow>
+#include "ui_mainWindow.h"
+
+class NotificationModel;
+
+class MainWindow : public QMainWindow, private Ui_MainWindow {
+ Q_OBJECT
+
+public:
+ explicit MainWindow(QWidget *parent=0);
+ ~MainWindow();
+
+private:
+};
+
+#endif
diff --git a/test cases/frameworks/4 qt/mainWindow.ui b/test cases/frameworks/4 qt/mainWindow.ui
new file mode 100644
index 0000000..c01b8bf
--- /dev/null
+++ b/test cases/frameworks/4 qt/mainWindow.ui
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>260</width>
+ <height>313</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>241</width>
+ <height>91</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>I am a button</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_stuff">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>112</y>
+ <width>241</width>
+ <height>91</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_stuff2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>212</y>
+ <width>241</width>
+ <height>91</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/test cases/frameworks/4 qt/manualinclude.cpp b/test cases/frameworks/4 qt/manualinclude.cpp
new file mode 100644
index 0000000..60b94e5
--- /dev/null
+++ b/test cases/frameworks/4 qt/manualinclude.cpp
@@ -0,0 +1,26 @@
+#include"manualinclude.h"
+#include<QCoreApplication>
+
+#include<QObject>
+
+ManualInclude::ManualInclude() {
+}
+
+void ManualInclude::myslot(void) {
+ ;
+}
+
+class MocClass : public QObject {
+ Q_OBJECT
+};
+
+int main(int argc, char **argv) {
+ ManualInclude mi;
+ MocClass mc;
+ QObject::connect(&mi, SIGNAL(mysignal(void)),
+ &mi, SLOT(myslot(void)));
+ emit mi.mysignal();
+ return 0;
+}
+
+#include"manualinclude.moc"
diff --git a/test cases/frameworks/4 qt/manualinclude.h b/test cases/frameworks/4 qt/manualinclude.h
new file mode 100644
index 0000000..44bb7a7
--- /dev/null
+++ b/test cases/frameworks/4 qt/manualinclude.h
@@ -0,0 +1,22 @@
+#ifndef MANUALINCLUDE_H_
+#define MANUALINCLUDE_H_
+
+#include<QObject>
+
+class ManualInclude : public QObject {
+ Q_OBJECT
+
+public:
+ ManualInclude();
+#if defined(MOC_EXTRA_FLAG)
+public slots:
+#endif
+ void myslot(void);
+
+#if defined(MOC_EXTRA_FLAG)
+signals:
+#endif
+ int mysignal();
+};
+
+#endif
diff --git a/test cases/frameworks/4 qt/meson.build b/test cases/frameworks/4 qt/meson.build
new file mode 100644
index 0000000..735b3f9
--- /dev/null
+++ b/test cases/frameworks/4 qt/meson.build
@@ -0,0 +1,158 @@
+project('qt4, qt5, and qt6 build test', 'cpp',
+ # Qt6 requires C++ 17 support
+ default_options : ['cpp_std=c++17'])
+
+qt5_modules = ['Widgets']
+qt6_modules = ['Widgets']
+foreach qt : ['qt4', 'qt5', 'qt6']
+ qt_modules = ['Core', 'Gui']
+ if qt == 'qt5'
+ qt_modules += qt5_modules
+ elif qt == 'qt6'
+ qt_modules += qt6_modules
+ endif
+
+ # Test that invalid modules are indeed not found
+ fakeqtdep = dependency(qt, modules : ['DefinitelyNotFound'], required : false, method : get_option('method'))
+ if fakeqtdep.found()
+ error('Invalid qt dep incorrectly found!')
+ endif
+
+ # Test that partially-invalid modules are indeed not found
+ fakeqtdep = dependency(qt, modules : ['Core', 'DefinitelyNotFound'], required : false, method : get_option('method'))
+ if fakeqtdep.found()
+ error('Invalid qt dep incorrectly found!')
+ endif
+
+ # This test should be skipped if the required version of Qt isn't found
+ #
+ # (In the CI environment, the specified version of Qt is definitely present.
+ # An unexpected skip here is treated as a failure, so we are testing that the
+ # detection mechanism is able to find Qt.)
+ needed_qt = get_option('required').to_lower()
+ required = (qt == needed_qt)
+ if required
+ dep = dependency(qt, modules : ['Core'], required : false, method : get_option('method'))
+ if not dep.found()
+ error('MESON_SKIP_TEST @0@ not found.'.format(needed_qt))
+ endif
+ endif
+
+ # Ensure that the "no-Core-module-specified" code branch is hit
+ nocoredep = dependency(qt, modules : ['Gui'], required : required, method : get_option('method'))
+
+ # If 'qt' modules are found, test that.
+ qtdep = dependency(qt, modules : qt_modules, main : true, private_headers: true, required : required, method : get_option('method'))
+ if qtdep.found()
+ qtmodule = import(qt)
+ assert(qtmodule.has_tools())
+
+ # The following has two resource files because having two in one target
+ # requires you to do it properly or you get linker symbol clashes.
+
+ prep = qtmodule.preprocess(
+ moc_headers : ['mainWindow.h'], # These need to be fed through the moc tool before use.
+ method : get_option('method')
+ )
+ # XML files that need to be compiled with the uic tol.
+ prep += qtmodule.compile_ui(sources : 'mainWindow.ui', method: get_option('method'))
+
+ qtmodule.preprocess(
+ ui_files : 'mainWindow.ui',
+ method: get_option('method'))
+
+ # Resource file(s) for rcc compiler
+ extra_cpp_args = []
+ if meson.is_unity()
+ extra_cpp_args += '-DUNITY_BUILD'
+ prep_rcc = qtmodule.preprocess(qt + '_unity_ressource', qresources : ['stuff.qrc', 'stuff2.qrc'], method : get_option('method'))
+ else
+ prep_rcc = qtmodule.preprocess(qresources : ['stuff.qrc', 'stuff2.qrc'], method : get_option('method'))
+ endif
+
+ # Test that setting a unique name with a positional argument works
+ qtmodule.compile_resources(
+ name : qt + 'teststuff',
+ sources : files(['stuff.qrc', 'stuff2.qrc']),
+ method : get_option('method')
+ )
+
+ # Test that passing extra arguments to rcc works
+ # qt4-rcc and qt5-rcc take different arguments, for example qt4: ['-compress', '3']; qt5: '--compress=3'
+ qtmodule.preprocess(qt + 'testrccarg', qresources : files(['stuff.qrc', 'stuff2.qrc']), rcc_extra_arguments : '--compress=3', method : get_option('method'))
+
+ translations_cpp = qtmodule.compile_translations(qresource: qt+'_lang.qrc')
+ # unity builds suck and definitely cannot handle two qrc embeds in one compilation unit
+ unityproof_translations = static_library(qt+'unityproof_translations', translations_cpp, dependencies: qtdep)
+
+ extra_cpp_args += '-DQT="@0@"'.format(qt)
+ qexe = executable(qt + 'app',
+ sources : ['main.cpp', 'mainWindow.cpp', # Sources that don't need preprocessing.
+ prep, prep_rcc],
+ dependencies : qtdep,
+ link_with: unityproof_translations,
+ cpp_args: extra_cpp_args,
+ gui_app : true)
+
+ # We need a console test application because some test environments
+ # do not have an X server.
+
+ translations = qtmodule.compile_translations(ts_files : qt+'core_fr.ts', build_by_default : true)
+
+ qtcore = dependency(qt, modules : 'Core', method : get_option('method'))
+
+ qtcoreapp = executable(qt + 'core', 'q5core.cpp',
+ cpp_args: '-DQT="@0@"'.format(qt),
+ dependencies : qtcore)
+
+ test(qt + 'test', qtcoreapp)
+
+ # The build system needs to include the cpp files from
+ # headers but the user must manually include moc
+ # files from sources.
+ qtmodule.preprocess(
+ moc_extra_arguments : ['-DMOC_EXTRA_FLAG'], # This is just a random macro to test `extra_arguments`
+ moc_sources : 'manualinclude.cpp',
+ moc_headers : 'manualinclude.h',
+ method : get_option('method'))
+
+ manpreprocessed = qtmodule.compile_moc(
+ extra_args : ['-DMOC_EXTRA_FLAG'], # This is just a random macro to test `extra_arguments`
+ sources : 'manualinclude.cpp',
+ headers : 'manualinclude.h',
+ method : get_option('method'))
+
+ qtmaninclude = executable(qt + 'maninclude',
+ sources : ['manualinclude.cpp', manpreprocessed],
+ dependencies : qtcore)
+
+ test(qt + 'maninclude', qtmaninclude)
+
+ # building Qt plugins implies to give include path to moc
+ plugin_includes = include_directories('pluginInterface', 'plugin')
+ pluginpreprocess = qtmodule.preprocess(
+ moc_headers : 'plugin/plugin.h',
+ include_directories : plugin_includes
+ )
+ plugin = library(qt + 'plugin', 'plugin/plugin.cpp', pluginpreprocess,
+ include_directories : plugin_includes,
+ dependencies : qtcore)
+
+ # implementing Qt interfaces requires passing Qt include paths to moc
+ qtinterfacepreprocess = qtmodule.preprocess(
+ moc_sources : 'qtinterface.cpp',
+ dependencies : qtdep
+ )
+ qtinterface = library(qt + 'qtinterface',
+ sources : ['qtinterface.cpp', qtinterfacepreprocess],
+ dependencies : qtdep)
+
+ if qt == 'qt5'
+ subdir('subfolder')
+ endif
+
+ # Check we can apply a version constraint
+ dependency(qt, modules: qt_modules, version: '>=@0@'.format(qtdep.version()), method : get_option('method'))
+
+ endif
+endforeach
diff --git a/test cases/frameworks/4 qt/meson_options.txt b/test cases/frameworks/4 qt/meson_options.txt
new file mode 100644
index 0000000..223f4fb
--- /dev/null
+++ b/test cases/frameworks/4 qt/meson_options.txt
@@ -0,0 +1,2 @@
+option('method', type : 'string', value : 'auto', description : 'The method to use to find Qt')
+option('required', type : 'string', value : 'qt5', description : 'The version of Qt which is required to be present')
diff --git a/test cases/frameworks/4 qt/plugin/plugin.cpp b/test cases/frameworks/4 qt/plugin/plugin.cpp
new file mode 100644
index 0000000..2c013fe
--- /dev/null
+++ b/test cases/frameworks/4 qt/plugin/plugin.cpp
@@ -0,0 +1,12 @@
+#include "plugin.h"
+#include <QFile>
+
+QString plugin1::getResource()
+{
+ return "hello world";
+}
+
+
+#if QT_VERSION < 0x050000
+ Q_EXPORT_PLUGIN2(Plugin1, plugin1)
+#endif \ No newline at end of file
diff --git a/test cases/frameworks/4 qt/plugin/plugin.h b/test cases/frameworks/4 qt/plugin/plugin.h
new file mode 100644
index 0000000..c8e14e4
--- /dev/null
+++ b/test cases/frameworks/4 qt/plugin/plugin.h
@@ -0,0 +1,14 @@
+#pragma once
+#include <plugin_if.h>
+
+class plugin1:public QObject,public PluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(PluginInterface)
+#if QT_VERSION >= 0x050000
+ Q_PLUGIN_METADATA(IID "demo.PluginInterface" FILE "plugin.json")
+#endif
+
+public:
+ QString getResource() override;
+};
diff --git a/test cases/frameworks/4 qt/plugin/plugin.json b/test cases/frameworks/4 qt/plugin/plugin.json
new file mode 100644
index 0000000..6c6a011
--- /dev/null
+++ b/test cases/frameworks/4 qt/plugin/plugin.json
@@ -0,0 +1,3 @@
+{
+ "name" : "Plugin1"
+}
diff --git a/test cases/frameworks/4 qt/pluginInterface/plugin_if.h b/test cases/frameworks/4 qt/pluginInterface/plugin_if.h
new file mode 100644
index 0000000..97d2800
--- /dev/null
+++ b/test cases/frameworks/4 qt/pluginInterface/plugin_if.h
@@ -0,0 +1,21 @@
+#ifndef PLUGIN_IF_H
+#define PLUGIN_IF_H
+
+#include <QString>
+#include <QtPlugin>
+
+/**
+ * @brief Interface for a plugin
+ */
+class PluginInterface
+{
+public:
+ virtual ~PluginInterface() = default;
+
+ /// Initializes the plugin
+ virtual QString getResource() = 0;
+};
+
+Q_DECLARE_INTERFACE(PluginInterface, "demo.PluginInterface")
+
+#endif
diff --git a/test cases/frameworks/4 qt/q5core.cpp b/test cases/frameworks/4 qt/q5core.cpp
new file mode 100644
index 0000000..44581a6
--- /dev/null
+++ b/test cases/frameworks/4 qt/q5core.cpp
@@ -0,0 +1,28 @@
+#include <QCoreApplication>
+#include <QtGlobal>
+#include <QString>
+#include <QTranslator>
+#include <QLocale>
+#include <QLibraryInfo>
+#include <QDebug>
+
+int main(int argc, char **argv) {
+ QCoreApplication app(argc, argv);
+
+ QTranslator qtTranslator;
+ qtTranslator.load("qt_" + QLocale::system().name(),
+ QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+ app.installTranslator(&qtTranslator);
+
+ QTranslator myappTranslator;
+ if(!myappTranslator.load(QT "core_fr") )
+ return 1;
+
+ app.installTranslator(&myappTranslator);
+
+ qDebug() << QObject::tr("Translate me!");
+ // Don't actually start the main loop so this
+ // can be run as a unit test.
+ //return app.exec();
+ return 0;
+}
diff --git a/test cases/frameworks/4 qt/qt4_lang.qrc b/test cases/frameworks/4 qt/qt4_lang.qrc
new file mode 100644
index 0000000..a6d2b54
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt4_lang.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/lang">
+ <file>qt4embedded_fr.qm</file>
+ </qresource>
+</RCC>
+
diff --git a/test cases/frameworks/4 qt/qt4core_fr.ts b/test cases/frameworks/4 qt/qt4core_fr.ts
new file mode 100644
index 0000000..0638bd5
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt4core_fr.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="q5core.cpp" line="23"/>
+ <source>Translate me!</source>
+ <translation>Traduisez moi!</translation>
+ </message>
+</context>
+</TS>
diff --git a/test cases/frameworks/4 qt/qt4embedded_fr.ts b/test cases/frameworks/4 qt/qt4embedded_fr.ts
new file mode 100644
index 0000000..0638bd5
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt4embedded_fr.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="q5core.cpp" line="23"/>
+ <source>Translate me!</source>
+ <translation>Traduisez moi!</translation>
+ </message>
+</context>
+</TS>
diff --git a/test cases/frameworks/4 qt/qt5_lang.qrc b/test cases/frameworks/4 qt/qt5_lang.qrc
new file mode 100644
index 0000000..cf4ddc6
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt5_lang.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/lang">
+ <file>qt5embedded_fr.qm</file>
+ </qresource>
+</RCC>
+
diff --git a/test cases/frameworks/4 qt/qt5core_fr.ts b/test cases/frameworks/4 qt/qt5core_fr.ts
new file mode 100644
index 0000000..4e3116b
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt5core_fr.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="fr_FR">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="q5core.cpp" line="23"/>
+ <source>Translate me!</source>
+ <translation>Traduisez moi!</translation>
+ </message>
+</context>
+</TS>
diff --git a/test cases/frameworks/4 qt/qt5embedded_fr.ts b/test cases/frameworks/4 qt/qt5embedded_fr.ts
new file mode 100644
index 0000000..4e3116b
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt5embedded_fr.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="fr_FR">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="q5core.cpp" line="23"/>
+ <source>Translate me!</source>
+ <translation>Traduisez moi!</translation>
+ </message>
+</context>
+</TS>
diff --git a/test cases/frameworks/4 qt/qt6_lang.qrc b/test cases/frameworks/4 qt/qt6_lang.qrc
new file mode 100644
index 0000000..12cc25a
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt6_lang.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/lang">
+ <file>qt6embedded_fr.qm</file>
+ </qresource>
+</RCC>
+
diff --git a/test cases/frameworks/4 qt/qt6core_fr.ts b/test cases/frameworks/4 qt/qt6core_fr.ts
new file mode 100644
index 0000000..4e3116b
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt6core_fr.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="fr_FR">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="q5core.cpp" line="23"/>
+ <source>Translate me!</source>
+ <translation>Traduisez moi!</translation>
+ </message>
+</context>
+</TS>
diff --git a/test cases/frameworks/4 qt/qt6embedded_fr.ts b/test cases/frameworks/4 qt/qt6embedded_fr.ts
new file mode 100644
index 0000000..4e3116b
--- /dev/null
+++ b/test cases/frameworks/4 qt/qt6embedded_fr.ts
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="fr_FR">
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="q5core.cpp" line="23"/>
+ <source>Translate me!</source>
+ <translation>Traduisez moi!</translation>
+ </message>
+</context>
+</TS>
diff --git a/test cases/frameworks/4 qt/qtinterface.cpp b/test cases/frameworks/4 qt/qtinterface.cpp
new file mode 100644
index 0000000..b2da99f
--- /dev/null
+++ b/test cases/frameworks/4 qt/qtinterface.cpp
@@ -0,0 +1,8 @@
+#include <QGraphicsLayout>
+
+class Foo : public QGraphicsLayout
+{
+ Q_INTERFACES(QGraphicsLayout)
+};
+
+#include "qtinterface.moc"
diff --git a/test cases/frameworks/4 qt/stuff.qrc b/test cases/frameworks/4 qt/stuff.qrc
new file mode 100644
index 0000000..fdfb58e
--- /dev/null
+++ b/test cases/frameworks/4 qt/stuff.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource>
+ <file>thing.png</file>
+ </qresource>
+</RCC>
diff --git a/test cases/frameworks/4 qt/stuff2.qrc b/test cases/frameworks/4 qt/stuff2.qrc
new file mode 100644
index 0000000..910e2fb
--- /dev/null
+++ b/test cases/frameworks/4 qt/stuff2.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource>
+ <file>thing2.png</file>
+ </qresource>
+</RCC>
diff --git a/test cases/frameworks/4 qt/subfolder/generator.py b/test cases/frameworks/4 qt/subfolder/generator.py
new file mode 100644
index 0000000..045d99a
--- /dev/null
+++ b/test cases/frameworks/4 qt/subfolder/generator.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+import sys
+
+if len(sys.argv) > 1:
+ with open(sys.argv[1], "w") as output:
+ output.write("Hello World")
diff --git a/test cases/frameworks/4 qt/subfolder/main.cpp b/test cases/frameworks/4 qt/subfolder/main.cpp
new file mode 100644
index 0000000..9661811
--- /dev/null
+++ b/test cases/frameworks/4 qt/subfolder/main.cpp
@@ -0,0 +1,29 @@
+#include <QImage>
+#include <QFile>
+#include <QString>
+
+int main(int argc, char **argv) {
+ #ifndef UNITY_BUILD
+ Q_INIT_RESOURCE(stuff3);
+ Q_INIT_RESOURCE(stuff4);
+ #endif
+
+ for(auto fname:{":/thing.png", ":/thing4.png"})
+ {
+ QImage img1(fname);
+ if(img1.width() != 640) {
+ return 1;
+ }
+ }
+
+ for(auto fname:{":/txt_resource.txt",":/txt_resource2.txt"})
+ {
+ QFile file(fname);
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ return 1;
+ QString line = file.readLine();
+ if(line.compare("Hello World"))
+ return 1;
+ }
+ return 0;
+} \ No newline at end of file
diff --git a/test cases/frameworks/4 qt/subfolder/meson.build b/test cases/frameworks/4 qt/subfolder/meson.build
new file mode 100644
index 0000000..f1b84e6
--- /dev/null
+++ b/test cases/frameworks/4 qt/subfolder/meson.build
@@ -0,0 +1,32 @@
+
+simple_gen = find_program('generator.py', required : true)
+
+txt_resource = custom_target('txt_resource',
+ output : 'txt_resource.txt',
+ command : [simple_gen, '@OUTPUT@'],
+)
+
+cfg = configuration_data()
+
+cfg.set('filepath', meson.current_source_dir()+'/../thing2.png')
+cfg.set('txt_resource', txt_resource.full_path())
+# here we abuse the system by guessing build dir layout
+cfg.set('txt_resource2', 'txt_resource.txt')
+
+
+rc_file = configure_file(
+ configuration : cfg,
+ input : 'resources/stuff4.qrc.in',
+ output : 'stuff4.qrc',
+)
+
+extra_cpp_args = []
+if meson.is_unity()
+ extra_cpp_args += '-DUNITY_BUILD'
+ qresources = qtmodule.preprocess(qt + '_subfolder_unity_ressource',qresources : ['resources/stuff3.qrc', rc_file])
+else
+ qresources = qtmodule.preprocess(qresources : ['resources/stuff3.qrc', rc_file])
+endif
+
+app = executable('subfolder', 'main.cpp', qresources, dependencies : qtdep, cpp_args: extra_cpp_args)
+test(qt + 'subfolder', app)
diff --git a/test cases/frameworks/4 qt/subfolder/resources/stuff3.qrc b/test cases/frameworks/4 qt/subfolder/resources/stuff3.qrc
new file mode 100644
index 0000000..fdfb58e
--- /dev/null
+++ b/test cases/frameworks/4 qt/subfolder/resources/stuff3.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource>
+ <file>thing.png</file>
+ </qresource>
+</RCC>
diff --git a/test cases/frameworks/4 qt/subfolder/resources/stuff4.qrc.in b/test cases/frameworks/4 qt/subfolder/resources/stuff4.qrc.in
new file mode 100644
index 0000000..c30a358
--- /dev/null
+++ b/test cases/frameworks/4 qt/subfolder/resources/stuff4.qrc.in
@@ -0,0 +1,8 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource>
+ <file alias="thing4.png">@filepath@</file>
+ <file alias="txt_resource.txt">@txt_resource@</file>
+ <file alias="txt_resource2.txt">@txt_resource2@</file>
+ </qresource>
+</RCC>
diff --git a/test cases/frameworks/4 qt/subfolder/resources/thing.png b/test cases/frameworks/4 qt/subfolder/resources/thing.png
new file mode 100644
index 0000000..4b001bd
--- /dev/null
+++ b/test cases/frameworks/4 qt/subfolder/resources/thing.png
Binary files differ
diff --git a/test cases/frameworks/4 qt/test.json b/test cases/frameworks/4 qt/test.json
new file mode 100644
index 0000000..4df0b49
--- /dev/null
+++ b/test cases/frameworks/4 qt/test.json
@@ -0,0 +1,12 @@
+{
+ "matrix": {
+ "options": {
+ "method": [
+ { "val": "config-tool" },
+ { "val": "qmake" },
+ { "val": "pkg-config" }
+ ]
+ }
+ },
+ "skip_on_jobname": ["cygwin", "msys2", "azure"]
+}
diff --git a/test cases/frameworks/4 qt/thing.png b/test cases/frameworks/4 qt/thing.png
new file mode 100644
index 0000000..4b001bd
--- /dev/null
+++ b/test cases/frameworks/4 qt/thing.png
Binary files differ
diff --git a/test cases/frameworks/4 qt/thing2.png b/test cases/frameworks/4 qt/thing2.png
new file mode 100644
index 0000000..4b001bd
--- /dev/null
+++ b/test cases/frameworks/4 qt/thing2.png
Binary files differ