]> rtime.felk.cvut.cz Git - omk.git/blobdiff - tests/qt
Update wvtool
[omk.git] / tests / qt
index 7e2dc65a7c9d943a761a16c2cc18f876fe4bfd6c..575196a00561dfbca89b09584f6592be1f11965d 100755 (executable)
--- a/tests/qt
+++ b/tests/qt
@@ -1,6 +1,7 @@
 #!/bin/bash
 
-[[ $OMK_RULES != linux ]] && exit 0
+[ "$OMK_RULES" -a "$OMK_RULES" != linux ] && exit 0
+
 
 . ./functions.sh
 
@@ -9,4 +10,106 @@ QTDIR=/usr/share/qt4
 export QTDIR
 [ -d $QTDIR ] || canttest "Can't find QT4 instalation"
 
-. ./test.inc
+# Function to create a QT app using an OMK-built library
+function create_qt_app() {
+    mkdir 'somelib'
+    cat > 'somelib/somelib.c' <<'EOF'
+#include <header.h>
+
+int some_function(int num)
+{
+    return SOME_CONST - num;
+}
+EOF
+    cat > 'somelib/Makefile.omk' <<'EOF'
+include_HEADERS = header.h
+shared_LIBRARIES = somelib
+
+
+somelib_SOURCES = somelib.c
+EOF
+    cat > 'somelib/header.h' <<'EOF'
+#ifndef HEADER_H
+#define HEADER_H
+
+#define SOME_CONST 123
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int some_function(int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+EOF
+    mkdir 'qtapp'
+    cat > 'qtapp/qtapp.cxx' <<'EOF'
+#include <QApplication>
+#include <QPushButton>
+#include <header.h>
+
+ int main(int argc, char *argv[])
+ {
+     QApplication app(argc, argv);
+
+     some_function(SOME_CONST);
+     QPushButton hello("Hello world!");
+     hello.resize(100, 30);
+
+     hello.show();
+     return app.exec();
+ }
+EOF
+    cat > 'qtapp/qtapp.pro' <<'EOF'
+######################################################################
+# Automatically generated by qmake (2.01a) po ?rc 16 18:49:31 2007
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += qtapp.cxx
+LIBS+=-lsomelib
+EOF
+}
+
+############################
+# The actual tests
+############################
+
+WVSTART "QT_SUBDIRS in top-level Makefile.omk"
+create_qt_app
+cat > 'Makefile.omk' <<'EOF'
+SUBDIRS = somelib
+QT_SUBDIRS = qtapp
+EOF
+omkize
+WVPASS make V=1
+WVPASS test -x _compiled/bin/qtapp
+
+WVSTART "QT_SUBDIRS in a subdir"
+create_qt_app
+echo "SUBDIRS = somelib dir" > Makefile.omk
+mkdir 'dir'
+mv qtapp dir
+echo 'QT_SUBDIRS = qtapp' > 'dir/Makefile.omk'
+omkize
+WVPASS make
+WVPASS test -x _compiled/bin/qtapp
+
+WVSTART "QT_PROJECTS variable"
+create_qt_app
+echo 'QT_PROJECTS=qtapp.pro' > 'qtapp/Makefile.omk'
+echo "SUBDIRS = somelib qtapp" > Makefile.omk
+omkize
+WVPASS make
+WVPASS test -x _compiled/bin/qtapp
+
+make clean