forked from qt-creator/qt-creator
Add qt-widgets-app unit test
Change-Id: I502075f79d4abf6bd5c0d2080b2f543116499ace Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
@@ -94,10 +94,16 @@ void ClangStaticAnalyzerUnitTests::testProject_data()
|
||||
{
|
||||
QTest::addColumn<QString>("projectFilePath");
|
||||
QTest::addColumn<int>("expectedDiagCount");
|
||||
QTest::newRow("qbs project")
|
||||
|
||||
QTest::newRow("simple qbs project")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/simple/simple.qbs")) << 1;
|
||||
QTest::newRow("qmake project")
|
||||
QTest::newRow("simple qmake project")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/simple/simple.pro")) << 1;
|
||||
|
||||
QTest::newRow("qt-widgets-app qbs project")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/qt-widgets-app/qt-widgets-app.qbs")) << 0;
|
||||
QTest::newRow("qt-widgets-app qmake project")
|
||||
<< QString(m_tmpDir->path() + QLatin1String("/qt-widgets-app/qt-widgets-app.pro")) << 0;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -3,5 +3,11 @@
|
||||
<file>unit-tests/simple/main.cpp</file>
|
||||
<file>unit-tests/simple/simple.qbs</file>
|
||||
<file>unit-tests/simple/simple.pro</file>
|
||||
<file>unit-tests/qt-widgets-app/main.cpp</file>
|
||||
<file>unit-tests/qt-widgets-app/mainwindow.cpp</file>
|
||||
<file>unit-tests/qt-widgets-app/mainwindow.h</file>
|
||||
<file>unit-tests/qt-widgets-app/mainwindow.ui</file>
|
||||
<file>unit-tests/qt-widgets-app/qt-widgets-app.pro</file>
|
||||
<file>unit-tests/qt-widgets-app/qt-widgets-app.qbs</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -0,0 +1,11 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
@@ -0,0 +1,24 @@
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QMenuBar" name="menuBar" />
|
||||
<widget class="QToolBar" name="mainToolBar" />
|
||||
<widget class="QWidget" name="centralWidget" />
|
||||
<widget class="QStatusBar" name="statusBar" />
|
||||
</widget>
|
||||
<layoutDefault spacing="6" margin="11" />
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -0,0 +1,8 @@
|
||||
QT += core gui
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = qt-widgets-app
|
||||
TEMPLATE = app
|
||||
SOURCES += main.cpp mainwindow.cpp
|
||||
HEADERS += mainwindow.h
|
||||
FORMS += mainwindow.ui
|
@@ -0,0 +1,17 @@
|
||||
import qbs 1.0
|
||||
|
||||
QtApplication {
|
||||
name : "Qt Widgets Application"
|
||||
|
||||
Depends {
|
||||
name: "Qt"
|
||||
submodules: [ "widgets" ]
|
||||
}
|
||||
|
||||
files : [
|
||||
"main.cpp",
|
||||
"mainwindow.cpp",
|
||||
"mainwindow.h",
|
||||
"mainwindow.ui"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user