summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-08-08 13:26:30 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-08-08 13:26:30 (GMT)
commite28e1f919cdc2b82c45b2a5ceee7a9261e70433d (patch)
tree31e2cf533867b86545b509dd7ee472182a4527f3 /tests/auto
parent74b7d4c2c4036e9f2c0da7f0eaad06cef954b923 (diff)
parent82a18deee74bef3e545bf6426164dbe12548e5d9 (diff)
downloadQt-e28e1f919cdc2b82c45b2a5ceee7a9261e70433d.zip
Qt-e28e1f919cdc2b82c45b2a5ceee7a9261e70433d.tar.gz
Qt-e28e1f919cdc2b82c45b2a5ceee7a9261e70433d.tar.bz2
Merge branch '4.8' of scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp61
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp370
-rw-r--r--tests/auto/qimagereader/images/test32bfv4.bmpbin0 -> 232874 bytes
-rw-r--r--tests/auto/qimagereader/images/test32v5.bmpbin0 -> 174858 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc2
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp22
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp51
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp7
-rw-r--r--tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp283
-rw-r--r--tests/auto/qstring/tst_qstring.cpp20
-rw-r--r--tests/auto/qxmlquery/pushBaselines/allAtomics.ref2
-rw-r--r--tests/auto/selftests/expected_printdatatags.txt6
-rw-r--r--tests/auto/selftests/expected_printdatatagswithglobaltags.txt12
-rw-r--r--tests/auto/selftests/printdatatags/printdatatags.pro8
-rw-r--r--tests/auto/selftests/printdatatags/tst_printdatatags.cpp90
-rw-r--r--tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro8
-rw-r--r--tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp106
-rw-r--r--tests/auto/selftests/selftests.pro3
-rw-r--r--tests/auto/selftests/selftests.qrc2
-rw-r--r--tests/auto/selftests/tst_selftests.cpp14
-rw-r--r--tests/auto/symbols/tst_symbols.cpp8
21 files changed, 1043 insertions, 32 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 19b7a76..280f952 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -52,6 +52,8 @@
#include <QInputContext>
#include <private/qapplication_p.h>
+#include "qplatformdefs.h"
+
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
#define SRCDIR "."
@@ -133,6 +135,9 @@ private slots:
void focusOutClearSelection();
void echoMode();
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ void passwordEchoDelay();
+#endif
void geometrySignals();
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
@@ -2051,6 +2056,62 @@ void tst_qdeclarativetextinput::echoMode()
delete canvas;
}
+
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+void tst_qdeclarativetextinput::passwordEchoDelay()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/echoMode.qml");
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QVERIFY(canvas->rootObject() != 0);
+
+ QDeclarativeTextInput *input = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput")));
+
+ QChar fillChar = QLatin1Char('*');
+
+ input->setEchoMode(QDeclarativeTextInput::Password);
+ QCOMPARE(input->displayText(), QString(8, fillChar));
+ input->setText(QString());
+ QCOMPARE(input->displayText(), QString());
+
+ QTest::keyPress(canvas, '0');
+ QTest::keyPress(canvas, '1');
+ QTest::keyPress(canvas, '2');
+ QCOMPARE(input->displayText(), QString(2, fillChar) + QLatin1Char('2'));
+ QTest::keyPress(canvas, '3');
+ QTest::keyPress(canvas, '4');
+ QCOMPARE(input->displayText(), QString(4, fillChar) + QLatin1Char('4'));
+ QTest::keyPress(canvas, Qt::Key_Backspace);
+ QCOMPARE(input->displayText(), QString(4, fillChar));
+ QTest::keyPress(canvas, '4');
+ QCOMPARE(input->displayText(), QString(4, fillChar) + QLatin1Char('4'));
+ QTest::qWait(QT_GUI_PASSWORD_ECHO_DELAY);
+ QTRY_COMPARE(input->displayText(), QString(5, fillChar));
+ QTest::keyPress(canvas, '5');
+ QCOMPARE(input->displayText(), QString(5, fillChar) + QLatin1Char('5'));
+ input->setFocus(false);
+ QVERIFY(!input->hasFocus());
+ QCOMPARE(input->displayText(), QString(6, fillChar));
+ input->setFocus(true);
+ QTRY_VERIFY(input->hasFocus());
+ QCOMPARE(input->displayText(), QString(6, fillChar));
+ QTest::keyPress(canvas, '6');
+ QCOMPARE(input->displayText(), QString(6, fillChar) + QLatin1Char('6'));
+
+ QInputMethodEvent ev;
+ ev.setCommitString(QLatin1String("7"));
+ QApplication::sendEvent(canvas, &ev);
+ QCOMPARE(input->displayText(), QString(7, fillChar) + QLatin1Char('7'));
+
+ delete canvas;
+}
+#endif
+
+
void tst_qdeclarativetextinput::simulateKey(QDeclarativeView *view, int key)
{
QKeyEvent press(QKeyEvent::KeyPress, key, 0);
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index d764187..d452820 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -190,7 +190,8 @@ static int verifyHierarchy(QAccessibleInterface *iface)
if (middleChild) {
entry = if2->navigate(QAccessible::Sibling, middle, &if3);
EXPECT(entry == 0 && if3->object() == middleChild->object());
- delete if3;
+ if (entry == 0)
+ delete if3;
EXPECT(iface->indexOfChild(middleChild) == middle);
}
@@ -270,6 +271,9 @@ private slots:
void scrollAreaTest();
void tableWidgetTest();
void tableViewTest();
+ void table2ListTest();
+ void table2TreeTest();
+ void table2TableTest();
void calendarWidgetTest();
void dockWidgetTest();
void pushButtonTest();
@@ -304,6 +308,10 @@ QString eventName(const int ev)
case 0x0012: return "ScrollingStart";
case 0x0013: return "ScrollingEnd";
case 0x0018: return "MenuCommand";
+
+ case 0x0116: return "TableModelChanged";
+ case 0x011B: return "TextCaretMoved";
+
case 0x8000: return "ObjectCreated";
case 0x8001: return "ObjectDestroyed";
case 0x8002: return "ObjectShow";
@@ -1752,18 +1760,21 @@ void tst_QAccessibility::applicationTest()
void tst_QAccessibility::mainWindowTest()
{
- QMainWindow mw;
- mw.resize(300, 200);
- mw.show(); // triggers layout
+ QMainWindow *mw = new QMainWindow;
+ mw->resize(300, 200);
+ mw->show(); // triggers layout
QLatin1String name = QLatin1String("I am the main window");
- mw.setWindowTitle(name);
- QTest::qWaitForWindowShown(&mw);
+ mw->setWindowTitle(name);
+ QTest::qWaitForWindowShown(mw);
+ QVERIFY_EVENT(mw, 0, QAccessible::ObjectShow);
- QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&mw);
+ QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(mw);
QCOMPARE(interface->text(QAccessible::Name, 0), name);
QCOMPARE(interface->role(0), QAccessible::Window);
delete interface;
+ delete mw;
+ QTestAccessibility::clearEvents();
}
class CounterButton : public QPushButton {
@@ -2749,6 +2760,9 @@ void tst_QAccessibility::textBrowserTest()
void tst_QAccessibility::listViewTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QListView listView;
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView);
@@ -2814,6 +2828,7 @@ void tst_QAccessibility::listViewTest()
}
QTestAccessibility::clearEvents();
+#endif
}
@@ -3068,9 +3083,11 @@ void tst_QAccessibility::lineEditTest()
le3->deselect();
le3->setCursorPosition(3);
QCOMPARE(textIface->cursorPosition(), 3);
+ QTRY_VERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(le3, 0, QAccessible::TextCaretMoved)));
QCOMPARE(textIface->selectionCount(), 0);
- int start, end;
+ QTestAccessibility::clearEvents();
+ int start, end;
QCOMPARE(textIface->text(0, 8), QString::fromLatin1("I always"));
QCOMPARE(textIface->textAtOffset(0, QAccessible2::CharBoundary,&start,&end), QString::fromLatin1("I"));
QCOMPARE(start, 0);
@@ -3113,6 +3130,7 @@ void tst_QAccessibility::lineEditTest()
delete iface;
delete toplevel;
+ QTestAccessibility::clearEvents();
}
void tst_QAccessibility::workspaceTest()
@@ -3523,6 +3541,9 @@ void tst_QAccessibility::scrollAreaTest()
void tst_QAccessibility::tableWidgetTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QWidget *topLevel = new QWidget;
QTableWidget *w = new QTableWidget(8,4,topLevel);
@@ -3562,6 +3583,7 @@ void tst_QAccessibility::tableWidgetTest()
delete topLevel;
}
QTestAccessibility::clearEvents();
+#endif
}
class QtTestTableModel: public QAbstractTableModel
@@ -3644,6 +3666,9 @@ public:
void tst_QAccessibility::tableViewTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
{
QtTestTableModel *model = new QtTestTableModel(3, 4);
QTableView *w = new QTableView();
@@ -3723,6 +3748,331 @@ void tst_QAccessibility::tableViewTest()
delete model;
}
QTestAccessibility::clearEvents();
+#endif
+}
+
+void tst_QAccessibility::table2ListTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QListWidget *listView = new QListWidget;
+ listView->addItem("Oslo");
+ listView->addItem("Berlin");
+ listView->addItem("Brisbane");
+ listView->resize(400,400);
+ listView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(listView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(listView);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::List);
+ QCOMPARE(iface->childCount(), 3);
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 1);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("Oslo"));
+ QCOMPARE(child1->role(0), QAccessible::ListItem);
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 2, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 2);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("Berlin"));
+ delete child2;
+
+ QAccessibleInterface *child3 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child3), 0);
+ QVERIFY(child3);
+ QCOMPARE(iface->indexOfChild(child3), 3);
+ QCOMPARE(child3->text(QAccessible::Name, 0), QString("Brisbane"));
+ delete child3;
+ QTestAccessibility::clearEvents();
+
+ // Check for events
+ QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(1)).center());
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 2, QAccessible::Selection)));
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 2, QAccessible::Focus)));
+ QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(2)).center());
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 3, QAccessible::Selection)));
+ QVERIFY(QTestAccessibility::events().contains(QTestAccessibilityEvent(listView, 3, QAccessible::Focus)));
+
+ listView->addItem("Munich");
+ QCOMPARE(iface->childCount(), 4);
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 1);
+ QCOMPARE(table2->rowCount(), 4);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Oslo"));
+ QAccessibleTable2CellInterface *cell4;
+ QVERIFY(cell4 = table2->cellAt(3,0));
+ QCOMPARE(cell4->text(QAccessible::Name, 0), QString("Munich"));
+ QCOMPARE(cell4->role(0), QAccessible::ListItem);
+ QCOMPARE(cell4->rowIndex(), 3);
+ QCOMPARE(cell4->columnIndex(), 0);
+ QVERIFY(!cell4->isExpandable());
+
+ delete cell4;
+ delete cell1;
+ delete iface;
+ delete listView;
+ QTestAccessibility::clearEvents();
+#endif
+}
+
+void tst_QAccessibility::table2TreeTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QTreeWidget *treeView = new QTreeWidget;
+ treeView->setColumnCount(2);
+ QTreeWidgetItem *header = new QTreeWidgetItem;
+ header->setText(0, "Artist");
+ header->setText(1, "Work");
+ treeView->setHeaderItem(header);
+
+ QTreeWidgetItem *root1 = new QTreeWidgetItem;
+ root1->setText(0, "Spain");
+ treeView->addTopLevelItem(root1);
+
+ QTreeWidgetItem *item1 = new QTreeWidgetItem;
+ item1->setText(0, "Picasso");
+ item1->setText(1, "Guernica");
+ root1->addChild(item1);
+
+ QTreeWidgetItem *item2 = new QTreeWidgetItem;
+ item2->setText(0, "Tapies");
+ item2->setText(1, "Ambrosia");
+ root1->addChild(item2);
+
+ QTreeWidgetItem *root2 = new QTreeWidgetItem;
+ root2->setText(0, "Austria");
+ treeView->addTopLevelItem(root2);
+
+ QTreeWidgetItem *item3 = new QTreeWidgetItem;
+ item3->setText(0, "Klimt");
+ item3->setText(1, "The Kiss");
+ root2->addChild(item3);
+
+ treeView->resize(400,400);
+ treeView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(treeView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView);
+ QEXPECT_FAIL("", "Implement Sibling navigation for table2 cells.", Continue);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::Tree);
+ // header and 2 rows (the others are not expanded, thus not visible)
+ QCOMPARE(iface->childCount(), 6);
+
+ QAccessibleInterface *header1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &header1), 0);
+ QVERIFY(header1);
+ QCOMPARE(iface->indexOfChild(header1), 1);
+ QCOMPARE(header1->text(QAccessible::Name, 0), QString("Artist"));
+ QCOMPARE(header1->role(0), QAccessible::ColumnHeader);
+ delete header1;
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 3);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("Spain"));
+ QCOMPARE(child1->role(0), QAccessible::TreeItem);
+ QVERIFY(!(child1->state(0) & QAccessible::Expanded));
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 5, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 5);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("Austria"));
+ delete child2;
+
+ QTestAccessibility::clearEvents();
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 2);
+ QCOMPARE(table2->rowCount(), 2);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Spain"));
+ QAccessibleTable2CellInterface *cell2;
+ QVERIFY(cell2 = table2->cellAt(1,0));
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("Austria"));
+ QCOMPARE(cell2->role(0), QAccessible::TreeItem);
+ QCOMPARE(cell2->rowIndex(), 1);
+ QCOMPARE(cell2->columnIndex(), 0);
+ QVERIFY(cell2->isExpandable());
+ QCOMPARE(iface->indexOfChild(cell2), 5);
+ QVERIFY(!(cell2->state(0) & QAccessible::Expanded));
+ QCOMPARE(table2->columnDescription(1), QString("Work"));
+ delete cell2;
+ delete cell1;
+
+ treeView->expandAll();
+
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(treeView);
+ QTest::qWait(100);
+#endif
+
+ QCOMPARE(table2->columnCount(), 2);
+ QCOMPARE(table2->rowCount(), 5);
+ cell1 = table2->cellAt(1,0);
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("Picasso"));
+ QCOMPARE(iface->indexOfChild(cell1), 5); // 1 based + 2 header + 2 for root item
+
+ cell2 = table2->cellAt(4,0);
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("Klimt"));
+ QCOMPARE(cell2->role(0), QAccessible::TreeItem);
+ QCOMPARE(cell2->rowIndex(), 4);
+ QCOMPARE(cell2->columnIndex(), 0);
+ QVERIFY(!cell2->isExpandable());
+ QCOMPARE(iface->indexOfChild(cell2), 11);
+
+ QCOMPARE(table2->columnDescription(0), QString("Artist"));
+ QCOMPARE(table2->columnDescription(1), QString("Work"));
+
+ delete iface;
+ QTestAccessibility::clearEvents();
+#endif
+}
+
+
+void tst_QAccessibility::table2TableTest()
+{
+#if !defined(Q_WS_X11)
+ QSKIP( "Accessible table2 interface is currently only supported on X11.", SkipAll);
+#else
+ QTableWidget *tableView = new QTableWidget(3, 3);
+ tableView->setColumnCount(3);
+ QStringList hHeader;
+ hHeader << "h1" << "h2" << "h3";
+ tableView->setHorizontalHeaderLabels(hHeader);
+
+ QStringList vHeader;
+ vHeader << "v1" << "v2" << "v3";
+ tableView->setVerticalHeaderLabels(vHeader);
+
+ for (int i = 0; i<9; ++i) {
+ QTableWidgetItem *item = new QTableWidgetItem;
+ item->setText(QString::number(i/3) + QString(".") + QString::number(i%3));
+ tableView->setItem(i/3, i%3, item);
+ }
+
+ tableView->resize(600,600);
+ tableView->show();
+ QTest::qWait(1); // Need this for indexOfchild to work.
+#if defined(Q_WS_X11)
+ qt_x11_wait_for_window_manager(tableView);
+ QTest::qWait(100);
+#endif
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView);
+ QEXPECT_FAIL("", "Implement Sibling navigation for table2 cells.", Continue);
+ QCOMPARE(verifyHierarchy(iface), 0);
+
+ QCOMPARE((int)iface->role(0), (int)QAccessible::Table);
+ // header and 2 rows (the others are not expanded, thus not visible)
+ QCOMPARE(iface->childCount(), 9+3+3+1); // cell+headers+topleft button
+
+ QAccessibleInterface *cornerButton = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 1, &cornerButton), 0);
+ QVERIFY(cornerButton);
+ QCOMPARE(iface->indexOfChild(cornerButton), 1);
+ QCOMPARE(cornerButton->role(0), QAccessible::Pane);
+ delete cornerButton;
+
+ QAccessibleInterface *child1 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 3, &child1), 0);
+ QVERIFY(child1);
+ QCOMPARE(iface->indexOfChild(child1), 3);
+ QCOMPARE(child1->text(QAccessible::Name, 0), QString("h2"));
+ QCOMPARE(child1->role(0), QAccessible::ColumnHeader);
+ QVERIFY(!(child1->state(0) & QAccessible::Expanded));
+ delete child1;
+
+ QAccessibleInterface *child2 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 11, &child2), 0);
+ QVERIFY(child2);
+ QCOMPARE(iface->indexOfChild(child2), 11);
+ QCOMPARE(child2->text(QAccessible::Name, 0), QString("1.1"));
+ QAccessibleTable2CellInterface *cell2Iface = static_cast<QAccessibleTable2CellInterface*>(child2);
+ QCOMPARE(cell2Iface->rowIndex(), 1);
+ QCOMPARE(cell2Iface->columnIndex(), 1);
+ delete child2;
+
+ QAccessibleInterface *child3 = 0;
+ QCOMPARE(iface->navigate(QAccessible::Child, 12, &child3), 0);
+ QCOMPARE(iface->indexOfChild(child3), 12);
+ QCOMPARE(child3->text(QAccessible::Name, 0), QString("1.2"));
+ delete child3;
+
+ QTestAccessibility::clearEvents();
+
+ // table 2
+ QAccessibleTable2Interface *table2 = iface->table2Interface();
+ QVERIFY(table2);
+ QCOMPARE(table2->columnCount(), 3);
+ QCOMPARE(table2->rowCount(), 3);
+ QAccessibleTable2CellInterface *cell1;
+ QVERIFY(cell1 = table2->cellAt(0,0));
+ QCOMPARE(cell1->text(QAccessible::Name, 0), QString("0.0"));
+ QCOMPARE(iface->indexOfChild(cell1), 6);
+
+ QAccessibleTable2CellInterface *cell2;
+ QVERIFY(cell2 = table2->cellAt(0,1));
+ QCOMPARE(cell2->text(QAccessible::Name, 0), QString("0.1"));
+ QCOMPARE(cell2->role(0), QAccessible::Cell);
+ QCOMPARE(cell2->rowIndex(), 0);
+ QCOMPARE(cell2->columnIndex(), 1);
+ QCOMPARE(iface->indexOfChild(cell2), 7);
+ delete cell2;
+
+ QAccessibleTable2CellInterface *cell3;
+ QVERIFY(cell3 = table2->cellAt(1,2));
+ QCOMPARE(cell3->text(QAccessible::Name, 0), QString("1.2"));
+ QCOMPARE(cell3->role(0), QAccessible::Cell);
+ QCOMPARE(cell3->rowIndex(), 1);
+ QCOMPARE(cell3->columnIndex(), 2);
+ QCOMPARE(iface->indexOfChild(cell3), 12);
+ delete cell3;
+
+ QCOMPARE(table2->columnDescription(0), QString("h1"));
+ QCOMPARE(table2->columnDescription(1), QString("h2"));
+ QCOMPARE(table2->columnDescription(2), QString("h3"));
+ QCOMPARE(table2->rowDescription(0), QString("v1"));
+ QCOMPARE(table2->rowDescription(1), QString("v2"));
+ QCOMPARE(table2->rowDescription(2), QString("v3"));
+
+ delete iface;
+
+ delete tableView;
+
+ QTestAccessibility::clearEvents();
+#endif
}
void tst_QAccessibility::calendarWidgetTest()
@@ -3980,6 +4330,9 @@ void tst_QAccessibility::comboBoxTest()
void tst_QAccessibility::treeWidgetTest()
{
+#if defined(Q_WS_X11)
+ QSKIP( "Accessible table1 interface is no longer supported on X11.", SkipAll);
+#else
QWidget *w = new QWidget;
QTreeWidget *tree = new QTreeWidget(w);
QHBoxLayout *l = new QHBoxLayout(w);
@@ -4037,6 +4390,7 @@ void tst_QAccessibility::treeWidgetTest()
delete w;
QTestAccessibility::clearEvents();
+#endif
}
void tst_QAccessibility::labelTest()
diff --git a/tests/auto/qimagereader/images/test32bfv4.bmp b/tests/auto/qimagereader/images/test32bfv4.bmp
new file mode 100644
index 0000000..3706037
--- /dev/null
+++ b/tests/auto/qimagereader/images/test32bfv4.bmp
Binary files differ
diff --git a/tests/auto/qimagereader/images/test32v5.bmp b/tests/auto/qimagereader/images/test32v5.bmp
new file mode 100644
index 0000000..8ad3cfa
--- /dev/null
+++ b/tests/auto/qimagereader/images/test32v5.bmp
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 632b73a..2c70652 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -42,6 +42,8 @@
<file>images/teapot.ppm</file>
<file>images/test.ppm</file>
<file>images/test.xpm</file>
+ <file>images/test32bfv4.bmp</file>
+ <file>images/test32v5.bmp</file>
<file>images/tst7.bmp</file>
<file>images/tst7.png</file>
<file>images/transparent.xpm</file>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 5c65cb3..5d958d7 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -234,6 +234,8 @@ void tst_QImageReader::readImage_data()
QTest::newRow("empty") << QString() << false << QByteArray();
QTest::newRow("BMP: colorful") << QString("colorful.bmp") << true << QByteArray("bmp");
+ QTest::newRow("BMP: test32bfv4") << QString("test32bfv4.bmp") << true << QByteArray("bmp");
+ QTest::newRow("BMP: test32v5") << QString("test32v5.bmp") << true << QByteArray("bmp");
QTest::newRow("BMP: font") << QString("font.bmp") << true << QByteArray("bmp");
QTest::newRow("BMP: signed char") << QString("crash-signed-char.bmp") << true << QByteArray("bmp");
QTest::newRow("BMP: 4bpp RLE") << QString("4bpp-rle.bmp") << true << QByteArray("bmp");
@@ -432,6 +434,8 @@ void tst_QImageReader::setClipRect_data()
QTest::addColumn<QRect>("newRect");
QTest::addColumn<QByteArray>("format");
QTest::newRow("BMP: colorful") << "colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp");
+ QTest::newRow("BMP: test32bfv4") << "test32bfv4" << QRect(0, 0, 50, 50) << QByteArray("bmp");
+ QTest::newRow("BMP: test32v5") << "test32v5" << QRect(0, 0, 50, 50) << QByteArray("bmp");
QTest::newRow("BMP: font") << "font" << QRect(0, 0, 50, 50) << QByteArray("bmp");
QTest::newRow("BMP: 4bpp uncompressed") << "tst7.bmp" << QRect(0, 0, 31, 31) << QByteArray("bmp");
QTest::newRow("XPM: marble") << "marble" << QRect(0, 0, 50, 50) << QByteArray("xpm");
@@ -484,6 +488,8 @@ void tst_QImageReader::setScaledClipRect_data()
QTest::addColumn<QByteArray>("format");
QTest::newRow("BMP: colorful") << "colorful" << QRect(0, 0, 50, 50) << QByteArray("bmp");
+ QTest::newRow("BMP: test32bfv4") << "test32bfv4" << QRect(0, 0, 50, 50) << QByteArray("bmp");
+ QTest::newRow("BMP: test32v5") << "test32v5" << QRect(0, 0, 50, 50) << QByteArray("bmp");
QTest::newRow("BMP: font") << "font" << QRect(0, 0, 50, 50) << QByteArray("bmp");
QTest::newRow("XPM: marble") << "marble" << QRect(0, 0, 50, 50) << QByteArray("xpm");
QTest::newRow("PNG: kollada") << "kollada" << QRect(0, 0, 50, 50) << QByteArray("png");
@@ -555,6 +561,8 @@ void tst_QImageReader::imageFormat_data()
QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm") << QImage::Format_Indexed8;
QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp") << QImage::Format_Indexed8;
QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp") << QImage::Format_Indexed8;
+ QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp") << QImage::Format_RGB32;
+ QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp") << QImage::Format_RGB32;
QTest::newRow("png") << QString("kollada.png") << QByteArray("png") << QImage::Format_ARGB32;
QTest::newRow("png-2") << QString("YCbCr_cmyk.png") << QByteArray("png") << QImage::Format_RGB32;
QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng") << QImage::Format_Invalid;
@@ -684,6 +692,8 @@ void tst_QImageReader::supportsAnimation_data()
QTest::newRow("BMP: colorful") << QString("colorful.bmp") << false;
QTest::newRow("BMP: font") << QString("font.bmp") << false;
QTest::newRow("BMP: signed char") << QString("crash-signed-char.bmp") << false;
+ QTest::newRow("BMP: test32bfv4") << QString("test32bfv4.bmp") << false;;
+ QTest::newRow("BMP: test32v5") << QString("test32v5.bmp") << false;
QTest::newRow("XPM: marble") << QString("marble.xpm") << false;
QTest::newRow("PNG: kollada") << QString("kollada.png") << false;
QTest::newRow("PPM: teapot") << QString("teapot.ppm") << false;
@@ -1064,6 +1074,8 @@ void tst_QImageReader::readFromDevice_data()
QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm");
QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp");
QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp");
+ QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp");
+ QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp");
QTest::newRow("png") << QString("kollada.png") << QByteArray("png");
#ifdef QTEST_HAVE_MNG
QTest::newRow("mng-1") << QString("ball.mng") << QByteArray("mng");
@@ -1155,6 +1167,8 @@ void tst_QImageReader::readFromFileAfterJunk_data()
QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm");
QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp");
QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp");
+ QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp");
+ QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp");
QTest::newRow("png") << QString("kollada.png") << QByteArray("png");
// QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng");
// QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng");
@@ -1233,6 +1247,8 @@ void tst_QImageReader::devicePosition_data()
QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm");
QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp");
QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp");
+ QTest::newRow("bmp-3") << QString("test32bfv4.bmp") << QByteArray("bmp");
+ QTest::newRow("bmp-4") << QString("test32v5.bmp") << QByteArray("bmp");
QTest::newRow("png") << QString("kollada.png") << QByteArray("png");
// QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng");
// QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng");
@@ -1305,6 +1321,12 @@ void tst_QImageReader::readFromResources_data()
QTest::newRow("4bpp-rle.bmp") << QString("4bpp-rle.bmp")
<< QByteArray("bmp") << QSize(640, 480)
<< QString("");
+ QTest::newRow("test32bfv4.bmp") << QString("test32bfv4.bmp")
+ << QByteArray("bmp") << QSize(373, 156)
+ << QString("");
+ QTest::newRow("test32v5.bmp") << QString("test32v5.bmp")
+ << QByteArray("bmp") << QSize(373, 156)
+ << QString("");
#ifdef QTEST_HAVE_GIF
QTest::newRow("corrupt.gif") << QString("corrupt.gif")
<< QByteArray("gif") << QSize(0, 0)
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index f0f1685..6abbdcd 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -72,6 +72,8 @@
#include "qcommonstyle.h"
#include "qstyleoption.h"
+#include "qplatformdefs.h"
+
QT_BEGIN_NAMESPACE
class QPainter;
QT_END_NAMESPACE
@@ -180,6 +182,10 @@ private slots:
void echoMode();
void passwordEchoOnEdit();
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+ void passwordEchoDelay();
+#endif
+
void maxLength_mask_data();
void maxLength_mask();
@@ -1724,6 +1730,51 @@ void tst_QLineEdit::passwordEchoOnEdit()
testWidget->setEchoMode(QLineEdit::Normal);
}
+#ifdef QT_GUI_PASSWORD_ECHO_DELAY
+void tst_QLineEdit::passwordEchoDelay()
+{
+ QStyleOptionFrameV2 opt;
+ QChar fillChar = testWidget->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, testWidget);
+
+ testWidget->setEchoMode(QLineEdit::Password);
+ testWidget->setFocus();
+ testWidget->raise();
+ QTRY_VERIFY(testWidget->hasFocus());
+
+ QTest::keyPress(testWidget, '0');
+ QTest::keyPress(testWidget, '1');
+ QTest::keyPress(testWidget, '2');
+ QCOMPARE(testWidget->displayText(), QString(2, fillChar) + QLatin1Char('2'));
+ QTest::keyPress(testWidget, '3');
+ QTest::keyPress(testWidget, '4');
+ QCOMPARE(testWidget->displayText(), QString(4, fillChar) + QLatin1Char('4'));
+ QTest::keyPress(testWidget, Qt::Key_Backspace);
+ QCOMPARE(testWidget->displayText(), QString(4, fillChar));
+ QTest::keyPress(testWidget, '4');
+ QCOMPARE(testWidget->displayText(), QString(4, fillChar) + QLatin1Char('4'));
+ QTest::qWait(QT_GUI_PASSWORD_ECHO_DELAY);
+ QTRY_COMPARE(testWidget->displayText(), QString(5, fillChar));
+ QTest::keyPress(testWidget, '5');
+ QCOMPARE(testWidget->displayText(), QString(5, fillChar) + QLatin1Char('5'));
+ testWidget->clearFocus();
+ QVERIFY(!testWidget->hasFocus());
+ QCOMPARE(testWidget->displayText(), QString(6, fillChar));
+ testWidget->setFocus();
+ QTRY_VERIFY(testWidget->hasFocus());
+ QCOMPARE(testWidget->displayText(), QString(6, fillChar));
+ QTest::keyPress(testWidget, '6');
+ QCOMPARE(testWidget->displayText(), QString(6, fillChar) + QLatin1Char('6'));
+
+ QInputMethodEvent ev;
+ ev.setCommitString(QLatin1String("7"));
+ QApplication::sendEvent(testWidget, &ev);
+ QCOMPARE(testWidget->displayText(), QString(7, fillChar) + QLatin1Char('7'));
+
+ // restore clean state
+ testWidget->setEchoMode(QLineEdit::Normal);
+}
+#endif
+
void tst_QLineEdit::maxLength_mask_data()
{
QTest::addColumn<QString>("mask");
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index f56176a..70287a9 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -1672,10 +1672,8 @@ void tst_QNetworkReply::getErrors()
QFETCH(QString, url);
QNetworkRequest request(url);
-#if defined(Q_OS_WIN) || defined (Q_OS_SYMBIAN)
if (qstrcmp(QTest::currentDataTag(), "empty-scheme-host") == 0 && QFileInfo(url).isAbsolute())
QTest::ignoreMessage(QtWarningMsg, "QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files");
-#endif
QNetworkReplyPtr reply = manager.get(request);
reply->setParent(this); // we have expect-fails
@@ -1691,10 +1689,9 @@ void tst_QNetworkReply::getErrors()
//qDebug() << reply->errorString();
QFETCH(int, error);
-#if defined(Q_OS_WIN) || defined (Q_OS_SYMBIAN)
if (QFileInfo(url).isAbsolute())
- QEXPECT_FAIL("empty-scheme-host", "this is expected to fail on Windows and Symbian, QTBUG-17731", Abort);
-#endif
+ QEXPECT_FAIL("empty-scheme-host", "this is expected to fail, QTBUG-17731", Abort);
+
QEXPECT_FAIL("ftp-is-dir", "QFtp cannot provide enough detail", Abort);
// the line below is not necessary
QEXPECT_FAIL("ftp-dir-not-readable", "QFtp cannot provide enough detail", Abort);
diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index edc81bc..5f1a621 100644
--- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -92,6 +92,7 @@ private slots:
void escapedTableName();
void whiteSpaceInIdentifiers();
void psqlSchemaTest();
+ void selectAfterUpdate();
private:
void dropTestTables( QSqlDatabase db );
@@ -118,6 +119,8 @@ void tst_QSqlRelationalTableModel::recreateTestTables(QSqlDatabase db)
QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(2, 'trond', 2, 1)"));
QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(3, 'vohi', 1, 2)"));
QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(4, 'boris', 2, 2)"));
+ QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(5, 'nat', NULL, NULL)"));
+ QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(6, 'ale', NULL, 2)"));
QVERIFY_SQL( q, exec("create table " + reltest2 + " (tid int not null primary key, title varchar(20))"));
QVERIFY_SQL( q, exec("insert into " + reltest2 + " values(1, 'herr')"));
@@ -221,6 +224,16 @@ void tst_QSqlRelationalTableModel::data()
//try a non-existent index
QVERIFY2(model.data(model.index(0,4)).isValid() == false,"Invalid index returned valid QVariant");
+ // check row with null relation: they are reported only in LeftJoin mode
+ QCOMPARE(model.rowCount(), 4);
+
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(4, 0)).toInt(), 5);
+ QCOMPARE(model.data(model.index(4, 1)).toString(), QString("nat"));
+ QVERIFY2(model.data(model.index(4, 2)).isValid() == true, "NULL relation reported with invalid QVariant");
+
//check data retrieval when relational key is a non-integer type
//in this case a string
QSqlRelationalTableModel model2(0,db);
@@ -379,6 +392,24 @@ void tst_QSqlRelationalTableModel::setData()
QCOMPARE(model.data(model.index(0,1)).toString(), QString("Mr"));
}
+ // Redo same tests, with a LeftJoin
+ {
+ QSqlRelationalTableModel model(0, db);
+
+ model.setTable(reltest2);
+ model.setRelation(1, QSqlRelation(reltest5, "title", "abbrev"));
+ model.setEditStrategy(QSqlTableModel::OnManualSubmit);
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(0,1)).toString(), QString("Mr"));
+ QVERIFY(model.setData(model.index(0,1), QString("herr")));
+ QCOMPARE(model.data(model.index(0,1)).toString(), QString("Hr"));
+ QVERIFY_SQL(model, submitAll());
+
+ QCOMPARE(model.data(model.index(0,1)).toString(), QString("Hr"));
+ }
+
}
void tst_QSqlRelationalTableModel::multipleRelation()
@@ -402,6 +433,21 @@ void tst_QSqlRelationalTableModel::multipleRelation()
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
QCOMPARE(model.data(model.index(0, 3)).toString(), QString("Trondheim"));
+
+ // Redo same test in the LeftJoin mode
+ model.setTable(reltest1);
+ model.setRelation(2, QSqlRelation(reltest2, "tid", "title"));
+ model.setRelation(3, QSqlRelation(reltest4, "id", "name"));
+ model.setSort(0, Qt::AscendingOrder);
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(2, 0)).toInt(), 3);
+
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
+ QCOMPARE(model.data(model.index(0, 3)).toString(), QString("Trondheim"));
}
void tst_QSqlRelationalTableModel::insertRecord()
@@ -423,7 +469,7 @@ void tst_QSqlRelationalTableModel::insertRecord()
QSqlField f3("title_key", QVariant::Int);
QSqlField f4("another_title_key", QVariant::Int);
- f1.setValue(5);
+ f1.setValue(7);
f2.setValue("test");
f3.setValue(1);
f4.setValue(2);
@@ -440,9 +486,17 @@ void tst_QSqlRelationalTableModel::insertRecord()
QVERIFY_SQL(model, insertRecord(-1, rec));
- QCOMPARE(model.data(model.index(4, 0)).toInt(), 5);
+ QCOMPARE(model.data(model.index(4, 0)).toInt(), 7);
QCOMPARE(model.data(model.index(4, 1)).toString(), QString("test"));
QCOMPARE(model.data(model.index(4, 2)).toString(), QString("herr"));
+
+ // In LeftJoin mode, two additional rows are fetched
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(6, 0)).toInt(), 7);
+ QCOMPARE(model.data(model.index(6, 1)).toString(), QString("test"));
+ QCOMPARE(model.data(model.index(6, 2)).toString(), QString("herr"));
}
void tst_QSqlRelationalTableModel::setRecord()
@@ -465,7 +519,7 @@ void tst_QSqlRelationalTableModel::setRecord()
QSqlField f3("title_key", QVariant::Int);
QSqlField f4("another_title_key", QVariant::Int);
- f1.setValue(5);
+ f1.setValue(7);
f2.setValue("tester");
f3.setValue(1);
f4.setValue(2);
@@ -486,14 +540,14 @@ void tst_QSqlRelationalTableModel::setRecord()
QVERIFY_SQL(model, setRecord(1, rec));
- QCOMPARE(model.data(model.index(1, 0)).toInt(), 5);
+ QCOMPARE(model.data(model.index(1, 0)).toInt(), 7);
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("tester"));
QCOMPARE(model.data(model.index(1, 2)).toString(), QString("herr"));
model.setSort(0, Qt::AscendingOrder);
QVERIFY_SQL(model, submit());
- QCOMPARE(model.data(model.index(3, 0)).toInt(), 5);
+ QCOMPARE(model.data(model.index(3, 0)).toInt(), 7);
QCOMPARE(model.data(model.index(3, 1)).toString(), QString("tester"));
QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr"));
@@ -633,6 +687,32 @@ void tst_QSqlRelationalTableModel::removeColumn()
QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
QCOMPARE(model.data(model.index(0, 1)), QVariant());
+ // try in LeftJoin mode the same tests
+ CHECK_DATABASE(db);
+ recreateTestTables(db);
+
+ QSqlRelationalTableModel lmodel(0, db);
+
+ lmodel.setTable(reltest1);
+ lmodel.setRelation(2, QSqlRelation(reltest2, "tid", "title"));
+ lmodel.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(lmodel, select());
+
+ QVERIFY_SQL(lmodel, removeColumn(3));
+ QVERIFY_SQL(lmodel, select());
+
+ QCOMPARE(lmodel.columnCount(), 3);
+
+ QCOMPARE(lmodel.data(lmodel.index(0, 0)).toInt(), 1);
+ QCOMPARE(lmodel.data(lmodel.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(lmodel.data(lmodel.index(0, 2)).toString(), QString("herr"));
+ QCOMPARE(lmodel.data(lmodel.index(0, 3)), QVariant());
+
+ // try removing more than one column
+ QVERIFY_SQL(lmodel, removeColumns(1, 2));
+ QCOMPARE(lmodel.columnCount(), 1);
+ QCOMPARE(lmodel.data(lmodel.index(0, 0)).toInt(), 1);
+ QCOMPARE(lmodel.data(lmodel.index(0, 1)), QVariant());
}
void tst_QSqlRelationalTableModel::filter()
@@ -652,6 +732,14 @@ void tst_QSqlRelationalTableModel::filter()
QCOMPARE(model.rowCount(), 2);
QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
QCOMPARE(model.data(model.index(1, 2)).toString(), QString("herr"));
+
+ // Redo same filter test in LeftJoin mode
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model,select());
+
+ QCOMPARE(model.rowCount(), 2);
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
+ QCOMPARE(model.data(model.index(1, 2)).toString(), QString("herr"));
}
void tst_QSqlRelationalTableModel::sort()
@@ -693,6 +781,36 @@ void tst_QSqlRelationalTableModel::sort()
QCOMPARE(model.data(model.index(3, 3)).toInt(), 2);
}
+ // redo same test in LeftJoin mode
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ model.setSort(2, Qt::DescendingOrder);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.rowCount(), 6);
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("mister"));
+ QCOMPARE(model.data(model.index(1, 2)).toString(), QString("mister"));
+ QCOMPARE(model.data(model.index(2, 2)).toString(), QString("herr"));
+ QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr"));
+ QCOMPARE(model.data(model.index(4, 2)).toString(), QString(""));
+ QCOMPARE(model.data(model.index(5, 2)).toString(), QString(""));
+
+ model.setSort(3, Qt::AscendingOrder);
+ QVERIFY_SQL(model, select());
+
+ if (!db.driverName().startsWith("QTDS")) {
+ QCOMPARE(model.rowCount(), 6);
+ QCOMPARE(model.data(model.index(0, 3)).toString(), QString(""));
+ QCOMPARE(model.data(model.index(1, 3)).toString(), QString("herr"));
+ QCOMPARE(model.data(model.index(2, 3)).toString(), QString("mister"));
+ QCOMPARE(model.data(model.index(3, 3)).toString(), QString("mister"));
+ QCOMPARE(model.data(model.index(4, 3)).toString(), QString("mister"));
+ QCOMPARE(model.data(model.index(5, 3)).toString(), QString("mister"));
+ } else {
+ QCOMPARE(model.data(model.index(0, 3)).toInt(), 1);
+ QCOMPARE(model.data(model.index(1, 3)).toInt(), 2);
+ QCOMPARE(model.data(model.index(2, 3)).toInt(), 2);
+ QCOMPARE(model.data(model.index(3, 3)).toInt(), 2);
+ }
}
static void testRevert(QSqlRelationalTableModel &model)
@@ -773,7 +891,18 @@ void tst_QSqlRelationalTableModel::revert()
if (QTest::currentTestFailed())
return;
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+ testRevert(model);
+
/* and again with OnManualSubmit */
+ model.setJoinMode(QSqlRelationalTableModel::InnerJoin);
+ QVERIFY_SQL(model, select());
+ model.setEditStrategy(QSqlTableModel::OnManualSubmit);
+ testRevert(model);
+
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
model.setEditStrategy(QSqlTableModel::OnManualSubmit);
testRevert(model);
}
@@ -805,13 +934,13 @@ void tst_QSqlRelationalTableModel::clearDisplayValuesCache()
QCOMPARE(model.data(model.index(3, 3)).toInt(), 2 );
model.insertRow(model.rowCount());
- QVERIFY(model.setData(model.index(4, 0), 5, Qt::EditRole));
+ QVERIFY(model.setData(model.index(4, 0), 7, Qt::EditRole));
QVERIFY(model.setData(model.index(4, 1), "anders", Qt::EditRole));
QVERIFY(model.setData(model.index(4, 2), 1, Qt::EditRole));
QVERIFY(model.setData(model.index(4, 3), 1, Qt::EditRole));
model.submitAll();
- QCOMPARE(model.data(model.index(0, 0)).toInt(), 5);
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 7);
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("anders"));
QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
if (!db.driverName().startsWith("QTDS"))
@@ -896,6 +1025,17 @@ void tst_QSqlRelationalTableModel::invalidData()
//try to set data in non valid index
QVERIFY(model.setData(model.index(0,10),5) == false);
+
+ //same test with LeftJoin mode
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ //try set a non-existent relational key
+ QVERIFY(model.setData(model.index(0, 2), 3) == false);
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
+
+ //try to set data in non valid index
+ QVERIFY(model.setData(model.index(0,10),5) == false);
}
void tst_QSqlRelationalTableModel::relationModel()
@@ -926,6 +1066,19 @@ void tst_QSqlRelationalTableModel::relationModel()
QSqlTableModel *rel_model = model.relationModel(2);
QCOMPARE(rel_model->data(rel_model->index(0,1)).toString(), QString("herr"));
+
+ //same test in JoinMode
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QVERIFY(model.relationModel(0) == NULL);
+ QVERIFY(model.relationModel(1) == NULL);
+ QVERIFY(model.relationModel(2) != NULL);
+ QVERIFY(model.relationModel(3) != NULL);
+ QVERIFY(model.relationModel(4) == NULL);
+
+ QSqlTableModel *rel_model2 = model.relationModel(2);
+ QCOMPARE(rel_model2->data(rel_model->index(0,1)).toString(), QString("herr"));
}
void tst_QSqlRelationalTableModel::casing()
@@ -1021,7 +1174,15 @@ void tst_QSqlRelationalTableModel::escapedRelations()
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
+
//try with index column quoted
+ model.setJoinMode(QSqlRelationalTableModel::InnerJoin);
if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) {
model.setRelation(2, QSqlRelation(reltest2,
db.driver()->escapeIdentifier("tid", QSqlDriver::FieldName).toUpper(),
@@ -1037,8 +1198,15 @@ void tst_QSqlRelationalTableModel::escapedRelations()
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
- //try with display column quoted
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
+
+ //try with display column quoted
+ model.setJoinMode(QSqlRelationalTableModel::InnerJoin);
if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) {
model.setRelation(2, QSqlRelation(reltest2,
@@ -1056,8 +1224,15 @@ void tst_QSqlRelationalTableModel::escapedRelations()
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
- //try with tablename and index and display columns quoted in the relation
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
+ //try with tablename and index and display columns quoted in the relation
+ model.setJoinMode(QSqlRelationalTableModel::InnerJoin);
if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) {
model.setRelation(2, QSqlRelation(reltest2,
"tid",
@@ -1072,6 +1247,13 @@ void tst_QSqlRelationalTableModel::escapedRelations()
QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
+
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("herr"));
}
void tst_QSqlRelationalTableModel::escapedTableName()
@@ -1126,6 +1308,55 @@ void tst_QSqlRelationalTableModel::escapedTableName()
QCOMPARE(model.data(model.index(3,2)).toString(), QString("herr"));
}
+
+ //ok, now do same test with LeftJoin
+ {
+ QSqlRelationalTableModel model(0, db);
+
+ if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) {
+ model.setTable(db.driver()->escapeIdentifier(reltest1.toUpper(), QSqlDriver::TableName));
+ } else {
+ model.setTable(db.driver()->escapeIdentifier(reltest1, QSqlDriver::TableName));
+ }
+ model.setSort(0, Qt::AscendingOrder);
+ model.setRelation(2, QSqlRelation(reltest2, "tid", "title"));
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QVERIFY(model.setData(model.index(0, 1), QString("harry2")));
+ QVERIFY(model.setData(model.index(0, 2), 2));
+
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry2"));
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("mister"));
+
+ model.submit();
+
+ QVERIFY(model.setData(model.index(3,1), QString("boris2")));
+ QVERIFY(model.setData(model.index(3, 2), 1));
+
+ QCOMPARE(model.data(model.index(3,1)).toString(), QString("boris2"));
+ QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr"));
+
+ model.submit();
+ }
+ { //verify values
+ QSqlRelationalTableModel model(0, db);
+ model.setTable(reltest1);
+ model.setSort(0, Qt::AscendingOrder);
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry2"));
+ QCOMPARE(model.data(model.index(0, 2)).toInt(), 2);
+ QCOMPARE(model.data(model.index(3, 1)).toString(), QString("boris2"));
+ QCOMPARE(model.data(model.index(3, 2)).toInt(), 1);
+
+ model.setRelation(2, QSqlRelation(reltest2, "tid", "title"));
+ QVERIFY_SQL(model, select());
+ QCOMPARE(model.data(model.index(0, 2)).toString(), QString("mister"));
+ QCOMPARE(model.data(model.index(3,2)).toString(), QString("herr"));
+
+ }
}
void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers()
@@ -1147,6 +1378,15 @@ void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers()
QCOMPARE(model.data(model.index(0,1)).toString(), QString("Washington"));
QCOMPARE(model.data(model.index(1,1)).toString(), QString("New York"));
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+
+ QCOMPARE(model.data(model.index(0,1)).toString(), QString("Washington"));
+ QCOMPARE(model.data(model.index(1,1)).toString(), QString("New York"));
+
+ model.setJoinMode(QSqlRelationalTableModel::InnerJoin);
+ QVERIFY_SQL(model, select());
+
QSqlRecord rec;
QSqlField f1("id", QVariant::Int);
QSqlField f2(db.driver()->escapeIdentifier("city key", QSqlDriver::FieldName), QVariant::Int);
@@ -1223,6 +1463,31 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest()
model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__)+"."+qTableName("user", __FILE__), "userid", "username"));
model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__)+"."+qTableName("user", __FILE__), "userid", "username"));
QVERIFY_SQL(model, select());
+
+ model.setJoinMode(QSqlRelationalTableModel::LeftJoin);
+ QVERIFY_SQL(model, select());
+}
+
+void tst_QSqlRelationalTableModel::selectAfterUpdate()
+{
+ QFETCH_GLOBAL(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+
+ QSqlRelationalTableModel model(0, db);
+ model.setTable(reltest1);
+ model.setRelation(2, QSqlRelation(reltest2, "tid", "title"));
+ QVERIFY_SQL(model, select());
+ QVERIFY(model.relationModel(2)->rowCount() == 2);
+ {
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("insert into " + reltest2 + " values(3, 'mrs')"));
+ model.relationModel(2)->select();
+ }
+ QVERIFY(model.relationModel(2)->rowCount() == 3);
+ QVERIFY(model.setData(model.index(0,2), 3));
+ QVERIFY(model.submitAll());
+ QCOMPARE(model.data(model.index(0,2)), QVariant("mrs"));
}
QTEST_MAIN(tst_QSqlRelationalTableModel)
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index b26121c..214b2f3 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -5103,24 +5103,28 @@ void tst_QString::toUpperLower_icu()
QLocale::setDefault(QLocale(QLocale::Turkish, QLocale::Turkey));
+ QCOMPARE(s.toUpper(), QString::fromLatin1("I"));
+ QCOMPARE(s.toLower(), QString::fromLatin1("i"));
+
// turkish locale has a capital I with a dot (U+0130, utf8 c4b0)
+ QLocale l;
- QCOMPARE(s.toUpper(), QString::fromUtf8("\xc4\xb0"));
- QCOMPARE(QString::fromUtf8("\xc4\xb0").toLower(), s);
+ QCOMPARE(l.toUpper(s), QString::fromUtf8("\xc4\xb0"));
+ QCOMPARE(l.toLower(QString::fromUtf8("\xc4\xb0")), s);
// nothing should happen here
- QCOMPARE(s.toLower(), s);
- QCOMPARE(QString::fromLatin1("I").toUpper(), QString::fromLatin1("I"));
+ QCOMPARE(l.toLower(s), s);
+ QCOMPARE(l.toUpper(QString::fromLatin1("I")), QString::fromLatin1("I"));
// U+0131, utf8 c4b1 is the lower-case i without a dot
QString sup = QString::fromUtf8("\xc4\xb1");
- QCOMPARE(sup.toUpper(), QString::fromLatin1("I"));
- QCOMPARE(QString::fromLatin1("I").toLower(), sup);
+ QCOMPARE(l.toUpper(sup), QString::fromLatin1("I"));
+ QCOMPARE(l.toLower(QString::fromLatin1("I")), sup);
// nothing should happen here
- QCOMPARE(sup.toLower(), sup);
- QCOMPARE(QString::fromLatin1("i").toLower(), QString::fromLatin1("i"));
+ QCOMPARE(l.toLower(sup), sup);
+ QCOMPARE(l.toLower(QString::fromLatin1("i")), QString::fromLatin1("i"));
// the cleanup function will restore the default locale
}
diff --git a/tests/auto/qxmlquery/pushBaselines/allAtomics.ref b/tests/auto/qxmlquery/pushBaselines/allAtomics.ref
index cceabfe..ddb5bc7 100644
--- a/tests/auto/qxmlquery/pushBaselines/allAtomics.ref
+++ b/tests/auto/qxmlquery/pushBaselines/allAtomics.ref
@@ -1,6 +1,6 @@
startOfSequence()
atomicValue(xs:untypedAtomic)
-atomicValue(2002-10-10T23:02:11)
+atomicValue(2002-10-10T23:02:11Z)
atomicValue(2002-10-10)
atomicValue()
atomicValue()
diff --git a/tests/auto/selftests/expected_printdatatags.txt b/tests/auto/selftests/expected_printdatatags.txt
new file mode 100644
index 0000000..ac22f23
--- /dev/null
+++ b/tests/auto/selftests/expected_printdatatags.txt
@@ -0,0 +1,6 @@
+tst_MyTestCase a data tag a1
+tst_MyTestCase a data tag a2
+tst_MyTestCase b
+tst_MyTestCase c data tag c1
+tst_MyTestCase c data tag c2
+tst_MyTestCase c data tag c3
diff --git a/tests/auto/selftests/expected_printdatatagswithglobaltags.txt b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt
new file mode 100644
index 0000000..32feba4
--- /dev/null
+++ b/tests/auto/selftests/expected_printdatatagswithglobaltags.txt
@@ -0,0 +1,12 @@
+tst_MyTestCase a data tag a1 __global__ global data tag 1
+tst_MyTestCase a data tag a2 __global__ global data tag 1
+tst_MyTestCase a data tag a1 __global__ global data tag 2
+tst_MyTestCase a data tag a2 __global__ global data tag 2
+tst_MyTestCase b __global__ global data tag 1
+tst_MyTestCase b __global__ global data tag 2
+tst_MyTestCase c data tag c1 __global__ global data tag 1
+tst_MyTestCase c data tag c2 __global__ global data tag 1
+tst_MyTestCase c data tag c3 __global__ global data tag 1
+tst_MyTestCase c data tag c1 __global__ global data tag 2
+tst_MyTestCase c data tag c2 __global__ global data tag 2
+tst_MyTestCase c data tag c3 __global__ global data tag 2
diff --git a/tests/auto/selftests/printdatatags/printdatatags.pro b/tests/auto/selftests/printdatatags/printdatatags.pro
new file mode 100644
index 0000000..a134422
--- /dev/null
+++ b/tests/auto/selftests/printdatatags/printdatatags.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+SOURCES += tst_printdatatags.cpp
+QT = core
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = printdatatags
diff --git a/tests/auto/selftests/printdatatags/tst_printdatatags.cpp b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp
new file mode 100644
index 0000000..79f8890
--- /dev/null
+++ b/tests/auto/selftests/printdatatags/tst_printdatatags.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+class tst_MyTestCase: public QObject
+{
+ Q_OBJECT
+private slots:
+ void a_data() const;
+ void a() const;
+
+ void b() const;
+
+ void c_data() const;
+ void c() const;
+};
+
+void tst_MyTestCase::a_data() const
+{
+ QTest::addColumn<int>("x");
+ QTest::addColumn<int>("y");
+
+ QTest::newRow("data tag a1 ") << 1 << 2;
+ QTest::newRow("data tag a2") << 1 << 2;
+}
+
+void tst_MyTestCase::a() const
+{
+}
+
+void tst_MyTestCase::b() const
+{
+}
+
+void tst_MyTestCase::c_data() const
+{
+ QTest::addColumn<int>("x");
+
+ QTest::newRow("data tag c1") << 1;
+ QTest::newRow("data tag c2") << 1;
+ QTest::newRow("data tag c3") << 1;
+}
+
+void tst_MyTestCase::c() const
+{
+}
+
+QTEST_MAIN(tst_MyTestCase)
+
+#include "tst_printdatatags.moc"
diff --git a/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro b/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
new file mode 100644
index 0000000..100ba1c
--- /dev/null
+++ b/tests/auto/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+SOURCES += tst_printdatatagswithglobaltags.cpp
+QT = core
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = printdatatagswithglobaltags
diff --git a/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
new file mode 100644
index 0000000..6b0e61b
--- /dev/null
+++ b/tests/auto/selftests/printdatatagswithglobaltags/tst_printdatatagswithglobaltags.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+class tst_MyTestCase: public QObject
+{
+ Q_OBJECT
+private slots:
+ void initTestCase_data() const;
+ void initTestCase() const;
+
+ void a_data() const;
+ void a() const;
+
+ void b() const;
+
+ void c_data() const;
+ void c() const;
+};
+
+void tst_MyTestCase::initTestCase_data() const
+{
+ QTest::addColumn<int>("f");
+ QTest::addColumn<int>("g");
+
+ QTest::newRow("global data tag 1 ") << 1 << 2;
+ QTest::newRow("global data tag 2") << 1 << 2;
+}
+
+void tst_MyTestCase::initTestCase() const
+{
+}
+
+void tst_MyTestCase::a_data() const
+{
+ QTest::addColumn<int>("x");
+ QTest::addColumn<int>("y");
+
+ QTest::newRow("data tag a1 ") << 1 << 2;
+ QTest::newRow("data tag a2") << 1 << 2;
+}
+
+void tst_MyTestCase::a() const
+{
+}
+
+void tst_MyTestCase::b() const
+{
+}
+
+void tst_MyTestCase::c_data() const
+{
+ QTest::addColumn<int>("x");
+
+ QTest::newRow("data tag c1") << 1;
+ QTest::newRow("data tag c2") << 1;
+ QTest::newRow("data tag c3") << 1;
+}
+
+void tst_MyTestCase::c() const
+{
+}
+
+QTEST_MAIN(tst_MyTestCase)
+
+#include "tst_printdatatagswithglobaltags.moc"
diff --git a/tests/auto/selftests/selftests.pro b/tests/auto/selftests/selftests.pro
index 2f1c327..74cd075 100644
--- a/tests/auto/selftests/selftests.pro
+++ b/tests/auto/selftests/selftests.pro
@@ -5,7 +5,8 @@ SUBDIRS = subtest test warnings maxwarnings cmptest globaldata skipglobal skip \
skipinit skipinitdata datetime singleskip assert waitwithoutgui differentexec \
exceptionthrow qexecstringlist datatable commandlinedata\
benchlibwalltime benchlibcallgrind benchlibeventcounter benchlibtickcounter \
- benchliboptions xunit badxml longstring
+ benchliboptions xunit badxml longstring printdatatags \
+ printdatatagswithglobaltags
INSTALLS =
diff --git a/tests/auto/selftests/selftests.qrc b/tests/auto/selftests/selftests.qrc
index f82722b..5bd0e12 100644
--- a/tests/auto/selftests/selftests.qrc
+++ b/tests/auto/selftests/selftests.qrc
@@ -89,6 +89,8 @@
<file>expected_multiexec.txt</file>
<file>expected_multiexec.xml</file>
<file>expected_multiexec.xunitxml</file>
+ <file>expected_printdatatags.txt</file>
+ <file>expected_printdatatagswithglobaltags.txt</file>
<file>expected_qexecstringlist.txt</file>
<file>expected_singleskip.lightxml</file>
<file>expected_singleskip.txt</file>
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 1a95420..3686304 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -245,6 +245,8 @@ void tst_Selftests::runSubTest_data()
<< "xunit"
<< "longstring"
<< "badxml"
+ << "printdatatags"
+ << "printdatatagswithglobaltags"
;
foreach (Logger const& logger, allLoggers()) {
@@ -273,6 +275,12 @@ void tst_Selftests::runSubTest_data()
else if (subtest == "badxml") {
arguments << "-eventcounter";
}
+ else if (subtest == "printdatatags") {
+ arguments << "-datatags";
+ }
+ else if (subtest == "printdatatagswithglobaltags") {
+ arguments << "-datatags";
+ }
// These tests don't work right with loggers other than plain, usually because
// they internally supply arguments to themselves.
@@ -289,6 +297,12 @@ void tst_Selftests::runSubTest_data()
if (subtest == "waitwithoutgui") {
continue;
}
+ if (subtest == "printdatatags") {
+ continue;
+ }
+ if (subtest == "printdatatagswithglobaltags") {
+ continue;
+ }
// `crashes' will not output valid XML on platforms without a crash handler
if (subtest == "crashes") {
continue;
diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp
index 00486d2..cf62f7b 100644
--- a/tests/auto/symbols/tst_symbols.cpp
+++ b/tests/auto/symbols/tst_symbols.cpp
@@ -55,6 +55,8 @@ class tst_Symbols: public QObject
{
Q_OBJECT
private slots:
+ void initTestCase();
+
void prefix();
void globalObjects();
};
@@ -89,6 +91,12 @@ static QString symbolToLine(const QString &symbol, const QString &lib)
return result;
}
+void tst_Symbols::initTestCase()
+{
+ QString qtDir = QString::fromLocal8Bit(qgetenv("QTDIR"));
+ QVERIFY2(!qtDir.isEmpty(), "This test needs $QTDIR");
+}
+
/* This test searches through all Qt libraries and searches for symbols
starting with "global constructors keyed to "