From b069158ed35e7d39c3ac56ce4844c6ff1d69451f Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 2 Apr 2012 11:42:26 +0200 Subject: Fix QMimeType::operator== to only compare mimetype names. The name is the unique identifier. Code such as if (oldItem.mimeType() == newItem.mimeType()) really wants to detect whether the item has a new mimetype (name), not compare static mimetype data such as comments and icons. Change-Id: I5fe56443295c91e1024c066ad6e7f93d842ae507 Reviewed-by: Wolf-Michael Bolle --- .../corelib/mimetypes/qmimetype/tst_qmimetype.cpp | 39 ---------------------- 1 file changed, 39 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp b/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp index 6f24bfe6f1..d88ef18a72 100644 --- a/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp +++ b/tests/auto/corelib/mimetypes/qmimetype/tst_qmimetype.cpp @@ -176,20 +176,7 @@ void tst_qmimetype::genericIconName() ) ); - QMimeType otherQMimeType ( - buildQMimeType ( - qMimeTypeName(), - QString(), - qMimeTypeGenericIconName(), - qMimeTypeGlobPatterns() - ) - ); - - // Verify that the GenericIconName is part of the equality test: QCOMPARE(instantiatedQMimeType.genericIconName(), qMimeTypeGenericIconName()); - - QVERIFY(instantiatedQMimeType != otherQMimeType); - QVERIFY(!(instantiatedQMimeType == otherQMimeType)); } // ------------------------------------------------------------------------------------------------ @@ -205,20 +192,7 @@ void tst_qmimetype::iconName() ) ); - QMimeType otherQMimeType ( - buildQMimeType ( - qMimeTypeName(), - qMimeTypeGenericIconName(), - QString(), - qMimeTypeGlobPatterns() - ) - ); - - // Verify that the IconName is part of the equality test: QCOMPARE(instantiatedQMimeType.iconName(), qMimeTypeIconName()); - - QVERIFY(instantiatedQMimeType != otherQMimeType); - QVERIFY(!(instantiatedQMimeType == otherQMimeType)); } // ------------------------------------------------------------------------------------------------ @@ -234,21 +208,8 @@ void tst_qmimetype::suffixes() ) ); - QMimeType otherQMimeType ( - buildQMimeType ( - qMimeTypeName(), - qMimeTypeGenericIconName(), - qMimeTypeIconName(), - QStringList() - ) - ); - - // Verify that the Suffixes are part of the equality test: QCOMPARE(instantiatedQMimeType.globPatterns(), qMimeTypeGlobPatterns()); QCOMPARE(instantiatedQMimeType.suffixes(), QStringList() << QString::fromLatin1("png")); - - QVERIFY(instantiatedQMimeType != otherQMimeType); - QVERIFY(!(instantiatedQMimeType == otherQMimeType)); } // ------------------------------------------------------------------------------------------------ -- cgit v1.2.3