summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@nokia.com>2010-03-10 11:41:05 (GMT)
committerMorten Johan Sørvig <morten.sorvig@nokia.com>2010-03-10 13:08:27 (GMT)
commited719fefdb4e6fa3fd4c296c1042dfa0454169c6 (patch)
tree31044b0c47a0b5c2be2efdc28b4706e128f0bb70 /tests/manual
parent5fa84eeac031ef53babfa8ca616ca69cc1f2c514 (diff)
downloadQt-ed719fefdb4e6fa3fd4c296c1042dfa0454169c6.zip
Qt-ed719fefdb4e6fa3fd4c296c1042dfa0454169c6.tar.gz
Qt-ed719fefdb4e6fa3fd4c296c1042dfa0454169c6.tar.bz2
Import static contents tests from old manualtests
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/repaint/mainwindow/main.cpp28
-rw-r--r--tests/manual/repaint/mainwindow/mainwindow.pro15
-rw-r--r--tests/manual/repaint/scrollarea/main.cpp24
-rw-r--r--tests/manual/repaint/scrollarea/scrollarea.pro15
-rw-r--r--tests/manual/repaint/shared/shared.h40
-rw-r--r--tests/manual/repaint/splitter/main.cpp17
-rw-r--r--tests/manual/repaint/splitter/splitter.pro15
-rw-r--r--tests/manual/repaint/tableview/main.cpp36
-rw-r--r--tests/manual/repaint/tableview/tableview.pro8
-rw-r--r--tests/manual/repaint/task141091/main.cpp22
-rw-r--r--tests/manual/repaint/task141091/task141091.pro12
-rw-r--r--tests/manual/repaint/toplevel/main.cpp11
-rw-r--r--tests/manual/repaint/toplevel/toplevel.pro16
-rw-r--r--tests/manual/repaint/widget/main.cpp94
-rw-r--r--tests/manual/repaint/widget/widget.pro15
15 files changed, 368 insertions, 0 deletions
diff --git a/tests/manual/repaint/mainwindow/main.cpp b/tests/manual/repaint/mainwindow/main.cpp
new file mode 100644
index 0000000..d3efb99
--- /dev/null
+++ b/tests/manual/repaint/mainwindow/main.cpp
@@ -0,0 +1,28 @@
+#include <QtGui>
+#include "../shared/shared.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QMainWindow mainWindow;
+
+ mainWindow.setCentralWidget(new StaticWidget());
+ mainWindow.setStatusBar(new QStatusBar());
+
+ QDockWidget *dockWidget = new QDockWidget();
+ dockWidget->setWidget(new StaticWidget());
+ mainWindow.addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
+
+ QToolBar *toolBar = new QToolBar();
+
+ toolBar->addWidget(new StaticWidget())->setVisible(true);;
+
+ toolBar->addWidget(new QSpinBox())->setVisible(true);;
+ mainWindow.addToolBar(toolBar);
+
+ mainWindow.resize(600, 400);
+ mainWindow.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/repaint/mainwindow/mainwindow.pro b/tests/manual/repaint/mainwindow/mainwindow.pro
new file mode 100644
index 0000000..c269d57
--- /dev/null
+++ b/tests/manual/repaint/mainwindow/mainwindow.pro
@@ -0,0 +1,15 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Nov 8 15:46:28 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = mainwindow
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/scrollarea/main.cpp b/tests/manual/repaint/scrollarea/main.cpp
new file mode 100644
index 0000000..424c411
--- /dev/null
+++ b/tests/manual/repaint/scrollarea/main.cpp
@@ -0,0 +1,24 @@
+#include <QtGui>
+#include "../shared/shared.h"
+
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QScrollArea scrollView;
+
+ QWidget * staticWidget = new StaticWidget();
+ staticWidget->resize(400, 200);
+ scrollView.setWidget(staticWidget);
+
+ scrollView.setAttribute(Qt::WA_StaticContents);
+
+ scrollView.resize(600, 400);
+ scrollView.show();
+
+
+ return app.exec();
+}
+
+
diff --git a/tests/manual/repaint/scrollarea/scrollarea.pro b/tests/manual/repaint/scrollarea/scrollarea.pro
new file mode 100644
index 0000000..e1a40ad
--- /dev/null
+++ b/tests/manual/repaint/scrollarea/scrollarea.pro
@@ -0,0 +1,15 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Nov 8 15:28:57 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = scrollarea
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/shared/shared.h b/tests/manual/repaint/shared/shared.h
new file mode 100644
index 0000000..c7edfc1
--- /dev/null
+++ b/tests/manual/repaint/shared/shared.h
@@ -0,0 +1,40 @@
+#include <QtGui>
+class StaticWidget : public QWidget
+{
+Q_OBJECT
+public:
+ int hue;
+ StaticWidget(QWidget *parent = 0)
+ :QWidget(parent)
+ {
+ setAttribute(Qt::WA_StaticContents);
+ setAttribute(Qt::WA_OpaquePaintEvent);
+ hue = 200;
+ }
+
+ void resizeEvent(QResizeEvent *)
+ {
+ // qDebug() << "static widget resize from" << e->oldSize() << "to" << e->size();
+ }
+
+ void paintEvent(QPaintEvent *e)
+ {
+ QPainter p(this);
+ static int color = 200;
+ color = (color + 41) % 205 + 50;
+// color = ((color + 45) %150) + 100;
+ qDebug() << "static widget repaint" << e->rect();
+ p.fillRect(e->rect(), QColor::fromHsv(hue, 255, color));
+ p.setPen(QPen(QColor(Qt::white)));
+
+ for (int y = e->rect().top(); y <= e->rect().bottom() + 1; ++y) {
+ if (y % 20 == 0)
+ p.drawLine(e->rect().left(), y, e->rect().right(), y);
+ }
+
+ for (int x = e->rect().left(); x <= e->rect().right() +1 ; ++x) {
+ if (x % 20 == 0)
+ p.drawLine(x, e->rect().top(), x, e->rect().bottom());
+ }
+ }
+};
diff --git a/tests/manual/repaint/splitter/main.cpp b/tests/manual/repaint/splitter/main.cpp
new file mode 100644
index 0000000..3898c39
--- /dev/null
+++ b/tests/manual/repaint/splitter/main.cpp
@@ -0,0 +1,17 @@
+#include <QtGui>
+#include "../shared/shared.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QSplitter splitter;
+
+ splitter.addWidget(new StaticWidget());
+ splitter.addWidget(new StaticWidget());
+
+ splitter.resize(600, 400);
+ splitter.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/repaint/splitter/splitter.pro b/tests/manual/repaint/splitter/splitter.pro
new file mode 100644
index 0000000..0afc063
--- /dev/null
+++ b/tests/manual/repaint/splitter/splitter.pro
@@ -0,0 +1,15 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Nov 8 15:39:53 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = splitter
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/tableview/main.cpp b/tests/manual/repaint/tableview/main.cpp
new file mode 100644
index 0000000..7d72cc2
--- /dev/null
+++ b/tests/manual/repaint/tableview/main.cpp
@@ -0,0 +1,36 @@
+#include <QtGui>
+#include "../shared/shared.h"
+
+class CellWidget : public QWidget
+{
+public:
+ CellWidget (QWidget *parent = 0) : QWidget(parent) { }
+ void paintEvent(QPaintEvent * event)
+ {
+ static int value = 200;
+ value = (value + 41) % 205 + 50;
+ QPainter p(this);
+ p.fillRect(event->rect(), QColor::fromHsv(100, 255, value));
+ }
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ QTableWidget tableWidget;
+// tableWidget.setAttribute(Qt::WA_StaticContents);
+ tableWidget.viewport()->setAttribute(Qt::WA_StaticContents);
+ tableWidget.setRowCount(15);
+ tableWidget.setColumnCount(4);
+ for (int row = 0; row < 15; ++row)
+ for (int col = 0; col < 4; ++col)
+// tableWidget.setCellWidget(row, col, new StaticWidget());
+ tableWidget.setCellWidget(row, col, new CellWidget());
+ tableWidget.resize(400, 600);
+ tableWidget.show();
+
+
+ return app.exec();
+}
+
+
diff --git a/tests/manual/repaint/tableview/tableview.pro b/tests/manual/repaint/tableview/tableview.pro
new file mode 100644
index 0000000..4fccf4a
--- /dev/null
+++ b/tests/manual/repaint/tableview/tableview.pro
@@ -0,0 +1,8 @@
+HEADERS +=../shared/shared.h
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/manual/repaint/task141091/main.cpp b/tests/manual/repaint/task141091/main.cpp
new file mode 100644
index 0000000..0adeea2
--- /dev/null
+++ b/tests/manual/repaint/task141091/main.cpp
@@ -0,0 +1,22 @@
+#include <QtGui>
+#include <QDebug>
+
+class MyWidget : public QWidget
+{
+public:
+ MyWidget() : QWidget() {
+
+
+ setAttribute(Qt::WA_OpaquePaintEvent);
+ setAttribute(Qt::WA_StaticContents); }
+protected:
+ void paintEvent(QPaintEvent *e) { qDebug() << e->rect(); }
+};
+
+int main(int argc, char **argv)
+{
+ QApplication a(argc, argv);
+ MyWidget w;
+ w.show();
+ return a.exec();
+} \ No newline at end of file
diff --git a/tests/manual/repaint/task141091/task141091.pro b/tests/manual/repaint/task141091/task141091.pro
new file mode 100644
index 0000000..db89bd3
--- /dev/null
+++ b/tests/manual/repaint/task141091/task141091.pro
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Mar 6 13:44:00 2007
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG+=console
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/manual/repaint/toplevel/main.cpp b/tests/manual/repaint/toplevel/main.cpp
new file mode 100644
index 0000000..a5981a5
--- /dev/null
+++ b/tests/manual/repaint/toplevel/main.cpp
@@ -0,0 +1,11 @@
+#include <QtGui>
+#include "../shared/shared.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ StaticWidget widget;
+ widget.show();
+ return app.exec();
+}
+
diff --git a/tests/manual/repaint/toplevel/toplevel.pro b/tests/manual/repaint/toplevel/toplevel.pro
new file mode 100644
index 0000000..568ea8e
--- /dev/null
+++ b/tests/manual/repaint/toplevel/toplevel.pro
@@ -0,0 +1,16 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Nov 7 10:15:42 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = toplevel
+DEPENDPATH += .
+INCLUDEPATH += .
+CONFIG += console
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared
diff --git a/tests/manual/repaint/widget/main.cpp b/tests/manual/repaint/widget/main.cpp
new file mode 100644
index 0000000..05e419b
--- /dev/null
+++ b/tests/manual/repaint/widget/main.cpp
@@ -0,0 +1,94 @@
+#include <QtGui>
+#include "../shared/shared.h"
+
+class Child : public StaticWidget
+{
+Q_OBJECT
+public:
+ Child(QWidget *parent)
+ :StaticWidget(parent)
+ {
+ hue = 0;
+ }
+};
+
+QWidget *c;
+
+class TopLevel : public StaticWidget
+{
+Q_OBJECT
+public:
+ TopLevel()
+ {
+ resizeButton = new QPushButton("resize", this);
+ connect(resizeButton, SIGNAL(clicked()), SLOT(buttonResizeClicked()));
+
+ movebutton = new QPushButton("move", this);
+ connect(movebutton, SIGNAL(clicked()), SLOT(buttonMoveClicked()));
+ movebutton->move(70, 0);
+
+ moveResizebutton = new QPushButton("move + resize", this);
+ connect(moveResizebutton, SIGNAL(clicked()), SLOT(buttonMoveResizeClicked()));
+ moveResizebutton->move(150, 0);
+
+ scrollbutton = new QPushButton("scroll", this);
+ connect(scrollbutton, SIGNAL(clicked()), SLOT(buttonScrollClicked()));
+ scrollbutton->move(280, 0);
+ }
+
+public slots:
+ void buttonResizeClicked()
+ {
+ c->resize(c->size() + QSize(15, 15));
+ qDebug() << "child new size" << c->size();
+ }
+
+ void buttonMoveClicked()
+ {
+ c->move(c->pos() + QPoint(15, 15));
+ qDebug() << "child moved" << c->pos();
+ }
+
+ void buttonMoveResizeClicked()
+ {
+ QRect g = c->geometry();
+ g.adjust(15,15,30,30);
+ c->setGeometry(g);
+ qDebug() << "child moved" << c->pos() << "rezied" << c->size();
+ }
+
+
+ void buttonScrollClicked()
+ {
+ c->scroll(10, 10);
+ }
+
+protected:
+ QPushButton * resizeButton;
+ QPushButton * movebutton;
+ QPushButton * moveResizebutton;
+ QPushButton * scrollbutton;
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ TopLevel bc;
+ bc.resize(500, 500);
+
+ c = new Child(&bc);
+ c->move(100, 100);
+ c->resize(100, 100);
+
+ QWidget *gc = new StaticWidget(c);
+ gc->move(20, 20);
+ gc->resize(50,50);
+
+
+ bc.show();
+ return app.exec();
+}
+
+#include "main.moc"
+
diff --git a/tests/manual/repaint/widget/widget.pro b/tests/manual/repaint/widget/widget.pro
new file mode 100644
index 0000000..c9d8f87
--- /dev/null
+++ b/tests/manual/repaint/widget/widget.pro
@@ -0,0 +1,15 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Nov 7 11:16:05 2006
+######################################################################
+
+TEMPLATE = app
+TARGET = widget
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../shared/shared.h
+SOURCES += main.cpp
+CONFIG += qt warn_on debug create_prl link_prl
+OBJECTS_DIR = .obj/debug-shared
+MOC_DIR = .moc/debug-shared