tests: adapted Qt test for multiple rcc files

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
pull/2579/head
Markus Theil 7 years ago
parent 3f8a082a68
commit 91c07aa301
  1. 17
      test cases/frameworks/4 qt/main.cpp
  2. 24
      test cases/frameworks/4 qt/mainWindow.ui
  3. 2
      test cases/frameworks/4 qt/meson.build

@ -2,6 +2,8 @@
#include "mainWindow.h" #include "mainWindow.h"
int main(int argc, char **argv) { int main(int argc, char **argv) {
Q_INIT_RESOURCE(stuff);
Q_INIT_RESOURCE(stuff2);
QApplication app(argc, argv); QApplication app(argc, argv);
MainWindow *win = new MainWindow(); MainWindow *win = new MainWindow();
QImage qi(":/thing.png"); QImage qi(":/thing.png");
@ -13,7 +15,20 @@ int main(int argc, char **argv) {
return 1; return 1;
} }
win->setWindowTitle("Meson Qt5 build test"); 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(); win->show();
return app.exec(); return app.exec();
return 0; return 0;

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>270</width> <width>260</width>
<height>115</height> <height>313</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -27,6 +27,26 @@
<string>I am a button</string> <string>I am a button</string>
</property> </property>
</widget> </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>
</widget> </widget>
<resources/> <resources/>

@ -40,7 +40,7 @@ foreach qt : ['qt4', 'qt5']
) )
# Test that setting a unique name with a positional argument works # Test that setting a unique name with a positional argument works
qtmodule.preprocess(qt + 'teststuff', qresources : ['stuff.qrc'], method : get_option('method')) qtmodule.preprocess(qt + 'teststuff', qresources : ['stuff.qrc', 'stuff2.qrc'], method : get_option('method'))
qexe = executable(qt + 'app', qexe = executable(qt + 'app',
sources : ['main.cpp', 'mainWindow.cpp', # Sources that don't need preprocessing. sources : ['main.cpp', 'mainWindow.cpp', # Sources that don't need preprocessing.

Loading…
Cancel
Save