diff --git a/NOTES.txt b/NOTES.txt index 5d4271b32..1c6a5e9cb 100644 --- a/NOTES.txt +++ b/NOTES.txt @@ -468,6 +468,7 @@ Common: - overflow : add check code, eg when size_t to int conversion - perf : performance - production : check before deploy to production + - qt5 remove : code to remove after the Qt v5 support will dropped - regex : mark regex-es, try to avoid them - reliability : make things more robust and reliable - repeat : tasks that should I make from time to time diff --git a/cmake/CommonModules/TinyCommon.cmake b/cmake/CommonModules/TinyCommon.cmake index a0a56d35c..641e423bf 100644 --- a/cmake/CommonModules/TinyCommon.cmake +++ b/cmake/CommonModules/TinyCommon.cmake @@ -25,15 +25,18 @@ ${TINY_UNPARSED_ARGUMENTS}") # Qt defines # --- + # Disable deprecated APIs up to the given Qt version + # TODO qt5 remove silverqx + if(QT_VERSION_MAJOR GREATER_EQUAL 6) + # Disable all the APIs deprecated up to Qt 6.7.0 + target_compile_definitions(${target} INTERFACE QT_DISABLE_DEPRECATED_UP_TO=0x060700) + else() + # Disable all the APIs deprecated up to Qt 6.0.0 + target_compile_definitions(${target} INTERFACE QT_DISABLE_DEPRECATED_BEFORE=0x060000) + endif() + target_compile_definitions(${target} INTERFACE - # You can also make your code fail to compile if it uses deprecated APIs. - # In order to do so, uncomment the following line. - # You can also select to disable deprecated APIs only up to a certain version - # of Qt. - # Disables all the APIs deprecated before Qt 6.0.0 - QT_DISABLE_DEPRECATED_BEFORE=0x060000 - #QT_ASCII_CAST_WARNINGS #QT_NO_CAST_FROM_ASCII #QT_RESTRICTED_CAST_FROM_ASCII diff --git a/qmake/common/common.pri b/qmake/common/common.pri index fc4e6cdbf..0b75b8b46 100644 --- a/qmake/common/common.pri +++ b/qmake/common/common.pri @@ -6,6 +6,7 @@ load(tiny_dotenv) # Common Configuration ( also for tests ) # --- +# TODO qt5 remove silverqx versionAtLeast(QT_VERSION, 6.2.4): \ CONFIG *= c++20 else: \ @@ -19,11 +20,14 @@ CONFIG -= c++11 app_bundle # Qt defines # --- -# You can also make your code fail to compile if it uses deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -# Disables all the APIs deprecated before Qt 6.0.0 -DEFINES *= QT_DISABLE_DEPRECATED_BEFORE=0x060000 +# Disable deprecated APIs up to the given Qt version +# Disable all the APIs deprecated up to Qt 6.7.0 +# TODO qt5 remove silverqx +versionAtLeast(QT_VERSION, 6): \ + DEFINES *= QT_DISABLE_DEPRECATED_UP_TO=0x060700 +# Disable all the APIs deprecated up to Qt 6.0.0 +else: \ + DEFINES *= QT_DISABLE_DEPRECATED_BEFORE=0x060000 #DEFINES *= QT_ASCII_CAST_WARNINGS #DEFINES *= QT_NO_CAST_FROM_ASCII diff --git a/tests/TinyUtils/src/databases.hpp b/tests/TinyUtils/src/databases.hpp index d13e2d63a..f2eb66456 100644 --- a/tests/TinyUtils/src/databases.hpp +++ b/tests/TinyUtils/src/databases.hpp @@ -18,6 +18,18 @@ # define sl(str) QStringLiteral(str) #endif +#ifndef TVERIFY_EXCEPTION_THROWN +# if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0) +/*! Alias for QVERIFY_THROWS_EXCEPTION() (temporary workaround for Qt v6.8). */ +# define TVERIFY_EXCEPTION_THROWN(expression, exceptiontype) \ + QVERIFY_THROWS_EXCEPTION(exceptiontype, expression) +# else +/*! Alias for QVERIFY_EXCEPTION_THROWN(). */ +# define TVERIFY_EXCEPTION_THROWN(expression, exceptiontype) \ + QVERIFY_EXCEPTION_THROWN(expression, exceptiontype) +# endif +#endif + namespace Orm { class DatabaseManager; diff --git a/tests/auto/functional/orm/databasemanager/tst_databasemanager.cpp b/tests/auto/functional/orm/databasemanager/tst_databasemanager.cpp index 8f1fcc6c1..2de211c35 100644 --- a/tests/auto/functional/orm/databasemanager/tst_databasemanager.cpp +++ b/tests/auto/functional/orm/databasemanager/tst_databasemanager.cpp @@ -811,7 +811,7 @@ void tst_DatabaseManager::SQLite_CheckDatabaseExists_True() const .toUtf8().constData(), ); // Verify - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( m_dm->connection(*connectionName) .statement(sl("create table tbl1 (one varchar(10), two smallint)")), SQLiteDatabaseDoesNotExistError); diff --git a/tests/auto/functional/orm/query/querybuilder/tst_querybuilder.cpp b/tests/auto/functional/orm/query/querybuilder/tst_querybuilder.cpp index 825a02934..428ed475c 100644 --- a/tests/auto/functional/orm/query/querybuilder/tst_querybuilder.cpp +++ b/tests/auto/functional/orm/query/querybuilder/tst_querybuilder.cpp @@ -1224,7 +1224,7 @@ void tst_QueryBuilder::upsert_EmptyUpdate() const { QFETCH_GLOBAL(QString, connection); // NOLINT(modernize-type-traits) - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( createQuery(connection)->from("tag_properties") .upsert({{{"tag_id", 1}, {"color", "pink"}, {"position", 0}}, {{"tag_id", 1}, {"color", "purple"}, {"position", 4}}}, @@ -1583,7 +1583,7 @@ void tst_QueryBuilder::sole_RecordsNotFoundError() const { QFETCH_GLOBAL(QString, connection); // NOLINT(modernize-type-traits) - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( createQuery(connection)->from("torrents") .whereEq(NAME, dummy_NONEXISTENT) .sole(), @@ -1594,7 +1594,7 @@ void tst_QueryBuilder::sole_MultipleRecordsFoundError() const { QFETCH_GLOBAL(QString, connection); // NOLINT(modernize-type-traits) - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( createQuery(connection)->from("torrents").whereEq("user_id", 1).sole(), MultipleRecordsFoundError); } @@ -1615,7 +1615,7 @@ void tst_QueryBuilder::soleValue_RecordsNotFoundError() const { QFETCH_GLOBAL(QString, connection); // NOLINT(modernize-type-traits) - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( createQuery(connection)->from("torrents") .whereEq(NAME, dummy_NONEXISTENT) .soleValue(NAME), @@ -1626,7 +1626,7 @@ void tst_QueryBuilder::soleValue_MultipleRecordsFoundError() const { QFETCH_GLOBAL(QString, connection); // NOLINT(modernize-type-traits) - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( createQuery(connection)->from("torrents") .whereEq("user_id", 1) .soleValue(NAME), @@ -1719,7 +1719,7 @@ void tst_QueryBuilder::chunk_EnforceOrderBy() const { QFETCH_GLOBAL(QString, connection); // NOLINT(modernize-type-traits) - QVERIFY_EXCEPTION_THROWN(createQuery(connection)->from("file_property_properties") + TVERIFY_EXCEPTION_THROWN(createQuery(connection)->from("file_property_properties") .chunk(3, [](SqlQuery &/*unused*/, const qint64 /*unused*/) { return true; @@ -1812,7 +1812,7 @@ void tst_QueryBuilder::each_EnforceOrderBy() const { QFETCH_GLOBAL(QString, connection); // NOLINT(modernize-type-traits) - QVERIFY_EXCEPTION_THROWN(createQuery(connection)->from("file_property_properties") + TVERIFY_EXCEPTION_THROWN(createQuery(connection)->from("file_property_properties") .each([](SqlQuery &/*unused*/, const qint64 /*unused*/) { return true; diff --git a/tests/auto/functional/orm/schema/psql_schemabuilder_f/tst_postgresql_schemabuilder_f.cpp b/tests/auto/functional/orm/schema/psql_schemabuilder_f/tst_postgresql_schemabuilder_f.cpp index e9378817e..a3c160a3e 100644 --- a/tests/auto/functional/orm/schema/psql_schemabuilder_f/tst_postgresql_schemabuilder_f.cpp +++ b/tests/auto/functional/orm/schema/psql_schemabuilder_f/tst_postgresql_schemabuilder_f.cpp @@ -108,7 +108,7 @@ void tst_PostgreSQL_SchemaBuilder_f:: .toUtf8().constData(), ); // Verify - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(*connectionName).hasTable(sl("users")), SearchPathEmptyError); diff --git a/tests/auto/functional/orm/tiny/castattributes/tst_castattributes.cpp b/tests/auto/functional/orm/tiny/castattributes/tst_castattributes.cpp index 820184c1d..447c40ad4 100644 --- a/tests/auto/functional/orm/tiny/castattributes/tst_castattributes.cpp +++ b/tests/auto/functional/orm/tiny/castattributes/tst_castattributes.cpp @@ -509,7 +509,7 @@ void tst_CastAttributes::cast_QByteArray_to_QDateTime_ThrowException() const type.mergeCasts({{"binary", CastType::QDateTime}}); - QVERIFY_EXCEPTION_THROWN(type.getAttribute("binary"), + TVERIFY_EXCEPTION_THROWN(type.getAttribute("binary"), InvalidFormatError); } @@ -525,7 +525,7 @@ void tst_CastAttributes::cast_QDateTime_to_QByteArray_ThrowException() const type.mergeCasts({{"datetime", CastType::QByteArray}}); - QVERIFY_EXCEPTION_THROWN(type.getAttribute("datetime"), + TVERIFY_EXCEPTION_THROWN(type.getAttribute("datetime"), InvalidArgumentError); } diff --git a/tests/auto/functional/orm/tiny/collection_models/tst_collection_models.cpp b/tests/auto/functional/orm/tiny/collection_models/tst_collection_models.cpp index ce8a5f7bf..9cfb5776f 100644 --- a/tests/auto/functional/orm/tiny/collection_models/tst_collection_models.cpp +++ b/tests/auto/functional/orm/tiny/collection_models/tst_collection_models.cpp @@ -2666,7 +2666,7 @@ void tst_Collection_Models::load_lvalue_NonExistentRelation_Failed() const // Verify before verify(); - QVERIFY_EXCEPTION_THROWN(albums.load("albumImages-NON_EXISTENT"), + TVERIFY_EXCEPTION_THROWN(albums.load("albumImages-NON_EXISTENT"), RelationMappingNotFoundError); // Verify after @@ -2905,7 +2905,7 @@ void tst_Collection_Models::load_rvalue_NonExistentRelation_Failed() const // Verify before verify(); - QVERIFY_EXCEPTION_THROWN(std::move(albums).load("albumImages-NON_EXISTENT"), + TVERIFY_EXCEPTION_THROWN(std::move(albums).load("albumImages-NON_EXISTENT"), RelationMappingNotFoundError); // Verify after @@ -3132,7 +3132,7 @@ void tst_Collection_Models::where_InvalidComparisonOperator_ThrowException() con QVERIFY(Common::verifyIds(images, {2, 3, 4, 5, 6})); // Verify - QVERIFY_EXCEPTION_THROWN(images.where(ID, dummy_NONEXISTENT, 10), + TVERIFY_EXCEPTION_THROWN(images.where(ID, dummy_NONEXISTENT, 10), InvalidArgumentError); } diff --git a/tests/auto/functional/orm/tiny/collection_relations/tst_collection_relations.cpp b/tests/auto/functional/orm/tiny/collection_relations/tst_collection_relations.cpp index 08788b518..53daad598 100644 --- a/tests/auto/functional/orm/tiny/collection_relations/tst_collection_relations.cpp +++ b/tests/auto/functional/orm/tiny/collection_relations/tst_collection_relations.cpp @@ -3116,7 +3116,7 @@ void tst_Collection_Relations::load_lvalue_NonExistentRelation_Failed() const // Verify before verify(); - QVERIFY_EXCEPTION_THROWN(albumsInit.load("albumImages-NON_EXISTENT"), + TVERIFY_EXCEPTION_THROWN(albumsInit.load("albumImages-NON_EXISTENT"), RelationMappingNotFoundError); // Verify after @@ -3377,7 +3377,7 @@ void tst_Collection_Relations::load_rvalue_NonExistentRelation_Failed() const // Verify before verify(); - QVERIFY_EXCEPTION_THROWN(std::move(albumsInit).load("albumImages-NON_EXISTENT"), + TVERIFY_EXCEPTION_THROWN(std::move(albumsInit).load("albumImages-NON_EXISTENT"), RelationMappingNotFoundError); // Verify after @@ -3652,7 +3652,7 @@ void tst_Collection_Relations::where_InvalidComparisonOperator_ThrowException() QVERIFY(Common::verifyIds(images, {2, 3, 4, 5, 6})); // Verify - QVERIFY_EXCEPTION_THROWN(images.where(ID, dummy_NONEXISTENT, 10), + TVERIFY_EXCEPTION_THROWN(images.where(ID, dummy_NONEXISTENT, 10), InvalidArgumentError); } diff --git a/tests/auto/functional/orm/tiny/model/tst_model.cpp b/tests/auto/functional/orm/tiny/model/tst_model.cpp index 4dcf0405c..398b3a008 100644 --- a/tests/auto/functional/orm/tiny/model/tst_model.cpp +++ b/tests/auto/functional/orm/tiny/model/tst_model.cpp @@ -389,7 +389,7 @@ void tst_Model::save_Update_Failed() const peer->setAttribute("total_seeds-NON_EXISTENT", 15); - QVERIFY_EXCEPTION_THROWN(peer->save(), QueryError); + TVERIFY_EXCEPTION_THROWN(peer->save(), QueryError); QVERIFY(peer->exists); } @@ -832,9 +832,9 @@ void tst_Model::findOrFail_NotFoundFailed() const ConnectionOverride::connection = connection; - QVERIFY_EXCEPTION_THROWN(Torrent::findOrFail(999999), + TVERIFY_EXCEPTION_THROWN(Torrent::findOrFail(999999), ModelNotFoundError); - QVERIFY_EXCEPTION_THROWN(Torrent::findOrFail(999999, {ID, NAME}), + TVERIFY_EXCEPTION_THROWN(Torrent::findOrFail(999999, {ID, NAME}), ModelNotFoundError); } @@ -1351,7 +1351,7 @@ void tst_Model::create_Failed() const const auto addedOn = QDateTime({2021, 2, 1}, {20, 22, 10}, Qt::UTC); Torrent torrent; - QVERIFY_EXCEPTION_THROWN((torrent = Torrent::create({ + TVERIFY_EXCEPTION_THROWN((torrent = Torrent::create({ {"name-NON_EXISTENT", "test100"}, {SIZE_, 100}, {Progress, 333}, diff --git a/tests/auto/functional/orm/tiny/model_conn_indep/tst_model_connection_independent.cpp b/tests/auto/functional/orm/tiny/model_conn_indep/tst_model_connection_independent.cpp index 1c0e41b15..1b8d2b545 100644 --- a/tests/auto/functional/orm/tiny/model_conn_indep/tst_model_connection_independent.cpp +++ b/tests/auto/functional/orm/tiny/model_conn_indep/tst_model_connection_independent.cpp @@ -208,14 +208,14 @@ void tst_Model_Connection_Independent:: defaultAttributeValues_WithQDateTime_DefaultCtor() const { // Default ctor must throw because of the QDateTime - QVERIFY_EXCEPTION_THROWN(TorrentEager(), InvalidArgumentError); + TVERIFY_EXCEPTION_THROWN(TorrentEager(), InvalidArgumentError); } void tst_Model_Connection_Independent:: defaultAttributeValues_WithQDateTime_ConvertingAttributesCtor() const { // Attributes converting ctor must throw because of the QDateTime - QVERIFY_EXCEPTION_THROWN(TorrentEager({ + TVERIFY_EXCEPTION_THROWN(TorrentEager({ {NAME, "test22"}, {NOTE, "Torrent::instance()"}, }), @@ -227,7 +227,7 @@ defaultAttributeValues_WithQDateTime_ListInitializationCtor() const { /* List initialization using the std::initializer_list must throw because of the QDateTime. */ - QVERIFY_EXCEPTION_THROWN((TorrentEager { + TVERIFY_EXCEPTION_THROWN((TorrentEager { {NAME, "test22"}, {NOTE, "Torrent::instance()"}, }), @@ -963,7 +963,7 @@ tst_Model_Connection_Independent::massAssignment_TotallyGuarded_Exception() cons Torrent_TotallyGuarded torrent; QVERIFY(!torrent.exists); - QVERIFY_EXCEPTION_THROWN(torrent.fill({{NAME, "test150"}}), + TVERIFY_EXCEPTION_THROWN(torrent.fill({{NAME, "test150"}}), MassAssignmentError); } @@ -2217,14 +2217,14 @@ void tst_Model_Connection_Independent::sole() const void tst_Model_Connection_Independent::sole_RecordsNotFoundError() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( FilePropertyProperty::whereEq(NAME, dummy_NONEXISTENT)->sole(), RecordsNotFoundError); } void tst_Model_Connection_Independent::sole_MultipleRecordsFoundError() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( FilePropertyProperty::whereEq("file_property_id", 5)->sole(), MultipleRecordsFoundError); } @@ -2257,14 +2257,14 @@ void tst_Model_Connection_Independent::soleValue() const void tst_Model_Connection_Independent::soleValue_RecordsNotFoundError() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( FilePropertyProperty::whereEq(NAME, dummy_NONEXISTENT)->soleValue(NAME), RecordsNotFoundError); } void tst_Model_Connection_Independent::soleValue_MultipleRecordsFoundError() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( FilePropertyProperty::soleValue(NAME), MultipleRecordsFoundError); } diff --git a/tests/auto/functional/orm/tiny/model_relations/tst_model_relations.cpp b/tests/auto/functional/orm/tiny/model_relations/tst_model_relations.cpp index 4b8674f3f..ccb764028 100644 --- a/tests/auto/functional/orm/tiny/model_relations/tst_model_relations.cpp +++ b/tests/auto/functional/orm/tiny/model_relations/tst_model_relations.cpp @@ -412,23 +412,23 @@ void tst_Model_Relations::getRelation_EagerLoad_Failed() const Torrent torrent; // Many relation - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( (torrent.getRelation("torrentFiles")), RelationNotLoadedError); // One relation, obtained as QVector, also possible - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( (torrent.getRelation("torrentFiles")), RelationNotLoadedError); // Many relation - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( (torrent.getRelation("torrentFiles")), RelationNotLoadedError); // BelongsTo relation - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( (TorrentPeer().getRelation("torrent")), RelationNotLoadedError); // BelongsToMany relation - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( (torrent.getRelation("tags")), RelationNotLoadedError); } @@ -439,7 +439,7 @@ void tst_Model_Relations::eagerLoad_Failed() const ConnectionOverride::connection = connection; - QVERIFY_EXCEPTION_THROWN(TorrentEager_Failed::find(1), + TVERIFY_EXCEPTION_THROWN(TorrentEager_Failed::find(1), RelationMappingNotFoundError); } @@ -928,7 +928,7 @@ void tst_Model_Relations::with_Vector_MoreRelations() const QCOMPARE(typeid (file), typeid (TorrentPreviewableFile *)); // No TorrentPreviewableFileProperty loaded - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( (file->getRelation( "fileProperty")), RuntimeError); @@ -941,7 +941,7 @@ void tst_Model_Relations::with_NonExistentRelation_Failed() const ConnectionOverride::connection = connection; - QVERIFY_EXCEPTION_THROWN(Torrent::with("torrentFiles-NON_EXISTENT")->find(1), + TVERIFY_EXCEPTION_THROWN(Torrent::with("torrentFiles-NON_EXISTENT")->find(1), RelationMappingNotFoundError); } @@ -1783,7 +1783,7 @@ void tst_Model_Relations::load_NonExistentRelation_Failed() const QVERIFY(torrent->getRelations().empty()); - QVERIFY_EXCEPTION_THROWN(torrent->load("torrentFiles-NON_EXISTENT"), + TVERIFY_EXCEPTION_THROWN(torrent->load("torrentFiles-NON_EXISTENT"), RelationMappingNotFoundError); QVERIFY(torrent->getRelations().empty()); } diff --git a/tests/auto/functional/orm/tiny/relations_insrt_updt/tst_relations_inserting_updating.cpp b/tests/auto/functional/orm/tiny/relations_insrt_updt/tst_relations_inserting_updating.cpp index 0f0ce9914..52f3ca3f4 100644 --- a/tests/auto/functional/orm/tiny/relations_insrt_updt/tst_relations_inserting_updating.cpp +++ b/tests/auto/functional/orm/tiny/relations_insrt_updt/tst_relations_inserting_updating.cpp @@ -235,7 +235,7 @@ void tst_Relations_Inserting_Updating::save_OnHasOneOrMany_Failed() const }); QVERIFY(!file.exists); - QVERIFY_EXCEPTION_THROWN(torrent->torrentFiles()->save(file), + TVERIFY_EXCEPTION_THROWN(torrent->torrentFiles()->save(file), QueryError); QVERIFY(!file.exists); QVERIFY(!file[ID]->isValid()); @@ -405,7 +405,7 @@ void tst_Relations_Inserting_Updating::saveMany_OnHasOneOrMany_Failed() const std::move(file2), }; ModelsCollection savedFiles; - QVERIFY_EXCEPTION_THROWN(savedFiles = torrent->torrentFiles()->saveMany(filesToSave), + TVERIFY_EXCEPTION_THROWN(savedFiles = torrent->torrentFiles()->saveMany(filesToSave), QueryError); QVERIFY(savedFiles.isEmpty()); } @@ -505,7 +505,7 @@ void tst_Relations_Inserting_Updating::create_OnHasOneOrMany_Failed() const }; TorrentPreviewableFile file; - QVERIFY_EXCEPTION_THROWN(file = torrent->torrentFiles()->create(fileAttribtues), + TVERIFY_EXCEPTION_THROWN(file = torrent->torrentFiles()->create(fileAttribtues), QueryError); QVERIFY(!file.exists); QVERIFY(file.getAttributes().isEmpty()); @@ -523,7 +523,7 @@ void tst_Relations_Inserting_Updating::create_OnHasOneOrMany_WithRValue_Failed() TorrentPreviewableFile file; - QVERIFY_EXCEPTION_THROWN(file = torrent->torrentFiles()->create({ + TVERIFY_EXCEPTION_THROWN(file = torrent->torrentFiles()->create({ {"file_index", 1}, {"filepath", "test1_file1.mkv"}, {SIZE_, 377477}, @@ -691,7 +691,7 @@ void tst_Relations_Inserting_Updating::createMany_OnHasOneOrMany_Failed() const }; ModelsCollection savedFiles; - QVERIFY_EXCEPTION_THROWN(savedFiles = torrent->torrentFiles() + TVERIFY_EXCEPTION_THROWN(savedFiles = torrent->torrentFiles() ->createMany(fileAttributesToSave), QueryError); QVERIFY(savedFiles.isEmpty()); @@ -709,7 +709,7 @@ tst_Relations_Inserting_Updating::createMany_OnHasOneOrMany_WithRValue_Failed() QVERIFY(torrent->exists); ModelsCollection savedFiles; - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( savedFiles = torrent->torrentFiles()->createMany({{ {"file_index", 1}, {"filepath", "test1_file1.mkv"}, @@ -839,7 +839,7 @@ void tst_Relations_Inserting_Updating::save_OnBelongsToMany_Failed() const Tag tag({{NAME, "tag1"}}); QVERIFY(!tag.exists); - QVERIFY_EXCEPTION_THROWN(torrent->tags()->save(tag), + TVERIFY_EXCEPTION_THROWN(torrent->tags()->save(tag), QueryError); QVERIFY(!tag.exists); QVERIFY(!tag[ID]->isValid()); @@ -1003,7 +1003,7 @@ void tst_Relations_Inserting_Updating::saveMany_OnBelongsToMany_Failed() const ModelsCollection tagsToSave {std::move(tag1), std::move(tag2)}; ModelsCollection savedTags; - QVERIFY_EXCEPTION_THROWN(savedTags = torrent->tags()->saveMany(tagsToSave), + TVERIFY_EXCEPTION_THROWN(savedTags = torrent->tags()->saveMany(tagsToSave), QueryError); QVERIFY(savedTags.isEmpty()); @@ -1116,7 +1116,7 @@ void tst_Relations_Inserting_Updating::create_OnBelongsToMany_Failed() const QVector tagAttributes {{NAME, "tag1"}}; Tag tag; - QVERIFY_EXCEPTION_THROWN(tag = torrent->tags()->create(tagAttributes), + TVERIFY_EXCEPTION_THROWN(tag = torrent->tags()->create(tagAttributes), QueryError); QVERIFY(!tag.exists); QVERIFY(tag.getAttributes().isEmpty()); @@ -1142,7 +1142,7 @@ void tst_Relations_Inserting_Updating::create_OnBelongsToMany_WithRValue_Failed( Tag tag; - QVERIFY_EXCEPTION_THROWN(tag = torrent->tags()->create({{NAME, "tag1"}}), + TVERIFY_EXCEPTION_THROWN(tag = torrent->tags()->create({{NAME, "tag1"}}), QueryError); QVERIFY(!tag.exists); QVERIFY(tag.getAttributes().isEmpty()); @@ -1291,7 +1291,7 @@ void tst_Relations_Inserting_Updating::createMany_OnBelongsToMany_Failed() const ModelsCollection tags; - QVERIFY_EXCEPTION_THROWN(tags = torrent->tags()->createMany(tagAttributes, + TVERIFY_EXCEPTION_THROWN(tags = torrent->tags()->createMany(tagAttributes, {{{"active", false}}}), QueryError); QVERIFY(tags.isEmpty()); @@ -1318,7 +1318,7 @@ tst_Relations_Inserting_Updating::createMany_OnBelongsToMany_WithRValue_Failed() ModelsCollection tags; - QVERIFY_EXCEPTION_THROWN(tags = torrent->tags()->createMany({{{NAME, "tag1"}}, + TVERIFY_EXCEPTION_THROWN(tags = torrent->tags()->createMany({{{NAME, "tag1"}}, {{NAME, "tag1"}}}, {{{"active", false}}}), diff --git a/tests/auto/functional/orm/tiny/tinybuilder/tst_tinybuilder.cpp b/tests/auto/functional/orm/tiny/tinybuilder/tst_tinybuilder.cpp index d30c5b2bc..b09247dcd 100644 --- a/tests/auto/functional/orm/tiny/tinybuilder/tst_tinybuilder.cpp +++ b/tests/auto/functional/orm/tiny/tinybuilder/tst_tinybuilder.cpp @@ -162,9 +162,9 @@ void tst_TinyBuilder::firstOrFail_NotFoundFailed() const ConnectionOverride::connection = connection; - QVERIFY_EXCEPTION_THROWN(Torrent::whereEq(ID, 999999)->firstOrFail(), + TVERIFY_EXCEPTION_THROWN(Torrent::whereEq(ID, 999999)->firstOrFail(), ModelNotFoundError); - QVERIFY_EXCEPTION_THROWN(Torrent::whereEq(ID, 999999)->firstOrFail({ID, NAME}), + TVERIFY_EXCEPTION_THROWN(Torrent::whereEq(ID, 999999)->firstOrFail({ID, NAME}), ModelNotFoundError); } @@ -271,7 +271,7 @@ void tst_TinyBuilder::update_Failed() const ConnectionOverride::connection = connection; - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Torrent::whereEq(ID, 3)->update({{"progress-NON_EXISTENT", 333}}), QueryError); } diff --git a/tests/auto/unit/orm/databaseconnection/tst_databaseconnection.cpp b/tests/auto/unit/orm/databaseconnection/tst_databaseconnection.cpp index b8c476de4..d56b6ef94 100644 --- a/tests/auto/unit/orm/databaseconnection/tst_databaseconnection.cpp +++ b/tests/auto/unit/orm/databaseconnection/tst_databaseconnection.cpp @@ -867,7 +867,7 @@ void tst_DatabaseConnection::scalar_MultipleColumnsSelectedError() const { QFETCH_GLOBAL(QString, connection); // NOLINT(modernize-type-traits) - QVERIFY_EXCEPTION_THROWN(DB::connection(connection).scalar( + TVERIFY_EXCEPTION_THROWN(DB::connection(connection).scalar( "select id, name from torrents order by id"), MultipleColumnsSelectedError); } diff --git a/tests/auto/unit/orm/query/mysql_querybuilder/tst_mysql_querybuilder.cpp b/tests/auto/unit/orm/query/mysql_querybuilder/tst_mysql_querybuilder.cpp index 9ce915abe..b75a230ab 100644 --- a/tests/auto/unit/orm/query/mysql_querybuilder/tst_mysql_querybuilder.cpp +++ b/tests/auto/unit/orm/query/mysql_querybuilder/tst_mysql_querybuilder.cpp @@ -3011,16 +3011,16 @@ void tst_MySql_QueryBuilder::whereRowValues() const void tst_MySql_QueryBuilder::whereRowValues_Empty() const { // Different size - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( createQuery()->select("*").from("torrents") .whereRowValues({NAME}, EQ, {"test3", 3}), InvalidArgumentError); - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( createQuery()->select("*").from("torrents") .whereRowValues({}, EQ, {"test3", 3}), InvalidArgumentError); // Empty columns/values - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( createQuery()->select("*").from("torrents") .whereRowValues({}, EQ, {}), InvalidArgumentError); diff --git a/tests/auto/unit/orm/schema/mysql_schemabuilder/tst_mysql_schemabuilder.cpp b/tests/auto/unit/orm/schema/mysql_schemabuilder/tst_mysql_schemabuilder.cpp index d82a75ca5..1a200f76c 100644 --- a/tests/auto/unit/orm/schema/mysql_schemabuilder/tst_mysql_schemabuilder.cpp +++ b/tests/auto/unit/orm/schema/mysql_schemabuilder/tst_mysql_schemabuilder.cpp @@ -832,7 +832,7 @@ void tst_MySql_SchemaBuilder::renameColumn() const void tst_MySql_SchemaBuilder::dropAllTypes() const { - QVERIFY_EXCEPTION_THROWN(Schema::on(m_connection).dropAllTypes(), LogicError); + TVERIFY_EXCEPTION_THROWN(Schema::on(m_connection).dropAllTypes(), LogicError); } void tst_MySql_SchemaBuilder::getAllTables() const diff --git a/tests/auto/unit/orm/schema/postgresql_schemabuilder/tst_postgresql_schemabuilder.cpp b/tests/auto/unit/orm/schema/postgresql_schemabuilder/tst_postgresql_schemabuilder.cpp index 86e9e1970..6a9636198 100644 --- a/tests/auto/unit/orm/schema/postgresql_schemabuilder/tst_postgresql_schemabuilder.cpp +++ b/tests/auto/unit/orm/schema/postgresql_schemabuilder/tst_postgresql_schemabuilder.cpp @@ -773,7 +773,7 @@ void tst_PostgreSQL_SchemaBuilder::renameColumn() const void tst_PostgreSQL_SchemaBuilder::dropAllTypes() const { - QVERIFY_EXCEPTION_THROWN(Schema::on(m_connection).dropAllTypes(), LogicError); + TVERIFY_EXCEPTION_THROWN(Schema::on(m_connection).dropAllTypes(), LogicError); } void tst_PostgreSQL_SchemaBuilder::getAllTables() const @@ -901,7 +901,7 @@ void tst_PostgreSQL_SchemaBuilder::hasTable_DatabaseDiffers_ThrowException() con // Verify DB::connection(m_connection).pretend([](auto &connection) { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(connection.getName()) .hasTable(sl("%1-database.public.users").arg(dummy_NONEXISTENT)), InvalidArgumentError); @@ -1049,7 +1049,7 @@ void tst_PostgreSQL_SchemaBuilder:: .toUtf8().constData(), ); // Create database connection - QVERIFY_EXCEPTION_THROWN(DB::connection(*connectionName), + TVERIFY_EXCEPTION_THROWN(DB::connection(*connectionName), InvalidArgumentError); // Restore @@ -2601,7 +2601,7 @@ void tst_PostgreSQL_SchemaBuilder::virtualAs_StoredAs_Nullable_ModifyTable() con void tst_PostgreSQL_SchemaBuilder::change_VirtualAs_ThrowException() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( DB::connection(m_connection).pretend([](auto &connection) { Schema::on(connection.getName()) @@ -2618,7 +2618,7 @@ void tst_PostgreSQL_SchemaBuilder::change_VirtualAs_ThrowException() const void tst_PostgreSQL_SchemaBuilder::change_StoredAs_ThrowException() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( DB::connection(m_connection).pretend([](auto &connection) { Schema::on(connection.getName()) diff --git a/tests/auto/unit/orm/schema/sqlite_schemabuilder/tst_sqlite_schemabuilder.cpp b/tests/auto/unit/orm/schema/sqlite_schemabuilder/tst_sqlite_schemabuilder.cpp index 51acec4f2..1052222e0 100644 --- a/tests/auto/unit/orm/schema/sqlite_schemabuilder/tst_sqlite_schemabuilder.cpp +++ b/tests/auto/unit/orm/schema/sqlite_schemabuilder/tst_sqlite_schemabuilder.cpp @@ -749,7 +749,7 @@ void tst_SQLite_SchemaBuilder::renameColumn() const void tst_SQLite_SchemaBuilder::dropAllTypes() const { - QVERIFY_EXCEPTION_THROWN(Schema::on(m_connection).dropAllTypes(), LogicError); + TVERIFY_EXCEPTION_THROWN(Schema::on(m_connection).dropAllTypes(), LogicError); } void tst_SQLite_SchemaBuilder::getAllTables() const @@ -1330,7 +1330,7 @@ void tst_SQLite_SchemaBuilder::indexes_Blueprint() const void tst_SQLite_SchemaBuilder::indexes_Fluent_Fulltext_SpatialIndex_Exceptions() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).create(Firewalls, [](Blueprint &table) { table.id(); @@ -1339,7 +1339,7 @@ void tst_SQLite_SchemaBuilder::indexes_Fluent_Fulltext_SpatialIndex_Exceptions() }), RuntimeError); - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).create(Firewalls, [](Blueprint &table) { table.id(); @@ -1351,7 +1351,7 @@ void tst_SQLite_SchemaBuilder::indexes_Fluent_Fulltext_SpatialIndex_Exceptions() void tst_SQLite_SchemaBuilder::indexes_Blueprint_Fulltext_SpatialIndex_Exceptions() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).create(Firewalls, [](Blueprint &table) { table.id(); @@ -1361,7 +1361,7 @@ void tst_SQLite_SchemaBuilder::indexes_Blueprint_Fulltext_SpatialIndex_Exception }), RuntimeError); - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).create(Firewalls, [](Blueprint &table) { table.id(); @@ -1374,7 +1374,7 @@ void tst_SQLite_SchemaBuilder::indexes_Blueprint_Fulltext_SpatialIndex_Exception void tst_SQLite_SchemaBuilder::renameIndex() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).table(Firewalls, [](Blueprint &table) { table.renameIndex("firewalls_name_unique", @@ -1560,7 +1560,7 @@ void tst_SQLite_SchemaBuilder::dropIndex_ByMultipleColumns() const void tst_SQLite_SchemaBuilder::dropPrimary_Exception() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).table(Firewalls, [](Blueprint &table) { table.dropPrimary(); @@ -1570,7 +1570,7 @@ void tst_SQLite_SchemaBuilder::dropPrimary_Exception() const void tst_SQLite_SchemaBuilder::dropFullText_Exception() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).table(Firewalls, [](Blueprint &table) { // By column name @@ -1581,7 +1581,7 @@ void tst_SQLite_SchemaBuilder::dropFullText_Exception() const void tst_SQLite_SchemaBuilder::dropSpatialIndex_Exception() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).table(Firewalls, [](Blueprint &table) { // By index name @@ -1704,7 +1704,7 @@ void tst_SQLite_SchemaBuilder::foreignKey_WithModel() const void tst_SQLite_SchemaBuilder::dropForeign() const { - QVERIFY_EXCEPTION_THROWN( + TVERIFY_EXCEPTION_THROWN( Schema::on(m_connection).table(Firewalls, [](Blueprint &table) { // By column name diff --git a/tests/auto/unit/orm/tiny/mysql_tinybuilder/tst_mysql_tinybuilder.cpp b/tests/auto/unit/orm/tiny/mysql_tinybuilder/tst_mysql_tinybuilder.cpp index 24fe6390e..dcf65150f 100644 --- a/tests/auto/unit/orm/tiny/mysql_tinybuilder/tst_mysql_tinybuilder.cpp +++ b/tests/auto/unit/orm/tiny/mysql_tinybuilder/tst_mysql_tinybuilder.cpp @@ -924,7 +924,7 @@ void tst_MySql_TinyBuilder::has_UnsupportedHasNested_Failed() const { auto builder = createTinyQuery(); - QVERIFY_EXCEPTION_THROWN(builder->has("torrentFiles.fileProperty"), + TVERIFY_EXCEPTION_THROWN(builder->has("torrentFiles.fileProperty"), InvalidArgumentError); }