diff options
author | Joerg Bornemann <joerg.bornemann@nokia.com> | 2012-02-15 15:56:22 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-02-15 21:57:41 +0100 |
commit | 5672fa8fd3bd6b09125d9e143a7bb277cea2e87f (patch) | |
tree | c945b6ad76bd8c8f6af8b520cf3ce72ef298d4b5 /tests |
Long live qbs!
Change-Id: I412793e868919a9ac99611616f292e7047f1ebcf
Diffstat (limited to 'tests')
125 files changed, 4766 insertions, 0 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro new file mode 100644 index 000000000..8291acce4 --- /dev/null +++ b/tests/auto/auto.pro @@ -0,0 +1,8 @@ +TEMPLATE=subdirs +SUBDIRS=\ + options\ + tools\ + blackbox + +# dependencyFinder\ + diff --git a/tests/auto/blackbox/blackbox.pro b/tests/auto/blackbox/blackbox.pro new file mode 100644 index 000000000..40d1a5dea --- /dev/null +++ b/tests/auto/blackbox/blackbox.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +TARGET = testBlackbox +DEPENDPATH += . +DESTDIR = ../../../bin/ +INCLUDEPATH += . ../../../src/lib/ +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +QT = core script testlib + +include(../../../src/lib/use.pri) + +SOURCES += \ + tst_blackbox.cpp + diff --git a/tests/auto/blackbox/testdata/buildproperties_source/bp_source.qbp b/tests/auto/blackbox/testdata/buildproperties_source/bp_source.qbp new file mode 100644 index 000000000..0d6cb5741 --- /dev/null +++ b/tests/auto/blackbox/testdata/buildproperties_source/bp_source.qbp @@ -0,0 +1,16 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "HelloWorld" + + Depends { name: 'cpp' } + + Group { + cpp.defines: ['WORLD="BANANA"'] + files : [ "main.cpp" ] + } + } +} + diff --git a/tests/auto/blackbox/testdata/buildproperties_source/main.cpp b/tests/auto/blackbox/testdata/buildproperties_source/main.cpp new file mode 100644 index 000000000..fbae63cf0 --- /dev/null +++ b/tests/auto/blackbox/testdata/buildproperties_source/main.cpp @@ -0,0 +1,47 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#ifndef WORLD +# error WORLD is not defined +#endif + +int main() +{ + puts("Hello " WORLD "!"); +} diff --git a/tests/auto/blackbox/testdata/moc_h/bla.cpp b/tests/auto/blackbox/testdata/moc_h/bla.cpp new file mode 100644 index 000000000..9045af23d --- /dev/null +++ b/tests/auto/blackbox/testdata/moc_h/bla.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "bla.h" + +int main() +{ + MyObject obj; + obj.setObjectName("I am the object!"); +} diff --git a/tests/auto/blackbox/testdata/moc_h/bla_noqobject.h b/tests/auto/blackbox/testdata/moc_h/bla_noqobject.h new file mode 100644 index 000000000..54e7cbd8f --- /dev/null +++ b/tests/auto/blackbox/testdata/moc_h/bla_noqobject.h @@ -0,0 +1,43 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <QObject> + +class MyObject : public QObject +{ +}; + diff --git a/tests/auto/blackbox/testdata/moc_h/bla_qobject.h b/tests/auto/blackbox/testdata/moc_h/bla_qobject.h new file mode 100644 index 000000000..4f58ed10a --- /dev/null +++ b/tests/auto/blackbox/testdata/moc_h/bla_qobject.h @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <QObject> + +class MyObject : public QObject +{ + Q_OBJECT +}; + diff --git a/tests/auto/blackbox/testdata/moc_h/i.qbp b/tests/auto/blackbox/testdata/moc_h/i.qbp new file mode 100644 index 000000000..0e103ecd9 --- /dev/null +++ b/tests/auto/blackbox/testdata/moc_h/i.qbp @@ -0,0 +1,18 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "i" + + Depends { + name: "Qt.core" + } + + files: [ + "bla.cpp", + "bla.h" + ] + } +} + diff --git a/tests/auto/blackbox/testdata/qrc/bla.cpp b/tests/auto/blackbox/testdata/qrc/bla.cpp new file mode 100644 index 000000000..cbb85fa03 --- /dev/null +++ b/tests/auto/blackbox/testdata/qrc/bla.cpp @@ -0,0 +1,42 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +int main() +{ + return 3; +} + diff --git a/tests/auto/blackbox/testdata/qrc/bla.qrc b/tests/auto/blackbox/testdata/qrc/bla.qrc new file mode 100644 index 000000000..46c93847e --- /dev/null +++ b/tests/auto/blackbox/testdata/qrc/bla.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>stuff.txt</file> + </qresource> +</RCC> diff --git a/tests/auto/blackbox/testdata/qrc/i.qbp b/tests/auto/blackbox/testdata/qrc/i.qbp new file mode 100644 index 000000000..11b9d1be3 --- /dev/null +++ b/tests/auto/blackbox/testdata/qrc/i.qbp @@ -0,0 +1,19 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "i" + + Depends { + name: "Qt.core" + } + + files: [ + "bla.cpp", + "bla.qrc", + "stuff.txt" + ] + } +} + diff --git a/tests/auto/blackbox/testdata/qrc/stuff.txt b/tests/auto/blackbox/testdata/qrc/stuff.txt new file mode 100644 index 000000000..78f0d32c6 --- /dev/null +++ b/tests/auto/blackbox/testdata/qrc/stuff.txt @@ -0,0 +1 @@ +a resource file diff --git a/tests/auto/blackbox/testdata/trackAddFile/after/main.cpp b/tests/auto/blackbox/testdata/trackAddFile/after/main.cpp new file mode 100644 index 000000000..749b6c2d1 --- /dev/null +++ b/tests/auto/blackbox/testdata/trackAddFile/after/main.cpp @@ -0,0 +1,50 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#include "narf.h" +#include "zort.h" +#include <cstdio> + +int main(int argc, char **argv) +{ + printf("Hello World!\n"); + Narf narf; + narf.shout(); + Zort zort; + zort.shout(); + return 0; +} + diff --git a/tests/auto/blackbox/testdata/trackAddFile/after/project.qbp b/tests/auto/blackbox/testdata/trackAddFile/after/project.qbp new file mode 100644 index 000000000..2e3a56102 --- /dev/null +++ b/tests/auto/blackbox/testdata/trackAddFile/after/project.qbp @@ -0,0 +1,15 @@ +import qbs.base 1.0 + +Project { + Product { + name: 'someapp' + type: 'application' + Depends { name: 'cpp' } + files: [ + "main.cpp", + "narf.h", "narf.cpp", + "zort.h", "zort.cpp" + ] + } +} + diff --git a/tests/auto/blackbox/testdata/trackAddFile/after/zort.cpp b/tests/auto/blackbox/testdata/trackAddFile/after/zort.cpp new file mode 100644 index 000000000..336ff5fda --- /dev/null +++ b/tests/auto/blackbox/testdata/trackAddFile/after/zort.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#include "zort.h" +#include <cstdio> + +void Zort::shout() +{ + printf("ZORT!\n"); +} + diff --git a/tests/auto/blackbox/testdata/trackAddFile/after/zort.h b/tests/auto/blackbox/testdata/trackAddFile/after/zort.h new file mode 100644 index 000000000..b94b70e27 --- /dev/null +++ b/tests/auto/blackbox/testdata/trackAddFile/after/zort.h @@ -0,0 +1,47 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#ifndef ZORT_H +#define ZORT_H + +class Zort +{ +public: + void shout(); +}; + +#endif + diff --git a/tests/auto/blackbox/testdata/trackAddFile/before/main.cpp b/tests/auto/blackbox/testdata/trackAddFile/before/main.cpp new file mode 100644 index 000000000..2fec2b365 --- /dev/null +++ b/tests/auto/blackbox/testdata/trackAddFile/before/main.cpp @@ -0,0 +1,47 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#include "narf.h" +#include <cstdio> + +int main(int argc, char **argv) +{ + printf("Hello World!\n"); + Narf narf; + narf.shout(); + return 0; +} + diff --git a/tests/auto/blackbox/testdata/trackAddFile/before/narf.cpp b/tests/auto/blackbox/testdata/trackAddFile/before/narf.cpp new file mode 100644 index 000000000..5c04c9d7c --- /dev/null +++ b/tests/auto/blackbox/testdata/trackAddFile/before/narf.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#include "narf.h" +#include <cstdio> + +void Narf::shout() +{ + printf("NARF!\n"); +} + diff --git a/tests/auto/blackbox/testdata/trackAddFile/before/narf.h b/tests/auto/blackbox/testdata/trackAddFile/before/narf.h new file mode 100644 index 000000000..afc73511f --- /dev/null +++ b/tests/auto/blackbox/testdata/trackAddFile/before/narf.h @@ -0,0 +1,47 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#ifndef NARF_H +#define NARF_H + +class Narf +{ +public: + void shout(); +}; + +#endif + diff --git a/tests/auto/blackbox/testdata/trackAddFile/before/project.qbp b/tests/auto/blackbox/testdata/trackAddFile/before/project.qbp new file mode 100644 index 000000000..222788b6a --- /dev/null +++ b/tests/auto/blackbox/testdata/trackAddFile/before/project.qbp @@ -0,0 +1,11 @@ +import qbs.base 1.0 + +Project { + Product { + name: 'someapp' + type: 'application' + Depends { name: 'cpp' } + files: [ "main.cpp", "narf.h", "narf.cpp" ] + } +} + diff --git a/tests/auto/blackbox/testdata/trackFileTags/after/main.cpp b/tests/auto/blackbox/testdata/trackFileTags/after/main.cpp new file mode 100644 index 000000000..fb5a86b9c --- /dev/null +++ b/tests/auto/blackbox/testdata/trackFileTags/after/main.cpp @@ -0,0 +1,46 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#include <cstdio> + +int foo(); + +int main(int argc, char **argv) +{ + printf("there's %d foo here\n", foo()); + return 0; +} + diff --git a/tests/auto/blackbox/testdata/trackFileTags/after/project.qbp b/tests/auto/blackbox/testdata/trackFileTags/after/project.qbp new file mode 100644 index 000000000..453658e98 --- /dev/null +++ b/tests/auto/blackbox/testdata/trackFileTags/after/project.qbp @@ -0,0 +1,51 @@ +import qbs.base 1.0 + +Project { + Product { + name: 'someapp' + type: 'application' + Depends { name: 'cpp' } + Group { + files: [ "main.cpp" ] + fileTags: [ "foosource", "cpp" ] + } + } + + Rule { + inputs: ["foosource"] + Artifact { + fileName: input.baseName + ".foo" + fileTags: ["foo"] + } + + prepare: { + var cmd = new JavaScriptCommand(); + cmd.sourceCode = "var file = new TextFile(output.fileName, TextFile.WriteOnly);"; + cmd.sourceCode += "file.truncate();" + cmd.sourceCode += "file.write(\"There's nothing to see here!\");" + cmd.sourceCode += "file.close();" + cmd.description = "generating something"; + return cmd; + } + } + + Rule { + inputs: ["foo"] + Artifact { + fileName: input.baseName + "_foo.cpp" + fileTags: ["cpp"] + } + + prepare: { + var cmd = new JavaScriptCommand(); + cmd.sourceCode = "var file = new TextFile(output.fileName, TextFile.WriteOnly);"; + cmd.sourceCode += "file.truncate();"; + cmd.sourceCode += "file.write(\"// There's nothing to see here!\\n\");"; + cmd.sourceCode += "file.write(\"int foo() { return 15; }\\n\");"; + cmd.sourceCode += "file.close();"; + cmd.description = "generating something"; + return cmd; + } + } +} + diff --git a/tests/auto/blackbox/testdata/trackFileTags/before/main.cpp b/tests/auto/blackbox/testdata/trackFileTags/before/main.cpp new file mode 100644 index 000000000..fe6c86168 --- /dev/null +++ b/tests/auto/blackbox/testdata/trackFileTags/before/main.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#include <cstdio> + +int main(int argc, char **argv) +{ + printf("there's no foo here\n"); + return 0; +} + diff --git a/tests/auto/blackbox/testdata/trackFileTags/before/project.qbp b/tests/auto/blackbox/testdata/trackFileTags/before/project.qbp new file mode 100644 index 000000000..50400f157 --- /dev/null +++ b/tests/auto/blackbox/testdata/trackFileTags/before/project.qbp @@ -0,0 +1,51 @@ +import qbs.base 1.0 + +Project { + Product { + name: 'someapp' + type: 'application' + Depends { name: 'cpp' } + Group { + files: [ "main.cpp" ] + fileTags: [ "cpp" ] + } + } + + Rule { + inputs: ["foosource"] + Artifact { + fileName: input.baseName + ".foo" + fileTags: ["foo"] + } + + prepare: { + var cmd = new JavaScriptCommand(); + cmd.sourceCode = "var file = new TextFile(output.fileName, TextFile.WriteOnly);"; + cmd.sourceCode += "file.truncate();" + cmd.sourceCode += "file.write(\"There's nothing to see here!\");" + cmd.sourceCode += "file.close();" + cmd.description = "generating something"; + return cmd; + } + } + + Rule { + inputs: ["foo"] + Artifact { + fileName: input.baseName + "_foo.cpp" + fileTags: ["cpp"] + } + + prepare: { + var cmd = new JavaScriptCommand(); + cmd.sourceCode = "var file = new TextFile(output.fileName, TextFile.WriteOnly);"; + cmd.sourceCode += "file.truncate();"; + cmd.sourceCode += "file.write(\"// There's nothing to see here!\\n\");"; + cmd.sourceCode += "file.write(\"int foo() { return 15; }\\n\");"; + cmd.sourceCode += "file.close();"; + cmd.description = "generating something"; + return cmd; + } + } +} + diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp new file mode 100644 index 000000000..9bf6b7d87 --- /dev/null +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -0,0 +1,395 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <QtCore/QFileInfo> +#include <QtCore/QProcess> +#include <QtCore/QFile> +#include <QtCore/QCoreApplication> +#include <QtTest/QtTest> + +#ifdef Q_OS_LINUX +#include <unistd.h> +#endif + +class TestBlackbox : public QObject +{ + Q_OBJECT + const QString testDataDir; + const QString testSourceDir; + const QString executableSuffix; + const QString objectSuffix; +public: + TestBlackbox() + : testDataDir(QCoreApplication::applicationDirPath() + "/testdata"), + testSourceDir(QDir::cleanPath(SRCDIR "/testdata")), + #ifdef Q_OS_WIN + executableSuffix(QLatin1String(".exe")), + #else + executableSuffix(QLatin1String("")), + #endif + #ifdef Q_OS_WIN + objectSuffix(QLatin1String(".obj")) + #else + objectSuffix(QLatin1String(".o")) + #endif + { + } + +protected: + + int runQbs(QStringList arguments = QStringList(), bool showOutput = false) + { + QString cmdLine = QCoreApplication::applicationDirPath() + "/qbs"; + foreach (const QString &str, arguments) + cmdLine += QLatin1String(" \"") + str + QLatin1Char('"'); + + int r; + if (showOutput) { + r = system(cmdLine.toLatin1()); + } else { + QProcess process; + process.start(cmdLine); + process.waitForStarted(); + process.waitForFinished(); + r = process.exitCode(); + } + return r; + } + + /*! + Recursive copy from directory to another. + Note that this updates the file stamps on Linux but not on Windows. + */ + void ccp(const QString &from, const QString &to) + { + QDirIterator it(from, QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden); + while (it.hasNext()) { + it.next(); + QDir().mkpath(to + "/" + it.fileName()); + ccp(from + "/" + it.fileName(), to + "/" + it.fileName()); + } + + QDirIterator it2(from, QDir::Files| QDir::NoDotAndDotDot | QDir::Hidden); + while (it2.hasNext()) { + it2.next(); + const QString dstFilePath = to + "/" + it2.fileName(); + if (QFile::exists(dstFilePath)) + QFile::remove(dstFilePath); + QFile(from + "/" + it2.fileName()).copy(dstFilePath); + } + } + + void rmDirR(const QString &dir) + { + QDirIterator it(dir, QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden); + while (it.hasNext()) { + QFile(it.next()).remove(); + } + + QDirIterator it2(dir, QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden); + while (it2.hasNext()) { + rmDirR(it2.next()); + } + QDir().rmdir(dir); + } + + void touch(const QString &fn) + { + QFile f(fn); + int s = f.size(); + if (!f.open(QFile::ReadWrite)) + qFatal("cannot open file %s", qPrintable(fn)); + f.resize(s+1); + f.resize(s); + } + +public slots: + void init() + { + rmDirR(testDataDir); + QDir().mkpath(testDataDir); + ccp(testSourceDir, testDataDir); + } + + void cleanup() + { +// rmDirR(testDataDir); + } + +private slots: + void build_project_data() + { + QTest::addColumn<QString>("projectSubDir"); + QTest::addColumn<QString>("productFileName"); + QTest::newRow("BPs in Sources") + << QString("buildproperties_source") + << QString("build/debug/HelloWorld"); + } + + void build_project() + { + QFETCH(QString, projectSubDir); + QFETCH(QString, productFileName); + if (!projectSubDir.startsWith('/')) + projectSubDir.prepend('/'); + QDir::setCurrent(testDataDir + projectSubDir); + qDebug() << "currentdir set" << testDataDir + projectSubDir; + qDebug() << "currentdir" << QDir::currentPath(); + productFileName.append(executableSuffix); + QCOMPARE(runQbs(), 0); + QVERIFY(QFile::exists(productFileName)); + QVERIFY(QFile::remove(productFileName)); + QCOMPARE(runQbs(), 0); + QVERIFY(QFile::exists(productFileName)); + } + + void track_qrc() + { + QDir::setCurrent(testDataDir + "/qrc"); + QCOMPARE(runQbs(), 0); + QString fileName = "build/debug/i" + executableSuffix; + QVERIFY(QFile(fileName).exists()); + QDateTime dt = QFileInfo(fileName).lastModified(); + QTest::qSleep(2020); + { + QFile f("stuff.txt"); + f.remove(); + QVERIFY(f.open(QFile::WriteOnly)); + f.write("bla"); + f.close(); + } + QCOMPARE(runQbs(), 0); + QVERIFY(QFile(fileName).exists()); + QVERIFY(dt < QFileInfo(fileName).lastModified()); + } + + void track_qobject_change() + { + QDir::setCurrent(testDataDir + "/moc_h"); + QFile("bla.h").remove(); + QVERIFY(QFile("bla_qobject.h").copy("bla.h")); + touch("bla.h"); + QCOMPARE(runQbs(), 0); + QVERIFY(QFile("build/debug/i" + executableSuffix).exists()); + QString moc_bla_objectFileName = "build/debug/.obj/i/GeneratedFiles/i/moc_bla" + objectSuffix; + QVERIFY(QFile(moc_bla_objectFileName).exists()); + + QTest::qSleep(1000); + QFile("bla.h").remove(); + QVERIFY(QFile("bla_noqobject.h").copy("bla.h")); + touch("bla.h"); + QCOMPARE(runQbs(), 0); + QVERIFY(QFile("build/debug/i" + executableSuffix).exists()); + QVERIFY(!QFile(moc_bla_objectFileName).exists()); + } + + void trackAddFile() + { + QProcess process; + QList<QByteArray> output; + QDir::setCurrent(testDataDir + "/trackAddFile"); + if (QFile::exists("work")) + rmDirR("work"); + QDir().mkdir("work"); + ccp("before", "work"); + QDir::setCurrent(testDataDir + "/trackAddFile/work"); + QCOMPARE(runQbs(), 0); + + process.start("build/debug/someapp"); + QVERIFY(process.waitForStarted()); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + output = process.readAllStandardOutput().split('\n'); + QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!"); + QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!"); + QString unchangedObjectFile = "build/debug/someapp/narf" + objectSuffix; + QDateTime unchangedObjectFileTime1 = QFileInfo(unchangedObjectFile).lastModified(); + + QTest::qWait(1000); // for file systems with low resolution timestamps + ccp("../after", "."); + touch("project.qbp"); + touch("main.cpp"); + QCOMPARE(runQbs(), 0); + + process.start("build/debug/someapp"); + QVERIFY(process.waitForStarted()); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + output = process.readAllStandardOutput().split('\n'); + QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!"); + QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!"); + QCOMPARE(output.takeFirst().trimmed().constData(), "ZORT!"); + + // the object file of the untouched source should not have changed + QDateTime unchangedObjectFileTime2 = QFileInfo(unchangedObjectFile).lastModified(); + QCOMPARE(unchangedObjectFileTime1, unchangedObjectFileTime2); + } + + void trackRemoveFile() + { + QProcess process; + QList<QByteArray> output; + QDir::setCurrent(testDataDir + "/trackAddFile"); + if (QFile::exists("work")) + rmDirR("work"); + QDir().mkdir("work"); + ccp("before", "work"); + ccp("after", "work"); + QDir::setCurrent(testDataDir + "/trackAddFile/work"); + QCOMPARE(runQbs(), 0); + + process.start("build/debug/someapp"); + QVERIFY(process.waitForStarted()); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + output = process.readAllStandardOutput().split('\n'); + QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!"); + QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!"); + QCOMPARE(output.takeFirst().trimmed().constData(), "ZORT!"); + QString unchangedObjectFile = "build/debug/someapp/narf" + objectSuffix; + QDateTime unchangedObjectFileTime1 = QFileInfo(unchangedObjectFile).lastModified(); + + QTest::qWait(1000); // for file systems with low resolution timestamps + QFile::remove("project.qbp"); + QFile::remove("main.cpp"); + ccp("../before/project.qbp", "."); + ccp("../before/main.cpp", "."); + QFile::copy("../before/project.qbp", "project.qbp"); + QFile::copy("../before/main.cpp", "main.cpp"); + QVERIFY(QFile::remove("zort.h")); + QVERIFY(QFile::remove("zort.cpp")); + touch("main.cpp"); + touch("project.qbp"); + QCOMPARE(runQbs(), 0); + + process.start("build/debug/someapp"); + QVERIFY(process.waitForStarted()); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + output = process.readAllStandardOutput().split('\n'); + QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!"); + QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!"); + + // the object file of the untouched source should not have changed + QDateTime unchangedObjectFileTime2 = QFileInfo(unchangedObjectFile).lastModified(); + QCOMPARE(unchangedObjectFileTime1, unchangedObjectFileTime2); + + // the object file for the removed cpp file should have vanished too + QCOMPARE(QFile::exists("build/debug/someapp/zort" + objectSuffix), false); + } + + void trackAddFileTag() + { + QProcess process; + QList<QByteArray> output; + QDir::setCurrent(testDataDir + "/trackFileTags"); + if (QFile::exists("work")) + rmDirR("work"); + QDir().mkdir("work"); + ccp("before", "work"); + QDir::setCurrent(testDataDir + "/trackFileTags/work"); + QCOMPARE(runQbs(), 0); + + process.start("build/debug/someapp"); + QVERIFY(process.waitForStarted()); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + output = process.readAllStandardOutput().split('\n'); + QCOMPARE(output.takeFirst().trimmed().constData(), "there's no foo here"); + + QTest::qWait(1000); // for file systems with low resolution timestamps + ccp("../after", "."); + touch("main.cpp"); + touch("project.qbp"); + QCOMPARE(runQbs(), 0); + + process.start("build/debug/someapp"); + QVERIFY(process.waitForStarted()); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + output = process.readAllStandardOutput().split('\n'); + QCOMPARE(output.takeFirst().trimmed().constData(), "there's 15 foo here"); + } + + void trackRemoveFileTag() + { + QProcess process; + QList<QByteArray> output; + QDir::setCurrent(testDataDir + "/trackFileTags"); + if (QFile::exists("work")) + rmDirR("work"); + QDir().mkdir("work"); + ccp("after", "work"); + QDir::setCurrent(testDataDir + "/trackFileTags/work"); + QCOMPARE(runQbs(), 0); + + // check if the artifacts are here that will become stale in the 2nd step + QCOMPARE(QFile::exists("build/debug/.obj/someapp/main_foo" + objectSuffix), true); + QCOMPARE(QFile::exists("build/debug/main_foo.cpp"), true); + QCOMPARE(QFile::exists("build/debug/main.foo"), true); + + process.start("build/debug/someapp"); + QVERIFY(process.waitForStarted()); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + output = process.readAllStandardOutput().split('\n'); + QCOMPARE(output.takeFirst().trimmed().constData(), "there's 15 foo here"); + + QTest::qWait(1000); // for file systems with low resolution timestamps + ccp("../before", "."); + touch("main.cpp"); + touch("project.qbp"); + QCOMPARE(runQbs(), 0); + + process.start("build/debug/someapp"); + QVERIFY(process.waitForStarted()); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + output = process.readAllStandardOutput().split('\n'); + QCOMPARE(output.takeFirst().trimmed().constData(), "there's no foo here"); + + // check if stale artifacts have been removed + QCOMPARE(QFile::exists("build/debug/someapp/main_foo" + objectSuffix), false); + QCOMPARE(QFile::exists("build/debug/someapp/main_foo.cpp"), false); + QCOMPARE(QFile::exists("build/debug/someapp/main.foo"), false); + } + +}; + +QTEST_MAIN(TestBlackbox) + +#include "tst_blackbox.moc" diff --git a/tests/auto/dependencyFinder/dependencyFinder.pro b/tests/auto/dependencyFinder/dependencyFinder.pro new file mode 100644 index 000000000..7ecd2cbe4 --- /dev/null +++ b/tests/auto/dependencyFinder/dependencyFinder.pro @@ -0,0 +1,10 @@ +TEMPLATE = app +TARGET = testDependencyFinder +DEPENDPATH += . +INCLUDEPATH += . ../../../src/lib/ +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +QT = core script testlib + +SOURCES += \ + tst_dependencyFinder.cpp diff --git a/tests/auto/dependencyFinder/order_basic1.qbs b/tests/auto/dependencyFinder/order_basic1.qbs new file mode 100644 index 000000000..5a8529b80 --- /dev/null +++ b/tests/auto/dependencyFinder/order_basic1.qbs @@ -0,0 +1,4 @@ +Project { + foo: bar + bar: 2 +} diff --git a/tests/auto/dependencyFinder/order_basic2.qbs b/tests/auto/dependencyFinder/order_basic2.qbs new file mode 100644 index 000000000..8c0979870 --- /dev/null +++ b/tests/auto/dependencyFinder/order_basic2.qbs @@ -0,0 +1,5 @@ +Project { + bar: car + foo: bar + car: 1 +} diff --git a/tests/auto/dependencyFinder/order_complex1.qbs b/tests/auto/dependencyFinder/order_complex1.qbs new file mode 100644 index 000000000..aba10cacf --- /dev/null +++ b/tests/auto/dependencyFinder/order_complex1.qbs @@ -0,0 +1,8 @@ +Project { + bar: car + foo + def + foo: def + car: foo + abc + blub + abc: foo + blub + def: 12 + blub + blub: 24 +} diff --git a/tests/auto/dependencyFinder/order_nodeps.qbs b/tests/auto/dependencyFinder/order_nodeps.qbs new file mode 100644 index 000000000..54cecaf19 --- /dev/null +++ b/tests/auto/dependencyFinder/order_nodeps.qbs @@ -0,0 +1,4 @@ +Project { + foo: 1 + bar: 2 +} diff --git a/tests/auto/dependencyFinder/test1.qbs b/tests/auto/dependencyFinder/test1.qbs new file mode 100644 index 000000000..dd0e11325 --- /dev/null +++ b/tests/auto/dependencyFinder/test1.qbs @@ -0,0 +1,16 @@ +Module { + includePaths: foo + abc.def + foo: bar + + car: { + var x = 12 + x = 13 + var aaa = function aa(x1, x2) { + function bbb() { bbb() } + x = x1 + x2 + x2.def + aa(x1, x2) + bbb(); + } + return aaa(x, includePaths) + } +} diff --git a/tests/auto/dependencyFinder/tst_dependencyFinder.cpp b/tests/auto/dependencyFinder/tst_dependencyFinder.cpp new file mode 100644 index 000000000..9c2ac693e --- /dev/null +++ b/tests/auto/dependencyFinder/tst_dependencyFinder.cpp @@ -0,0 +1,569 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <QtTest/QtTest> +#include <QtScript/QScriptEngine> +#include <QtScript/QScriptProgram> + +using namespace QmlJS::AST; + +class Function +{ +public: + QString name; + QString code; +}; + +class Property +{ +public: + QString name; + QString code; + QList<QStringList> dependencies; + QList<QStringList> sideEffects; +}; + +class Object +{ +public: + QString prototype; + QList<Object> objects; + QHash<QString, Property> properties; + QHash<QString, Function> functions; +}; + +template <typename T> +static QString textOf(const QString &source, T *node) +{ + return source.mid(node->firstSourceLocation().begin(), node->lastSourceLocation().end() - node->firstSourceLocation().begin()); +} + +static QList<QStringList> stripLocals(const QList<QStringList> &deps, const QStringList &locals) +{ + QList<QStringList> result; + foreach (const QStringList &dep, deps) { + if (!locals.contains(dep.first())) + result.append(dep); + } + return result; +} + +// run on a statement/expression to find its deps and side effect targets +class DependencyFinder : protected QmlJS::AST::Visitor +{ +public: + DependencyFinder(); + + void operator()(Node *node) + { + m_deps.clear(); + m_sideEffects.clear(); + m_locals.clear(); + Node::accept(node, this); + m_deps = stripLocals(m_deps, m_locals); + m_sideEffects = stripLocals(m_sideEffects, m_locals); + } + + QList<QStringList> dependencies() const + { + return m_deps; + } + + QList<QStringList> sideEffects() const + { + return m_sideEffects; + } + +protected: + using Visitor::visit; + + // local vars, not external deps + bool visit(VariableDeclaration *ast); + bool visit(FunctionDeclaration *ast); + bool visit(FunctionExpression *ast); + + // deps + bool visit(IdentifierExpression *ast); + bool visit(FieldMemberExpression *ast); + bool visit(ArrayMemberExpression *ast); + + // side effects + bool visit(BinaryExpression *ast); + bool visit(PreIncrementExpression *ast); + bool visit(PostIncrementExpression *ast); + bool visit(PreDecrementExpression *ast); + bool visit(PostDecrementExpression *ast); + + void sideEffectOn(ExpressionNode *ast); + +private: + QList<QSOperator::Op> m_assigningOps; + + QStringList m_locals; + QList<QStringList> m_deps; + QList<QStringList> m_sideEffects; +}; + +DependencyFinder::DependencyFinder() +{ + m_assigningOps << QSOperator::Assign + << QSOperator::InplaceAnd + << QSOperator::InplaceSub + << QSOperator::InplaceDiv + << QSOperator::InplaceAdd + << QSOperator::InplaceLeftShift + << QSOperator::InplaceMod + << QSOperator::InplaceMul + << QSOperator::InplaceOr + << QSOperator::InplaceRightShift + << QSOperator::InplaceURightShift + << QSOperator::InplaceXor; +} + +bool DependencyFinder::visit(VariableDeclaration *ast) +{ + if (ast->name) + m_locals.append(ast->name->asString()); + return true; +} + +bool DependencyFinder::visit(FunctionDeclaration *ast) +{ + if (ast->name) + m_locals.append(ast->name->asString()); + return visit(static_cast<FunctionExpression *>(ast)); +} + +bool DependencyFinder::visit(FunctionExpression *ast) +{ + const QStringList outerLocals = m_locals; + m_locals.clear(); + m_locals += QLatin1String("arguments"); + if (ast->name) + m_locals += ast->name->asString(); + for (FormalParameterList *it = ast->formals; it; it = it->next) { + if (it->name) + m_locals += it->name->asString(); + } + + const QList<QStringList> outerDeps = m_deps; + const QList<QStringList> outerSideEffects = m_sideEffects; + m_deps.clear(); + m_sideEffects.clear(); + + Node::accept(ast->body, this); + + m_deps = stripLocals(m_deps, m_locals); + m_deps += outerDeps; + + m_sideEffects = stripLocals(m_sideEffects, m_locals); + m_sideEffects += outerSideEffects; + + m_locals = outerLocals; + return false; +} + +bool DependencyFinder::visit(IdentifierExpression *ast) +{ + if (ast->name) + m_deps += QStringList() << ast->name->asString(); + return true; +} + +class GetMemberAccess : protected Visitor +{ + QStringList m_result; + +public: + // gets the longest static member access, i.e. + // foo.bar["abc"] -> foo,bar,abc + // foo.bar[aaa].def -> foo.bar + QStringList operator()(ExpressionNode *ast) + { + m_result.clear(); + Node::accept(ast, this); + return m_result; + } + +protected: + bool preVisit(Node *ast) + { + if (cast<FieldMemberExpression *>(ast) + || cast<ArrayMemberExpression *>(ast) + || cast<IdentifierExpression *>(ast)) + return true; + m_result.clear(); + return false; + } + + bool visit(FieldMemberExpression *ast) + { + if (ast->name) { + m_result.prepend(ast->name->asString()); + return true; + } + m_result.clear(); + return true; + } + + bool visit(ArrayMemberExpression *ast) + { + if (StringLiteral *string = cast<StringLiteral *>(ast->expression)) { + m_result.prepend(string->value->asString()); + return true; + } + m_result.clear(); + return true; + } + + bool visit(IdentifierExpression *ast) + { + if (ast->name) { + m_result.prepend(ast->name->asString()); + return true; + } + m_result.clear(); + return true; + } +}; + +bool DependencyFinder::visit(FieldMemberExpression *ast) +{ + const QStringList dep = GetMemberAccess()(ast); + if (!dep.isEmpty()) + m_deps += dep; + return false; +} + +bool DependencyFinder::visit(ArrayMemberExpression *ast) +{ + const QStringList dep = GetMemberAccess()(ast); + if (!dep.isEmpty()) + m_deps += dep; + return false; +} + +void DependencyFinder::sideEffectOn(ExpressionNode *ast) +{ + QStringList assignee = GetMemberAccess()(ast); + if (!assignee.isEmpty()) + m_sideEffects += assignee; + // ### does this catch everything? +} + +bool DependencyFinder::visit(BinaryExpression *ast) +{ + if (!m_assigningOps.contains(static_cast<QSOperator::Op>(ast->op))) + return true; + + sideEffectOn(ast->left); + + // need to collect dependencies regardless, consider a = b = c = d + return true; +} + +bool DependencyFinder::visit(PreDecrementExpression *ast) +{ + sideEffectOn(ast->expression); + return true; +} + +bool DependencyFinder::visit(PostDecrementExpression *ast) +{ + sideEffectOn(ast->base); + return true; +} + +bool DependencyFinder::visit(PreIncrementExpression *ast) +{ + sideEffectOn(ast->expression); + return true; +} + +bool DependencyFinder::visit(PostIncrementExpression *ast) +{ + sideEffectOn(ast->base); + return true; +} + +static QHash<QString, Function> bindFunctions(const QString &source, UiObjectInitializer *ast) +{ + QHash<QString, Function> result; + for (UiObjectMemberList *it = ast->members; it; it = it->next) { + UiSourceElement *sourceElement = cast<UiSourceElement *>(it->member); + if (!sourceElement) + continue; + FunctionDeclaration *fdecl = cast<FunctionDeclaration *>(sourceElement->sourceElement); + if (!fdecl) + continue; + + Function f; + if (!fdecl->name) + throw Exception("function decl without name"); + f.name = fdecl->name->asString(); + f.code = textOf(source, fdecl); + result.insert(f.name, f); + } + return result; +} + +static QHash<QString, Property> bindProperties(const QString &source, UiObjectInitializer *ast) +{ + QHash<QString, Property> result; + for (UiObjectMemberList *it = ast->members; it; it = it->next) { + if (UiScriptBinding *scriptBinding = cast<UiScriptBinding *>(it->member)) { + Property p; + if (!scriptBinding->qualifiedId || !scriptBinding->qualifiedId->name || scriptBinding->qualifiedId->next) + throw Exception("script binding without name or name with dots"); + p.name = scriptBinding->qualifiedId->name->asString(); + p.code = textOf(source, scriptBinding->statement); + DependencyFinder finder; + finder(scriptBinding->statement); + p.dependencies = finder.dependencies(); + p.sideEffects = finder.sideEffects(); + result.insert(p.name, p); + } + } + return result; +} + +static Object bindObject(const QString &source, UiObjectDefinition *ast); + +static QList<Object> bindObjects(const QString &source, UiObjectInitializer *ast) +{ + QList<Object> result; + for (UiObjectMemberList *it = ast->members; it; it = it->next) { + if (UiObjectDefinition *objDef = cast<UiObjectDefinition *>(it->member)) { + result += bindObject(source, objDef); + } + } + return result; +} + +static Object bindObject(const QString &source, UiObjectDefinition *ast) +{ + Object result; + + if (!ast->qualifiedTypeNameId || !ast->qualifiedTypeNameId->name || ast->qualifiedTypeNameId->next) + throw Exception("no prototype or prototype with dots"); + result.prototype = ast->qualifiedTypeNameId->name->asString(); + + result.functions = bindFunctions(source, ast->initializer); + result.properties = bindProperties(source, ast->initializer); + result.objects = bindObjects(source, ast->initializer); + + return result; +} + + +class Loader +{ +public: + Object readFile(const QString &fileName) + { + Object emptyReturn; + + QFile file(fileName); + if (!file.open(QFile::ReadOnly)) { + qWarning() << "Couldn't open" << fileName; + return emptyReturn; + } + + const QString code = QTextStream(&file).readAll(); + QScopedPointer<QmlJS::Engine> engine(new QmlJS::Engine); + QScopedPointer<QmlJS::NodePool> nodePool(new QmlJS::NodePool(fileName, engine.data())); + QmlJS::Lexer lexer(engine.data()); + lexer.setCode(code, 1); + QmlJS::Parser parser(engine.data()); + parser.parse(); + QList<QmlJS::DiagnosticMessage> parserMessages = parser.diagnosticMessages(); + if (!parserMessages.isEmpty()) { + foreach (const QmlJS::DiagnosticMessage &msg, parserMessages) + qWarning() << fileName << ":" << msg.loc.startLine << ": " << msg.message; + return emptyReturn; + } + + // extract dependencies without resolving them + UiObjectDefinition *rootDef = cast<UiObjectDefinition *>(parser.ast()->members->member); + if (!rootDef) + return emptyReturn; + return bindObject(code, rootDef); + } +}; + +class TestDepFinder : public QObject +{ + Q_OBJECT +private slots: + void test1(); + void evaluationOrder_data(); + void evaluationOrder(); +}; + +void TestDepFinder::test1() +{ + Loader loader; + Object object = loader.readFile(SRCDIR "test1.qbs"); + QCOMPARE(object.properties.size(), 3); + + Property includePaths = object.properties.value("includePaths"); + QCOMPARE(includePaths.dependencies.size(), 2); + QCOMPARE(includePaths.dependencies.at(0), QStringList() << "foo"); + QCOMPARE(includePaths.dependencies.at(1), QStringList() << "abc" << "def"); + QVERIFY(includePaths.sideEffects.isEmpty()); + + Property foo = object.properties.value("foo"); + QCOMPARE(foo.dependencies.size(), 1); + QCOMPARE(foo.dependencies.at(0), QStringList() << "bar"); + QVERIFY(foo.sideEffects.isEmpty()); + + Property car = object.properties.value("car"); + QCOMPARE(car.dependencies.size(), 1); + QCOMPARE(car.dependencies.at(0), QStringList() << "includePaths"); + QVERIFY(car.sideEffects.isEmpty()); +} + +class ResolvedProperty +{ +public: + typedef QSharedPointer<ResolvedProperty> Ptr; + const Object *object; + const Property *property; + QList<ResolvedProperty::Ptr> dependencies; +}; + +static QList<ResolvedProperty::Ptr> resolveProperties(const Object &object) +{ + QHash<QString, ResolvedProperty::Ptr> result; + + // build initial resolved property list + foreach (const Property &property, object.properties) { + ResolvedProperty::Ptr resolvedProperty(new ResolvedProperty); + resolvedProperty->object = &object; + resolvedProperty->property = &property; + result.insert(property.name, resolvedProperty); + } + + // add dependency links + QHashIterator<QString, ResolvedProperty::Ptr> it(result); + while (it.hasNext()) { + it.next(); + ResolvedProperty::Ptr resolvedProperty = it.value(); + foreach (const QStringList &dependency, resolvedProperty->property->dependencies) { + ResolvedProperty::Ptr rDepProp = result.value(dependency.first()); + // ### TODO This needs serious extension: + // ### check globals (QScriptEngine), object.functions, parent objects? + if (!rDepProp) { + throw Exception(QString("property %1 has dependency on nonexistent property %2").arg( + it.key(), dependency.first())); + } + resolvedProperty->dependencies += rDepProp; + } + } + + return result.values(); +} + +static void resolveDependencies(const ResolvedProperty::Ptr &property, + QList<ResolvedProperty::Ptr> *target, + QSet<ResolvedProperty::Ptr> *done, + QSet<ResolvedProperty::Ptr> *parents) +{ + if (done->contains(property)) + return; + parents->insert(property); + foreach (const ResolvedProperty::Ptr &dep, property->dependencies) { + if (parents->contains(dep)) + throw Exception("dependency cycle"); + resolveDependencies(dep, target, done, parents); + } + target->append(property); + done->insert(property); + parents->remove(property); +} + +static QList<ResolvedProperty::Ptr> sortForEvaluation(const QList<ResolvedProperty::Ptr> &input) +{ + QList<ResolvedProperty::Ptr> result; + QSet<ResolvedProperty::Ptr> done; + QSet<ResolvedProperty::Ptr> parents; + + foreach (const ResolvedProperty::Ptr &property, input) { + resolveDependencies(property, &result, &done, &parents); + } + + return result; +} + +void TestDepFinder::evaluationOrder_data() +{ + QTest::addColumn<QString>("fileName"); + QTest::addColumn<QStringList>("expectedOrder"); + QTest::newRow("no dependencies") + << QString(SRCDIR "order_nodeps.qbs") + << (QStringList() << "foo" << "bar"); + QTest::newRow("basic1") + << QString(SRCDIR "order_basic1.qbs") + << (QStringList() << "bar" << "foo"); + QTest::newRow("basic2") + << QString(SRCDIR "order_basic2.qbs") + << (QStringList() << "car" << "bar" << "foo"); + QTest::newRow("complex1") + << QString(SRCDIR "order_complex1.qbs") + << (QStringList() << "blub" << "def" << "foo" << "abc" << "car" << "bar"); +} + +void TestDepFinder::evaluationOrder() +{ + QFETCH(QString, fileName); + QFETCH(QStringList, expectedOrder); + + Loader loader; + Object object = loader.readFile(fileName); + QCOMPARE(object.properties.size(), expectedOrder.size()); + + QList<ResolvedProperty::Ptr> resolvedProperties = resolveProperties(object); + QList<ResolvedProperty::Ptr> evaluationOrder = sortForEvaluation(resolvedProperties); + + for (int i = 0; i < evaluationOrder.size(); ++i) { + QCOMPARE(evaluationOrder[i]->property->name, expectedOrder[i]); + } +} + +QTEST_MAIN(TestDepFinder) + +#include "tst_dependencyFinder.moc" diff --git a/tests/auto/options/app.xml b/tests/auto/options/app.xml new file mode 100644 index 000000000..7d4099f72 --- /dev/null +++ b/tests/auto/options/app.xml @@ -0,0 +1,5 @@ +<Project name='brickapp' > + <Product name='brick'> + <Using package="bricklib" /> + </Product> +</Project> diff --git a/tests/auto/options/options.pro b/tests/auto/options/options.pro new file mode 100644 index 000000000..384af7f40 --- /dev/null +++ b/tests/auto/options/options.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +TARGET = testOptions +DEPENDPATH += . +INCLUDEPATH += . ../../../src/lib/ +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +QT = core testlib + +include(../../../src/lib/use.pri) + +SOURCES += \ + tst_options.cpp diff --git a/tests/auto/options/tst_options.cpp b/tests/auto/options/tst_options.cpp new file mode 100644 index 000000000..66ab824d7 --- /dev/null +++ b/tests/auto/options/tst_options.cpp @@ -0,0 +1,61 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <tools/options.h> +#include <tools/logger.h> +#include <QtTest/QtTest> + +class TestOptions : public QObject +{ + Q_OBJECT +private slots: + + void test() + { + QStringList args; + args.append("-vvvk"); + qbs::CommandLineOptions options; + options.readCommandLineArguments(args); + QCOMPARE(qbs::Logger::instance().level(), qbs::LoggerTrace); + QCOMPARE(options.command(), qbs::CommandLineOptions::BuildCommand); + QVERIFY(options.isKeepGoingSet()); + } +}; + +QTEST_APPLESS_MAIN(TestOptions) + +#include "tst_options.moc" diff --git a/tests/auto/tools/tools.pro b/tests/auto/tools/tools.pro new file mode 100644 index 000000000..27cb2cbe9 --- /dev/null +++ b/tests/auto/tools/tools.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +TARGET = testTools +DEPENDPATH += . +INCLUDEPATH += . ../../../src/lib/ +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +QT = core testlib + +include(../../../src/lib/use.pri) + +SOURCES += \ + tst_tools.cpp diff --git a/tests/auto/tools/tst_tools.cpp b/tests/auto/tools/tst_tools.cpp new file mode 100644 index 000000000..b528ed82b --- /dev/null +++ b/tests/auto/tools/tst_tools.cpp @@ -0,0 +1,64 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <tools/fileinfo.h> +#include <QtTest/QtTest> + +class TestFileInfo : public QObject +{ + Q_OBJECT +private slots: + + void testFileInfo() + { + QCOMPARE(qbs::FileInfo::fileName("C:/waffl/copter.exe"), QString("copter.exe")); + QCOMPARE(qbs::FileInfo::baseName("C:/waffl/copter.exe.lib"), QString("copter")); + QCOMPARE(qbs::FileInfo::path("abc"), QString(".")); + QCOMPARE(qbs::FileInfo::path("/abc/lol"), QString("/abc")); + QVERIFY(!qbs::FileInfo::isAbsolute("bla/lol")); + QVERIFY(qbs::FileInfo::isAbsolute("/bla/lol")); +#ifdef Q_OS_WIN + QVERIFY(qbs::FileInfo::isAbsolute("C:\\bla\\lol")); +#endif + QCOMPARE(qbs::FileInfo::resolvePath("/abc/lol", "waffl"), QString("/abc/lol/waffl")); + + } +}; + +QTEST_APPLESS_MAIN(TestFileInfo) + +#include "tst_tools.moc" diff --git a/tests/manual/application/foo.c b/tests/manual/application/foo.c new file mode 100644 index 000000000..2a0b103fd --- /dev/null +++ b/tests/manual/application/foo.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int some_c_function(int x) +{ + printf("Some C function has been called. (arg: %d)\n", x); + return 123; +} + + diff --git a/tests/manual/application/main.cpp b/tests/manual/application/main.cpp new file mode 100644 index 000000000..5e4c65017 --- /dev/null +++ b/tests/manual/application/main.cpp @@ -0,0 +1,61 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <cstdio> +#include "object1.h" +#include "object2.h" + +extern void someCustomFeature(); +extern "C" int some_c_function(int); + +class Object3 : public QObject +{ + Q_OBJECT +}; + +int main() +{ + Object1 obj1; + Object2 obj2; + Object3 obj3; + printf("Hello World\n"); + someCustomFeature(); + some_c_function(156); +} + +#include "main.moc" + diff --git a/tests/manual/application/main_dbg.cpp b/tests/manual/application/main_dbg.cpp new file mode 100644 index 000000000..d7578047d --- /dev/null +++ b/tests/manual/application/main_dbg.cpp @@ -0,0 +1,61 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <cstdio> +#include "object1.h" +#include "object2.h" + +extern void someCustomFeature(); +extern "C" int some_c_function(int); + +class Object3 : public QObject +{ + Q_OBJECT +}; + +int main() +{ + Object1 obj1; + Object2 obj2; + Object3 obj3; + printf("Hello World (debug version)\n"); + someCustomFeature(); + some_c_function(156); +} + +#include "main_dbg.moc" + diff --git a/tests/manual/application/object1.cpp b/tests/manual/application/object1.cpp new file mode 100644 index 000000000..85a5dea2c --- /dev/null +++ b/tests/manual/application/object1.cpp @@ -0,0 +1,43 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "object1.h" + +Object1::Object1(QObject *parent) + : QObject(parent) +{} + diff --git a/tests/manual/application/object1.h b/tests/manual/application/object1.h new file mode 100644 index 000000000..5acd76240 --- /dev/null +++ b/tests/manual/application/object1.h @@ -0,0 +1,50 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#ifndef OBJECT1_H +#define OBJECT1_H +#include <QObject> + +class Object1 : public QObject +{ + Q_OBJECT +public: + Object1(QObject *parent = 0); +}; + +#endif + diff --git a/tests/manual/application/object2.cpp b/tests/manual/application/object2.cpp new file mode 100644 index 000000000..d67c3a838 --- /dev/null +++ b/tests/manual/application/object2.cpp @@ -0,0 +1,46 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "object2.h" + +Object2::Object2(QObject *parent) + : QObject(parent) +{} + + +#include "moc_object2.cpp" + diff --git a/tests/manual/application/object2.h b/tests/manual/application/object2.h new file mode 100644 index 000000000..41fd9f29b --- /dev/null +++ b/tests/manual/application/object2.h @@ -0,0 +1,50 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#ifndef OBJECT2_H +#define OBJECT2_H +#include <QtCore/QObject> + +class Object2 : public QObject +{ + Q_OBJECT +public: + Object2(QObject *parent = 0); +}; + +#endif + diff --git a/tests/manual/application/somecustomfeature.cpp b/tests/manual/application/somecustomfeature.cpp new file mode 100644 index 000000000..6a1972ac3 --- /dev/null +++ b/tests/manual/application/somecustomfeature.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <cstdio> + +void someCustomFeature() +{ + printf("void someCustomFeature() called\n"); +} + diff --git a/tests/manual/application/test.qbp b/tests/manual/application/test.qbp new file mode 100644 index 000000000..4e993bedf --- /dev/null +++ b/tests/manual/application/test.qbp @@ -0,0 +1,43 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "QtHelloWorld" + + Depends { + name: "Qt" + submodules: ["gui"] + } + + property bool someCustomFeature: true + + Group { + condition: qbs.debugInformation === false + files : [ "main.cpp" ] + } + + Group { + condition: qbs.debugInformation === true + files : [ "main_dbg.cpp" ] + } + + files : [ + "object1.h", + "object1.cpp", + "object2.cpp", + "foo.c" + ] + + Group { + files: [ "object2.h" ] + fileTags: [ "hpp" ] + } + + Group { + condition: someCustomFeature == true + files: [ "somecustomfeature.cpp" ] + } + } +} + diff --git a/tests/manual/baseProperties/Bar.qbs b/tests/manual/baseProperties/Bar.qbs new file mode 100644 index 000000000..c25541dc4 --- /dev/null +++ b/tests/manual/baseProperties/Bar.qbs @@ -0,0 +1,6 @@ +import qbs.base 1.0 + +Product { + Depends { name: "cpp" } + cpp.defines: ["FROM_BAR"] +} diff --git a/tests/manual/baseProperties/Foo.qbs b/tests/manual/baseProperties/Foo.qbs new file mode 100644 index 000000000..d3da538dd --- /dev/null +++ b/tests/manual/baseProperties/Foo.qbs @@ -0,0 +1,7 @@ +import qbs.base 1.0 + +Bar { + type: "application" + cpp.defines: base.concat(["FROM_FOO"]) +} + diff --git a/tests/manual/baseProperties/main.cpp b/tests/manual/baseProperties/main.cpp new file mode 100644 index 000000000..c791c18e1 --- /dev/null +++ b/tests/manual/baseProperties/main.cpp @@ -0,0 +1,51 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#ifndef FROM_FOO +#error FROM_FOO missing! +#endif +#ifndef FROM_BAR +#error FROM_BAR missing! +#endif +#ifndef FROM_PRJ +#error FROM_PRJ missing! +#endif + +int main() +{ + return 0; +} + diff --git a/tests/manual/baseProperties/prj.qbp b/tests/manual/baseProperties/prj.qbp new file mode 100644 index 000000000..e7800da69 --- /dev/null +++ b/tests/manual/baseProperties/prj.qbp @@ -0,0 +1,9 @@ +import qbs.base 1.0 + +Project { + Foo { + cpp.defines: base.concat(["FROM_PRJ"]); + files: "main.cpp" + } +} + diff --git a/tests/manual/codegen/codegen.qbp b/tests/manual/codegen/codegen.qbp new file mode 100644 index 000000000..e1f7be3d4 --- /dev/null +++ b/tests/manual/codegen/codegen.qbp @@ -0,0 +1,42 @@ +import qbs.base 1.0 +import qbs.fileinfo 1.0 as FileInfo + +Project { + property string name: 'codegen' + + Product { + type: 'application' + name: project.name + Group { + files: 'foo.txt' + fileTags: ['text'] + } + Depends { name: 'cpp' } + } + + Rule { + inputs: ['text'] + Artifact { + fileTags: ['cpp'] + fileName: input.baseName + '.cpp' + } + prepare: { + var code = 'int main(int, char **) { return 0; }' + var args = ['echo ' + code + '>' + output.fileName] + var cmd + if (product.modules.qbs.targetOS == 'windows') { + cmd = new Command('c:/Windows/System32/cmd.exe', ['/C'].concat(args)); + } else { + args[0] = args[0].replace(/\(/g, '\\(') + args[0] = args[0].replace(/\)/g, '\\)') + args[0] = args[0].replace(/;/g, '\\;') + cmd = new Command('/bin/sh', ['-c'].concat(args)) + } + cmd.description = 'generate\t' + FileInfo.fileName(output.fileName); + cmd.highlight = 'codegen'; + return cmd; + } + } + +} + diff --git a/tests/manual/codegen/foo.txt b/tests/manual/codegen/foo.txt new file mode 100644 index 000000000..557db03de --- /dev/null +++ b/tests/manual/codegen/foo.txt @@ -0,0 +1 @@ +Hello World diff --git a/tests/manual/collidingmice/collidingmice.qbp b/tests/manual/collidingmice/collidingmice.qbp new file mode 100644 index 000000000..b6b875ed1 --- /dev/null +++ b/tests/manual/collidingmice/collidingmice.qbp @@ -0,0 +1,18 @@ +import qbs.base 1.0 + +Project { + Application { + name : "CollidingMice" + destination: "bin" + + Depends { name: "Qt.gui" } + + files : [ + "main.cpp", + "mouse.cpp", + "mouse.h", + "mice.qrc" + ] + } +} + diff --git a/tests/manual/collidingmice/images/cheese.jpg b/tests/manual/collidingmice/images/cheese.jpg Binary files differnew file mode 100644 index 000000000..dea5795fd --- /dev/null +++ b/tests/manual/collidingmice/images/cheese.jpg diff --git a/tests/manual/collidingmice/main.cpp b/tests/manual/collidingmice/main.cpp new file mode 100644 index 000000000..714b6fecf --- /dev/null +++ b/tests/manual/collidingmice/main.cpp @@ -0,0 +1,88 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "mouse.h" + +#include <QtGui> + +#include <math.h> + +static const int MouseCount = 7; + +//! [0] +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); +//! [0] + +//! [1] + QGraphicsScene scene; + scene.setSceneRect(-300, -300, 600, 600); +//! [1] //! [2] + scene.setItemIndexMethod(QGraphicsScene::NoIndex); +//! [2] + +//! [3] + for (int i = 0; i < MouseCount; ++i) { + Mouse *mouse = new Mouse; + mouse->setPos(::sin((i * 6.28) / MouseCount) * 200, + ::cos((i * 6.28) / MouseCount) * 200); + scene.addItem(mouse); + } +//! [3] + +//! [4] + QGraphicsView view(&scene); + view.setRenderHint(QPainter::Antialiasing); + view.setBackgroundBrush(QPixmap(":/images/cheese.jpg")); +//! [4] //! [5] + view.setCacheMode(QGraphicsView::CacheBackground); + view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); + view.setDragMode(QGraphicsView::ScrollHandDrag); +//! [5] //! [6] + view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Colliding Mice")); + view.resize(400, 300); + view.show(); + + QTimer timer; + QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance())); + timer.start(1000 / 33); + + return app.exec(); +} +//! [6] diff --git a/tests/manual/collidingmice/mice.qrc b/tests/manual/collidingmice/mice.qrc new file mode 100644 index 000000000..accdb4d0a --- /dev/null +++ b/tests/manual/collidingmice/mice.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/" > + <file>images/cheese.jpg</file> + </qresource> +</RCC> diff --git a/tests/manual/collidingmice/mouse.cpp b/tests/manual/collidingmice/mouse.cpp new file mode 100644 index 000000000..f14627ad1 --- /dev/null +++ b/tests/manual/collidingmice/mouse.cpp @@ -0,0 +1,197 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "mouse.h" + +#include <QGraphicsScene> +#include <QPainter> +#include <QStyleOption> + +#include <math.h> + +static const double Pi = 3.14159265358979323846264338327950288419717; +static double TwoPi = 2.0 * Pi; + +static qreal normalizeAngle(qreal angle) +{ + while (angle < 0) + angle += TwoPi; + while (angle > TwoPi) + angle -= TwoPi; + return angle; +} + +//! [0] +Mouse::Mouse() + : angle(0), speed(0), mouseEyeDirection(0), + color(qrand() % 256, qrand() % 256, qrand() % 256) +{ + setRotation(qrand() % (360 * 16)); +} +//! [0] + +//! [1] +QRectF Mouse::boundingRect() const +{ + qreal adjust = 0.5; + return QRectF(-18 - adjust, -22 - adjust, + 36 + adjust, 60 + adjust); +} +//! [1] + +//! [2] +QPainterPath Mouse::shape() const +{ + QPainterPath path; + path.addRect(-10, -20, 20, 40); + return path; +} +//! [2] + +//! [3] +void Mouse::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) +{ + // Body + painter->setBrush(color); + painter->drawEllipse(-10, -20, 20, 40); + + // Eyes + painter->setBrush(Qt::white); + painter->drawEllipse(-10, -17, 8, 8); + painter->drawEllipse(2, -17, 8, 8); + + // Nose + painter->setBrush(Qt::black); + painter->drawEllipse(QRectF(-2, -22, 4, 4)); + + // Pupils + painter->drawEllipse(QRectF(-8.0 + mouseEyeDirection, -17, 4, 4)); + painter->drawEllipse(QRectF(4.0 + mouseEyeDirection, -17, 4, 4)); + + // Ears + painter->setBrush(scene()->collidingItems(this).isEmpty() ? Qt::darkYellow : Qt::red); + painter->drawEllipse(-17, -12, 16, 16); + painter->drawEllipse(1, -12, 16, 16); + + // Tail + QPainterPath path(QPointF(0, 20)); + path.cubicTo(-5, 22, -5, 22, 0, 25); + path.cubicTo(5, 27, 5, 32, 0, 30); + path.cubicTo(-5, 32, -5, 42, 0, 35); + painter->setBrush(Qt::NoBrush); + painter->drawPath(path); +} +//! [3] + +//! [4] +void Mouse::advance(int step) +{ + if (!step) + return; +//! [4] + // Don't move too far away +//! [5] + QLineF lineToCenter(QPointF(0, 0), mapFromScene(0, 0)); + if (lineToCenter.length() > 150) { + qreal angleToCenter = ::acos(lineToCenter.dx() / lineToCenter.length()); + if (lineToCenter.dy() < 0) + angleToCenter = TwoPi - angleToCenter; + angleToCenter = normalizeAngle((Pi - angleToCenter) + Pi / 2); + + if (angleToCenter < Pi && angleToCenter > Pi / 4) { + // Rotate left + angle += (angle < -Pi / 2) ? 0.25 : -0.25; + } else if (angleToCenter >= Pi && angleToCenter < (Pi + Pi / 2 + Pi / 4)) { + // Rotate right + angle += (angle < Pi / 2) ? 0.25 : -0.25; + } + } else if (::sin(angle) < 0) { + angle += 0.25; + } else if (::sin(angle) > 0) { + angle -= 0.25; +//! [5] //! [6] + } +//! [6] + + // Try not to crash with any other mice +//! [7] + QList<QGraphicsItem *> dangerMice = scene()->items(QPolygonF() + << mapToScene(0, 0) + << mapToScene(-30, -50) + << mapToScene(30, -50)); + foreach (QGraphicsItem *item, dangerMice) { + if (item == this) + continue; + + QLineF lineToMouse(QPointF(0, 0), mapFromItem(item, 0, 0)); + qreal angleToMouse = ::acos(lineToMouse.dx() / lineToMouse.length()); + if (lineToMouse.dy() < 0) + angleToMouse = TwoPi - angleToMouse; + angleToMouse = normalizeAngle((Pi - angleToMouse) + Pi / 2); + + if (angleToMouse >= 0 && angleToMouse < Pi / 2) { + // Rotate right + angle += 0.5; + } else if (angleToMouse <= TwoPi && angleToMouse > (TwoPi - Pi / 2)) { + // Rotate left + angle -= 0.5; +//! [7] //! [8] + } +//! [8] //! [9] + } +//! [9] + + // Add some random movement +//! [10] + if (dangerMice.size() > 1 && (qrand() % 10) == 0) { + if (qrand() % 1) + angle += (qrand() % 100) / 500.0; + else + angle -= (qrand() % 100) / 500.0; + } +//! [10] + +//! [11] + speed += (-50 + qrand() % 100) / 100.0; + + qreal dx = ::sin(angle) * 10; + mouseEyeDirection = (qAbs(dx / 5) < 1) ? 0 : dx / 5; + + setRotation(rotation() + dx); + setPos(mapToParent(0, -(3 + sin(speed) * 3))); +} +//! [11] diff --git a/tests/manual/collidingmice/mouse.h b/tests/manual/collidingmice/mouse.h new file mode 100644 index 000000000..f06a626d8 --- /dev/null +++ b/tests/manual/collidingmice/mouse.h @@ -0,0 +1,65 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#ifndef MOUSE_H +#define MOUSE_H + +#include <QGraphicsItem> + +//! [0] +class Mouse : public QGraphicsItem +{ +public: + Mouse(); + + QRectF boundingRect() const; + QPainterPath shape() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, + QWidget *widget); + +protected: + void advance(int step); + +private: + qreal angle; + qreal speed; + qreal mouseEyeDirection; + QColor color; +}; +//! [0] + +#endif diff --git a/tests/manual/hello/hello.qbp b/tests/manual/hello/hello.qbp new file mode 100644 index 000000000..d73a6fdb8 --- /dev/null +++ b/tests/manual/hello/hello.qbp @@ -0,0 +1,24 @@ +import qbs.base 1.0 + +Project { + Product { + Depends { name: 'cpp' } + + type: 'application' + name: 'HelloWorld' + + cpp.defines: ['SOMETHING'] + //cpp.applicationLinker.debugInformation: false + + Group { + cpp.defines: outer.concat(['HAVE_MAIN_CPP', cpp.debugInformation ? '_DEBUG' : '_RELEASE']) + prefix: "src/" + files: [ + 'main.cpp', + 'foo.h', + 'foo.cpp' + ] + } + } +} + diff --git a/tests/manual/hello/src/foo.cpp b/tests/manual/hello/src/foo.cpp new file mode 100644 index 000000000..6d2828af9 --- /dev/null +++ b/tests/manual/hello/src/foo.cpp @@ -0,0 +1,5 @@ +int someUsefulFunction() +{ + return 156; +} + diff --git a/tests/manual/hello/src/foo.h b/tests/manual/hello/src/foo.h new file mode 100644 index 000000000..1e4fd7b94 --- /dev/null +++ b/tests/manual/hello/src/foo.h @@ -0,0 +1,7 @@ +#ifndef FOO_H +#define FOO_H + +int someUsefulFunction(); + +#endif + diff --git a/tests/manual/hello/src/main.cpp b/tests/manual/hello/src/main.cpp new file mode 100644 index 000000000..c08389c00 --- /dev/null +++ b/tests/manual/hello/src/main.cpp @@ -0,0 +1,17 @@ +#include "foo.h" +#include <stdio.h> + +#ifndef HAVE_MAIN_CPP +# error missing define HAVE_MAIN_CPP +#endif + +int main() +{ + someUsefulFunction(); +#ifdef _DEBUG + puts("Hello World! (debug version)"); +#else + puts("Hello World! (release version)"); +#endif +} + diff --git a/tests/manual/inheritModuleSearchPath/Foo.qbs b/tests/manual/inheritModuleSearchPath/Foo.qbs new file mode 100644 index 000000000..d52dabbc9 --- /dev/null +++ b/tests/manual/inheritModuleSearchPath/Foo.qbs @@ -0,0 +1,7 @@ +import qbs.base 1.0 + +Product { + type: "application" + Depends { name: 'bli' } +} + diff --git a/tests/manual/inheritModuleSearchPath/main.cpp b/tests/manual/inheritModuleSearchPath/main.cpp new file mode 100644 index 000000000..7382cd2dd --- /dev/null +++ b/tests/manual/inheritModuleSearchPath/main.cpp @@ -0,0 +1,9 @@ +#ifndef HAVE_BLI +#error HAVE_BLI missing! +#endif + +int main() +{ + return 0; +} + diff --git a/tests/manual/inheritModuleSearchPath/prj.qbp b/tests/manual/inheritModuleSearchPath/prj.qbp new file mode 100644 index 000000000..8f72cf5be --- /dev/null +++ b/tests/manual/inheritModuleSearchPath/prj.qbp @@ -0,0 +1,10 @@ +import qbs.base 1.0 + +Project { + moduleSearchPaths: "subdir" +// moduleSearchPaths: ["subdir"] + Foo { + files: "main.cpp" + } +} + diff --git a/tests/manual/inheritModuleSearchPath/subdir/bli/m.qbs b/tests/manual/inheritModuleSearchPath/subdir/bli/m.qbs new file mode 100644 index 000000000..e33dab9a7 --- /dev/null +++ b/tests/manual/inheritModuleSearchPath/subdir/bli/m.qbs @@ -0,0 +1,7 @@ +import qbs.base 1.0 + +Module { + Depends {name : "cpp" } + cpp.defines: ["HAVE_BLI"] +} + diff --git a/tests/manual/lib_samesource/lib.qbp b/tests/manual/lib_samesource/lib.qbp new file mode 100644 index 000000000..36ecb4d19 --- /dev/null +++ b/tests/manual/lib_samesource/lib.qbp @@ -0,0 +1,22 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name : "HelloWorld" + Depends { name: 'cpp' } + Group { + files : [ "main.cpp" ] + } + } + + Product { + type: "staticlibrary" + name : "HelloWorld" + Depends { name: 'cpp' } + Group { + files : [ "main.cpp" ] + } + } +} + diff --git a/tests/manual/lib_samesource/main.cpp b/tests/manual/lib_samesource/main.cpp new file mode 100644 index 000000000..f45acac3b --- /dev/null +++ b/tests/manual/lib_samesource/main.cpp @@ -0,0 +1,43 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +int main() +{ + puts("Hello WOrld!"); +} diff --git a/tests/manual/lib_subdir/app/app.qbs b/tests/manual/lib_subdir/app/app.qbs new file mode 100644 index 000000000..4f7e959c5 --- /dev/null +++ b/tests/manual/lib_subdir/app/app.qbs @@ -0,0 +1,10 @@ +import qbs.base 1.0 + +Product { + type: "application" + name : "HelloWorld" + files : [ "main.cpp" ] + Depends { name: "cpp" } + Depends { name: "lol" } +} + diff --git a/tests/manual/lib_subdir/app/main.cpp b/tests/manual/lib_subdir/app/main.cpp new file mode 100644 index 000000000..3e1f2fd27 --- /dev/null +++ b/tests/manual/lib_subdir/app/main.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +int bla(); +int main() +{ + return bla(); +} diff --git a/tests/manual/lib_subdir/lib/lib.cpp b/tests/manual/lib_subdir/lib/lib.cpp new file mode 100644 index 000000000..f7d886a31 --- /dev/null +++ b/tests/manual/lib_subdir/lib/lib.cpp @@ -0,0 +1,48 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#ifndef CRUCIAL_DEFINE +# error CRUCIAL_DEFINE not defined +#endif + +int bla() +{ + puts("Hello WOrld!"); + return 2; +} diff --git a/tests/manual/lib_subdir/lib/lib.qbs b/tests/manual/lib_subdir/lib/lib.qbs new file mode 100644 index 000000000..22ef0535d --- /dev/null +++ b/tests/manual/lib_subdir/lib/lib.qbs @@ -0,0 +1,10 @@ +import qbs.base 1.0 + +Product { + type: "staticlibrary" + name: "lol" + files: [ "lib.cpp" ] + cpp.defines: ['CRUCIAL_DEFINE'] + Depends { name: 'cpp' } +} + diff --git a/tests/manual/lib_subdir/lib_subdir.qbp b/tests/manual/lib_subdir/lib_subdir.qbp new file mode 100644 index 000000000..71afd646f --- /dev/null +++ b/tests/manual/lib_subdir/lib_subdir.qbp @@ -0,0 +1,8 @@ +import qbs.base 1.0 +Project { + references: [ + "app/app.qbs", + "lib/lib.qbs" + ] +} + diff --git a/tests/manual/link_dynamiclib/lib1.cpp b/tests/manual/link_dynamiclib/lib1.cpp new file mode 100644 index 000000000..7e2632c02 --- /dev/null +++ b/tests/manual/link_dynamiclib/lib1.cpp @@ -0,0 +1,55 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#if defined(_WIN32) || defined(WIN32) +# define EXPORT __declspec(dllexport) +# define IMPORT __declspec(dllimport) +#else +# define EXPORT +# define IMPORT +#endif + +IMPORT void lib2_hello(); + +EXPORT int lib1_hello() +{ + puts("lib1 says hello!"); + lib2_hello(); + return 0; +} diff --git a/tests/manual/link_dynamiclib/lib2.cpp b/tests/manual/link_dynamiclib/lib2.cpp new file mode 100644 index 000000000..8aaa4fb70 --- /dev/null +++ b/tests/manual/link_dynamiclib/lib2.cpp @@ -0,0 +1,55 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#if defined(_WIN32) || defined(WIN32) +# define EXPORT __declspec(dllexport) +# define IMPORT __declspec(dllimport) +#else +# define EXPORT +# define IMPORT +#endif + +IMPORT void lib3_hello(); + +EXPORT void lib2_hello() +{ + puts("lib2 says hello!"); + lib3_hello(); +} + diff --git a/tests/manual/link_dynamiclib/lib3.cpp b/tests/manual/link_dynamiclib/lib3.cpp new file mode 100644 index 000000000..a4ac4885d --- /dev/null +++ b/tests/manual/link_dynamiclib/lib3.cpp @@ -0,0 +1,58 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#if defined(_WIN32) || defined(WIN32) +# define EXPORT __declspec(dllexport) +# define IMPORT __declspec(dllimport) +#else +# define EXPORT +# define IMPORT +#endif + +EXPORT void lib3_hello() +{ + puts("lib3 says hello!"); +} + +EXPORT char* lib3_greeting() +{ + static char greeting[] = "hello"; + return greeting; +} + diff --git a/tests/manual/link_dynamiclib/link_dynamiclib.qbp b/tests/manual/link_dynamiclib/link_dynamiclib.qbp new file mode 100644 index 000000000..51172835a --- /dev/null +++ b/tests/manual/link_dynamiclib/link_dynamiclib.qbp @@ -0,0 +1,43 @@ +import qbs.base 1.0 + +Project { + Application { + name : "HelloWorld" + destination: "bin" + Group { + files : [ "main.cpp" ] + } + Depends { name: "cpp" } + Depends { name: "lib1" } + } + + DynamicLibrary { + name : "lib1" + destination: "bin" + Group { + files : [ "lib1.cpp" ] + } + Depends { name: "cpp" } + Depends { name: "lib2" } + } + + DynamicLibrary { + name : "lib2" + destination: "bin" + Group { + files : [ "lib2.cpp" ] + } + Depends { name: "cpp" } + Depends { name: "lib3" } + } + + DynamicLibrary { + name : "lib3" + destination: "bin" + Group { + files : [ "lib3.cpp" ] + } + Depends { name: "cpp" } + } +} + diff --git a/tests/manual/link_dynamiclib/main.cpp b/tests/manual/link_dynamiclib/main.cpp new file mode 100644 index 000000000..c904e7088 --- /dev/null +++ b/tests/manual/link_dynamiclib/main.cpp @@ -0,0 +1,55 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#if defined(_WIN32) || defined(WIN32) +# define EXPORT __declspec(dllexport) +# define IMPORT __declspec(dllimport) +#else +# define EXPORT +# define IMPORT +#endif + +IMPORT int lib1_hello(); + +int main() +{ + puts("application says hello!"); + return lib1_hello(); +} + diff --git a/tests/manual/link_staticlib/helper/helper.cpp b/tests/manual/link_staticlib/helper/helper.cpp new file mode 100644 index 000000000..796c1ef2a --- /dev/null +++ b/tests/manual/link_staticlib/helper/helper.cpp @@ -0,0 +1,43 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#include "helper.h" + +int getSomeNumber() +{ + return 156; +} + diff --git a/tests/manual/link_staticlib/helper/helper.h b/tests/manual/link_staticlib/helper/helper.h new file mode 100644 index 000000000..6cb075a1c --- /dev/null +++ b/tests/manual/link_staticlib/helper/helper.h @@ -0,0 +1,43 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ +#ifndef HELPER_H +#define HELPER_H + +extern int getSomeNumber(); + +#endif + diff --git a/tests/manual/link_staticlib/link_staticlib.qbp b/tests/manual/link_staticlib/link_staticlib.qbp new file mode 100644 index 000000000..a86b50f8d --- /dev/null +++ b/tests/manual/link_staticlib/link_staticlib.qbp @@ -0,0 +1,30 @@ +import qbs.base 1.0 + +Project { + Application { + name: "HelloWorld" + files : [ "main.cpp" ] + Depends { name: "cpp" } + Depends { name: "mystaticlib" } + } + + StaticLibrary { + name : "mystaticlib" + files : [ "mystaticlib.cpp" ] + Depends { name: "cpp" } + Depends { name: "helperlib" } + } + + StaticLibrary { + name : "helperlib" + files : [ + "helper/helper.h", + "helper/helper.cpp" + ] + Depends { name: "cpp" } + ProductModule { + cpp.includePaths: ['helper'] + } + } +} + diff --git a/tests/manual/link_staticlib/main.cpp b/tests/manual/link_staticlib/main.cpp new file mode 100644 index 000000000..fbef6bd79 --- /dev/null +++ b/tests/manual/link_staticlib/main.cpp @@ -0,0 +1,46 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +int bla(); + +int main() +{ + return bla(); +} + diff --git a/tests/manual/link_staticlib/mystaticlib.cpp b/tests/manual/link_staticlib/mystaticlib.cpp new file mode 100644 index 000000000..9c035f22d --- /dev/null +++ b/tests/manual/link_staticlib/mystaticlib.cpp @@ -0,0 +1,46 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> +#include <helper.h> + +int bla() +{ + int n = getSomeNumber(); + printf("Hello World! The magic number is %d.", n); + return n; +} diff --git a/tests/manual/link_staticlib/mystaticlibhelper.cpp b/tests/manual/link_staticlib/mystaticlibhelper.cpp new file mode 100644 index 000000000..76a6a38e9 --- /dev/null +++ b/tests/manual/link_staticlib/mystaticlibhelper.cpp @@ -0,0 +1,5 @@ +int helper_function() +{ + return 156; +} + diff --git a/tests/manual/localDeployment/localDeployment.qbp b/tests/manual/localDeployment/localDeployment.qbp new file mode 100644 index 000000000..1909d14d0 --- /dev/null +++ b/tests/manual/localDeployment/localDeployment.qbp @@ -0,0 +1,20 @@ +import qbs.base 1.0 + +Project { + Product { + type: ["application", "installed_content"] + name: "HelloWorld" + destination: "bin" + + Depends { name: "Qt.core"} + + files: [ "main.cpp" ] + + Group { + qbs.installDir: "share" + files: ['main.cpp'] + fileTags: ["install"] + } + } +} + diff --git a/tests/manual/localDeployment/main.cpp b/tests/manual/localDeployment/main.cpp new file mode 100644 index 000000000..267f645bf --- /dev/null +++ b/tests/manual/localDeployment/main.cpp @@ -0,0 +1,49 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <QFile> +#include <QCoreApplication> +#include <QDebug> + +int main(int argc, char **argv) +{ + QCoreApplication app(argc, argv); + QFile f(app.applicationDirPath() + "/../share/main.cpp"); + f.open(QFile::ReadOnly); + qDebug() << f.readAll(); +} + diff --git a/tests/manual/moc_cpp/bla.cpp b/tests/manual/moc_cpp/bla.cpp new file mode 100644 index 000000000..26185684a --- /dev/null +++ b/tests/manual/moc_cpp/bla.cpp @@ -0,0 +1,15 @@ +#include <QObject> + +class MyObject : public QObject +{ + Q_OBJECT +}; + +int main() +{ + MyObject obj; + return 0; +} + +#include "bla.moc" + diff --git a/tests/manual/moc_cpp/moc_cpp.qbp b/tests/manual/moc_cpp/moc_cpp.qbp new file mode 100644 index 000000000..dd8ddf603 --- /dev/null +++ b/tests/manual/moc_cpp/moc_cpp.qbp @@ -0,0 +1,14 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "moc_cpp" + + Depends { + name: "Qt.core" + } + + files: ["bla.cpp"] + } +} diff --git a/tests/manual/moc_hpp/moc_hpp.qbp b/tests/manual/moc_hpp/moc_hpp.qbp new file mode 100644 index 000000000..a730c93e8 --- /dev/null +++ b/tests/manual/moc_hpp/moc_hpp.qbp @@ -0,0 +1,16 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "moc_hpp" + + Depends { name: "qt.core" } + + files : [ + "object.h", + "object.cpp" + ] + } +} + diff --git a/tests/manual/moc_hpp/object.cpp b/tests/manual/moc_hpp/object.cpp new file mode 100644 index 000000000..8c091c58c --- /dev/null +++ b/tests/manual/moc_hpp/object.cpp @@ -0,0 +1,13 @@ +#include "object.h" +#include <cstdio> + +Object::Object(QObject *parent) + : QObject(parent) +{} + +int main() +{ + Object obj; + printf("Hello World\n"); +} + diff --git a/tests/manual/moc_hpp/object.h b/tests/manual/moc_hpp/object.h new file mode 100644 index 000000000..7d8f59c6c --- /dev/null +++ b/tests/manual/moc_hpp/object.h @@ -0,0 +1,13 @@ +#ifndef OBJECT_H +#define OBJECT_H +#include <QObject> + +class Object : public QObject +{ + Q_OBJECT +public: + Object(QObject *parent = 0); +}; + +#endif + diff --git a/tests/manual/moc_hpp_included/moc_hpp_included.qbp b/tests/manual/moc_hpp_included/moc_hpp_included.qbp new file mode 100644 index 000000000..1cdfb7fad --- /dev/null +++ b/tests/manual/moc_hpp_included/moc_hpp_included.qbp @@ -0,0 +1,18 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "moc_hpp_included" + + Depends { name: "qt.core" } + + files : [ "object.cpp" ] + + Group { + files : [ "object.h" ] + fileTags: [ "hpp" ] + } + } +} + diff --git a/tests/manual/moc_hpp_included/object.cpp b/tests/manual/moc_hpp_included/object.cpp new file mode 100644 index 000000000..ef0b32417 --- /dev/null +++ b/tests/manual/moc_hpp_included/object.cpp @@ -0,0 +1,15 @@ +#include "object.h" + +Object::Object(QObject *parent) + : QObject(parent) +{} + +#include "moc_object.cpp" +#include <cstdio> + +int main() +{ + Object obj; + printf("Hello World\n"); +} + diff --git a/tests/manual/moc_hpp_included/object.h b/tests/manual/moc_hpp_included/object.h new file mode 100644 index 000000000..7d8f59c6c --- /dev/null +++ b/tests/manual/moc_hpp_included/object.h @@ -0,0 +1,13 @@ +#ifndef OBJECT_H +#define OBJECT_H +#include <QObject> + +class Object : public QObject +{ + Q_OBJECT +public: + Object(QObject *parent = 0); +}; + +#endif + diff --git a/tests/manual/pch/main.cpp b/tests/manual/pch/main.cpp new file mode 100644 index 000000000..83d04ea54 --- /dev/null +++ b/tests/manual/pch/main.cpp @@ -0,0 +1,27 @@ +#include "myobject.h" +#include <algorithm> +#include <iostream> +#include <list> + +using namespace std; + +int main(int argc, char **argv) +{ + MyObject obj; + list<int> lst; + lst.push_back(1); + lst.push_back(2); + lst.push_back(3); + lst.push_back(4); + lst.push_back(5); + lst.push_back(6); + lst.push_back(7); + lst.push_back(8); + lst.push_back(9); + reverse(lst.begin(), lst.end()); + for (list<int>::iterator it=lst.begin(); it != lst.end(); ++it) + cout << *it << ", "; + cout << endl; + return 0; +} + diff --git a/tests/manual/pch/myobject.cpp b/tests/manual/pch/myobject.cpp new file mode 100644 index 000000000..9f3f93740 --- /dev/null +++ b/tests/manual/pch/myobject.cpp @@ -0,0 +1,13 @@ +#include <iostream> +#include "myobject.h" + +MyObject::MyObject() +{ + std::cout << "MyObject::MyObject()\n"; +} + +MyObject::~MyObject() +{ + std::cout << "MyObject::~MyObject()" << std::endl; +} + diff --git a/tests/manual/pch/myobject.h b/tests/manual/pch/myobject.h new file mode 100644 index 000000000..17dfd48c8 --- /dev/null +++ b/tests/manual/pch/myobject.h @@ -0,0 +1,12 @@ +#ifndef MYOBJECT_H +#define MYOBJECT_H + +class MyObject +{ +public: + MyObject(); + ~MyObject(); +}; + +#endif + diff --git a/tests/manual/pch/pch.qbp b/tests/manual/pch/pch.qbp new file mode 100644 index 000000000..664d134e6 --- /dev/null +++ b/tests/manual/pch/pch.qbp @@ -0,0 +1,13 @@ +import qbs.base 1.0 + +Product { + type: "application" + name: "pch" + files: ["stable.h", + "myobject.h", + "main.cpp", + "myobject.cpp"] + Depends { name: "cpp" } + cpp.precompiledHeader: "stable.h" +} + diff --git a/tests/manual/pch/stable.h b/tests/manual/pch/stable.h new file mode 100644 index 000000000..93ce3cb29 --- /dev/null +++ b/tests/manual/pch/stable.h @@ -0,0 +1,9 @@ +/* Add C includes here */ + +#if defined __cplusplus +/* Add C++ includes here */ + +# include <iostream> +# include <algorithm> +#endif + diff --git a/tests/manual/productmoduledeps/lib1.cpp b/tests/manual/productmoduledeps/lib1.cpp new file mode 100644 index 000000000..5322022b3 --- /dev/null +++ b/tests/manual/productmoduledeps/lib1.cpp @@ -0,0 +1,52 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#if defined(_WIN32) || defined(WIN32) +# define EXPORT __declspec(dllexport) +# define IMPORT __declspec(dllimport) +#else +# define EXPORT +# define IMPORT +#endif + +EXPORT int lib1_hello() +{ + puts("lib1 says hello!"); + return 0; +} diff --git a/tests/manual/productmoduledeps/main.cpp b/tests/manual/productmoduledeps/main.cpp new file mode 100644 index 000000000..c904e7088 --- /dev/null +++ b/tests/manual/productmoduledeps/main.cpp @@ -0,0 +1,55 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#if defined(_WIN32) || defined(WIN32) +# define EXPORT __declspec(dllexport) +# define IMPORT __declspec(dllimport) +#else +# define EXPORT +# define IMPORT +#endif + +IMPORT int lib1_hello(); + +int main() +{ + puts("application says hello!"); + return lib1_hello(); +} + diff --git a/tests/manual/productmoduledeps/productmoduledeps.qbp b/tests/manual/productmoduledeps/productmoduledeps.qbp new file mode 100644 index 000000000..5e065f6b5 --- /dev/null +++ b/tests/manual/productmoduledeps/productmoduledeps.qbp @@ -0,0 +1,47 @@ +import qbs.base 1.0 + +Project { + Application { + name : "HelloWorld" + destination: "bin" + Group { + files : [ "main.cpp" ] + } + Depends { name: "cpp" } + Depends { name: 'dummy' } + } + + Product { + name: 'dummy' + type: 'installed_content' + Group { + files: 'main.cpp' + fileTags: 'install' + } + ProductModule { + Depends { name: 'dummy2' } + } + } + + Product { + name: 'dummy2' + type: 'installed_content' + Group { + files: 'lib1.cpp' + fileTags: 'install' + } + ProductModule { + Depends { name: 'lib1' } + } + } + + DynamicLibrary { + name : "lib1" + destination: "bin" + Group { + files : [ "lib1.cpp" ] + } + Depends { name: "cpp" } + } +} + diff --git a/tests/manual/proper quoting/main.cpp b/tests/manual/proper quoting/main.cpp new file mode 100644 index 000000000..7efbf23ee --- /dev/null +++ b/tests/manual/proper quoting/main.cpp @@ -0,0 +1,55 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#define __stringify__(x) #x +#define stringify(x) __stringify__(x) + +int bla(); + +int main() +{ + printf(DEFINE"\n"); + printf(DEFINEWITHSPACE"\n"); + printf(DEFINEWITHTAB"\n"); + printf(DEFINEWITHBACKSLASH"\n"); + printf(stringify(DEFINEWITHBACKSLASHRAW)"\n"); + + return bla(); +} + diff --git a/tests/manual/proper quoting/my static lib helper.cpp b/tests/manual/proper quoting/my static lib helper.cpp new file mode 100644 index 000000000..76a6a38e9 --- /dev/null +++ b/tests/manual/proper quoting/my static lib helper.cpp @@ -0,0 +1,5 @@ +int helper_function() +{ + return 156; +} + diff --git a/tests/manual/proper quoting/my static lib.cpp b/tests/manual/proper quoting/my static lib.cpp new file mode 100644 index 000000000..7134e431b --- /dev/null +++ b/tests/manual/proper quoting/my static lib.cpp @@ -0,0 +1,46 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> +#include <some helper.h> + +int bla() +{ + int n = getSomeNumber(); + printf("Hello World! The magic number is %d.", n); + return n; +} diff --git a/tests/manual/proper quoting/proper quoting.qbp b/tests/manual/proper quoting/proper quoting.qbp new file mode 100644 index 000000000..f56f78071 --- /dev/null +++ b/tests/manual/proper quoting/proper quoting.qbp @@ -0,0 +1,42 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "Hello World" + files : [ "main.cpp" ] + Depends { name: "cpp" } + Depends { name: "my static lib" } + cpp.defines: [ + 'DEFINE="whitespaceless"', + 'DEFINEWITHSPACE="contains space"', + 'DEFINEWITHTAB="contains\ttab"', + 'DEFINEWITHBACKSLASH="backslash\\\\"', + 'DEFINEWITHBACKSLASHRAW=backslash\\\\' + ] +// cpp.responseFileThreshold: 0 + } + + Product { + type: "staticlibrary" + name : "my static lib" + files : [ "my static lib.cpp" ] + Depends { name: "cpp" } + Depends { name: "helper lib" } +// cpp.responseFileThreshold: 0 + } + + Product { + type: "staticlibrary" + name : "helper lib" + files : [ + "some helper/some helper.h", + "some helper/some helper.cpp" + ] + Depends { name: "cpp" } + ProductModule { + cpp.includePaths: ['some helper'] + } +// cpp.responseFileThreshold: 0 + } +} diff --git a/tests/manual/proper quoting/some helper/some helper.cpp b/tests/manual/proper quoting/some helper/some helper.cpp new file mode 100644 index 000000000..99ac58019 --- /dev/null +++ b/tests/manual/proper quoting/some helper/some helper.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "some helper.h" + +int getSomeNumber() +{ + return 156; +} + diff --git a/tests/manual/proper quoting/some helper/some helper.h b/tests/manual/proper quoting/some helper/some helper.h new file mode 100644 index 000000000..75560e6af --- /dev/null +++ b/tests/manual/proper quoting/some helper/some helper.h @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#ifndef HELPER_H +#define HELPER_H + +extern int getSomeNumber(); + +#endif + diff --git a/tests/manual/propertiesblocks/hello.qbp b/tests/manual/propertiesblocks/hello.qbp new file mode 100644 index 000000000..de08cbbec --- /dev/null +++ b/tests/manual/propertiesblocks/hello.qbp @@ -0,0 +1,28 @@ +import qbs.base 1.0 + +Product { + Depends { name: 'cpp' } + + Properties { + condition: true + type: 'application' + name: 'HelloWorld' + } + + Properties { + condition: name == 'HelloWorld' + cpp.defines: ['SOMETHING'] + } + + Properties { + condition: qbs.targetOS == "weird" + cpp.staticLibraries: "abc" + } + + Group { + cpp.defines: outer.concat(['HAVE_MAIN_CPP', cpp.debugInformation ? '_DEBUG' : '_RELEASE']) + files: ['main.cpp'] + } +} + + diff --git a/tests/manual/propertiesblocks/main.cpp b/tests/manual/propertiesblocks/main.cpp new file mode 100644 index 000000000..4d2b5fa6c --- /dev/null +++ b/tests/manual/propertiesblocks/main.cpp @@ -0,0 +1,52 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <stdio.h> + +#ifndef HAVE_MAIN_CPP +# error missing define HAVE_MAIN_CPP +#endif + +int main() +{ +#ifdef _DEBUG + puts("Hello World! (debug version)"); +#else + puts("Hello World! (release version)"); +#endif +} + diff --git a/tests/manual/qrc2/bla.cpp b/tests/manual/qrc2/bla.cpp new file mode 100644 index 000000000..e1c0d42bc --- /dev/null +++ b/tests/manual/qrc2/bla.cpp @@ -0,0 +1,40 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +int main(){ + return 3; +} diff --git a/tests/manual/qrc2/bla.qrc b/tests/manual/qrc2/bla.qrc new file mode 100644 index 000000000..f0a7168f5 --- /dev/null +++ b/tests/manual/qrc2/bla.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/bla"> + <file>stuff.txt</file> + </qresource> +</RCC> diff --git a/tests/manual/qrc2/foo.qrc b/tests/manual/qrc2/foo.qrc new file mode 100644 index 000000000..a8acfc34a --- /dev/null +++ b/tests/manual/qrc2/foo.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/foo"> + <file>stuff.txt</file> + </qresource> +</RCC> diff --git a/tests/manual/qrc2/i.qbp b/tests/manual/qrc2/i.qbp new file mode 100644 index 000000000..5f89b9f82 --- /dev/null +++ b/tests/manual/qrc2/i.qbp @@ -0,0 +1,19 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "i" + + Depends { + name: "Qt.core" + } + + files: [ + "bla.cpp", + "bla.qrc", + "foo.qrc", + "stuff.txt" + ] + } +} diff --git a/tests/manual/qrc2/stuff.txt b/tests/manual/qrc2/stuff.txt new file mode 100644 index 000000000..78f0d32c6 --- /dev/null +++ b/tests/manual/qrc2/stuff.txt @@ -0,0 +1 @@ +a resource file diff --git a/tests/manual/symhello/hello.qbp b/tests/manual/symhello/hello.qbp new file mode 100644 index 000000000..7e9944a15 --- /dev/null +++ b/tests/manual/symhello/hello.qbp @@ -0,0 +1,10 @@ +import qbs.base 1.0 + +Project { + Product { + name : "HelloWorld" + type: "application" + files : [ "main.cpp" ] + } +} + diff --git a/tests/manual/symhello/main.cpp b/tests/manual/symhello/main.cpp new file mode 100644 index 000000000..8e1873a2a --- /dev/null +++ b/tests/manual/symhello/main.cpp @@ -0,0 +1,46 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <e32std.h> +#include <e32debug.h> + +TInt E32Main() +{ + RDebug::Print(_L("Hello!")); + return 0; +} + diff --git a/tests/manual/transformers/main.cpp b/tests/manual/transformers/main.cpp new file mode 100644 index 000000000..5df553831 --- /dev/null +++ b/tests/manual/transformers/main.cpp @@ -0,0 +1,77 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include <string> +#include <iostream> +#include <fstream> + +using namespace std; + +bool displayTextFile(const string &dirPath, const string &fileName) +{ + string fullPath = dirPath + fileName; + ifstream istream(fullPath.c_str()); + if (!istream.is_open()) { + cout << "Cannot open " << fileName << endl; + return false; + } + cout << "---" << fileName << "---" << endl; + char buf[256]; + unsigned int i = 1; + while (istream.good()) { + istream.getline(buf, sizeof(buf)); + cout << i++ << ": " << buf << endl; + } + return true; +} + +int main(int argc, char **argv) +{ + string appPath(argv[0]); + size_t i = appPath.find_last_of('/'); + if (i == string::npos) + i = appPath.find_last_of('\\'); + if (i != string::npos) + appPath.resize(i + 1); + if (!displayTextFile(appPath, "foo.txt")) + return 1; + if (!displayTextFile(appPath, "bar.txt")) + return 2; + cout << "-------------" << endl; + return 0; +} + diff --git a/tests/manual/transformers/transformers.qbp b/tests/manual/transformers/transformers.qbp new file mode 100644 index 000000000..12cd3579f --- /dev/null +++ b/tests/manual/transformers/transformers.qbp @@ -0,0 +1,53 @@ +import qbs.base 1.0 +import qbs.fileinfo 1.0 as FileInfo + +Project { + Product { + name: "HelloWorld" + type: "application" + files: ["main.cpp"] + + Depends { name: "cpp" } + + Transformer { + // no inputs -> just a generator + Artifact { + fileName: "foo.txt" + fileTags: "text" + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "generating foo.txt"; + cmd.highlight = "linker"; + cmd.sourceCode = "File.remove(output.fileName);\n"; + cmd.sourceCode += "var f = new TextFile(output.fileName, TextFile.WriteOnly);\n" + cmd.sourceCode += "f.write(\"Dear Sir/Madam,\\n\\n\");\n"; + cmd.sourceCode += "f.write(\"this is a generated file.\\n\\n\\n\");\n"; + cmd.sourceCode += "f.write(\"Best Regards and Mellow Greetings,\\nYour Build Tool.\\n\");\n"; + cmd.sourceCode += "f.close();"; + return cmd; + } + } + + Transformer { + inputs: ["main.cpp"] // will be taken from the source dir + Artifact { + fileName: "bar.txt" + fileTags: "text" + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "generating bar.txt"; + cmd.highlight = "linker"; + cmd.sourceCode = "File.remove(output.fileName);\n"; + cmd.sourceCode += "var f = new TextFile(output.fileName, TextFile.WriteOnly)\n"; + cmd.sourceCode += "f.write(\"Dear Sir/Madam,\\n\\n\");\n"; + cmd.sourceCode += "f.write(\"this file was generated from \" + input.fileName + \".\\n\\n\\n\");\n"; + cmd.sourceCode += "f.write(\"Best Regards and Mellow Greetings,\\nYour Build Tool.\\n\");"; + cmd.sourceCode += "f.close();"; + return cmd; + } + } + } +} + diff --git a/tests/manual/uic/bla.cpp b/tests/manual/uic/bla.cpp new file mode 100644 index 000000000..b56070dc2 --- /dev/null +++ b/tests/manual/uic/bla.cpp @@ -0,0 +1,44 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "bla.h" + +int main() +{ + Ui::MainWindow mainWindow; +} + diff --git a/tests/manual/uic/bla.h b/tests/manual/uic/bla.h new file mode 100644 index 000000000..8c8a45878 --- /dev/null +++ b/tests/manual/uic/bla.h @@ -0,0 +1,38 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "ui.h" diff --git a/tests/manual/uic/ui.h b/tests/manual/uic/ui.h new file mode 100644 index 000000000..e2dfa0eb6 --- /dev/null +++ b/tests/manual/uic/ui.h @@ -0,0 +1,38 @@ +/************************************************************************** +** +** This file is part of the Qt Build Suite +** +** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (info@qt.nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. +** Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +**************************************************************************/ + +#include "ui_ui.h" diff --git a/tests/manual/uic/ui.ui b/tests/manual/uic/ui.ui new file mode 100644 index 000000000..b07f62d05 --- /dev/null +++ b/tests/manual/uic/ui.ui @@ -0,0 +1,31 @@ +<?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>800</width> + <height>600</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget"/> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>25</height> + </rect> + </property> + </widget> + <widget class="QStatusBar" name="statusbar"/> + </widget> + <resources/> + <connections/> +</ui> diff --git a/tests/manual/uic/uic.qbp b/tests/manual/uic/uic.qbp new file mode 100644 index 000000000..1c10dca76 --- /dev/null +++ b/tests/manual/uic/uic.qbp @@ -0,0 +1,17 @@ +import qbs.base 1.0 + +Project { + Product { + type: "application" + name: "ui" + + Depends { name: "Qt.gui"} + + files: [ + "bla.cpp", + "bla.h", + "ui.ui", + "ui.h" + ] + } +} diff --git a/tests/tests.pro b/tests/tests.pro new file mode 100644 index 000000000..cef82e9c7 --- /dev/null +++ b/tests/tests.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +SUBDIRS = auto + |