diff options
Diffstat (limited to 'tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp')
-rw-r--r-- | tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp b/tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp index f0a8006b79..5977689ab6 100644 --- a/tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp +++ b/tests/auto/sql/models/qsqlrelationaldelegate/tst_qsqlrelationaldelegate.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -102,16 +77,17 @@ void tst_QSqlRelationalDelegate::recreateTestTables(QSqlDatabase db) void tst_QSqlRelationalDelegate::initTestCase() { - foreach (const QString &dbname, dbs.dbNames) { - QSqlDatabase db=QSqlDatabase::database(dbname); + for (const QString &dbName : std::as_const(dbs.dbNames)) { + QSqlDatabase db = QSqlDatabase::database(dbName); + QSqlQuery q(db); QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db); if (dbType == QSqlDriver::Interbase) { - db.exec("SET DIALECT 3"); + q.exec("SET DIALECT 3"); } else if (dbType == QSqlDriver::MSSqlServer) { - db.exec("SET ANSI_DEFAULTS ON"); - db.exec("SET IMPLICIT_TRANSACTIONS OFF"); + q.exec("SET ANSI_DEFAULTS ON"); + q.exec("SET IMPLICIT_TRANSACTIONS OFF"); } else if (dbType == QSqlDriver::PostgreSQL) { - db.exec("set client_min_messages='warning'"); + q.exec("set client_min_messages='warning'"); } recreateTestTables(db); } @@ -119,7 +95,7 @@ void tst_QSqlRelationalDelegate::initTestCase() void tst_QSqlRelationalDelegate::cleanupTestCase() { - foreach (const QString &dbName, dbs.dbNames) { + for (const QString &dbName : std::as_const(dbs.dbNames)) { QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); dropTestTables(QSqlDatabase::database(dbName)); @@ -171,7 +147,7 @@ void tst_QSqlRelationalDelegate::comboBoxEditor() tv.setCurrentIndex(index); tv.edit(index); QList<QComboBox*> comboBoxes = tv.viewport()->findChildren<QComboBox *>(); - QCOMPARE(comboBoxes.count(), 1); + QCOMPARE(comboBoxes.size(), 1); QComboBox *editor = comboBoxes.at(0); QCOMPARE(editor->currentText(), "herr"); |