QtGui: Remove define Q_TEST_QPIXMAPCACHE
It causes clashes in CMake Unity (Jumbo) builds. Change the function to be Q_AUTOTEST_EXPORT'ed helpers. Task-number: QTBUG-109394 Initial-patch-by: Amir Masoud Abdol <amir.abdol@qt.io> Change-Id: I2e4032e07e1c39432cae1eb2dfff94be33846c09 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 1fad7aa73ef371bb15bf929c161e542aac687101) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
6a4990a942
commit
1e07d027fb
@ -1,7 +1,6 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
|
||||||
#define Q_TEST_QPIXMAPCACHE
|
|
||||||
#include "qpixmapcache.h"
|
#include "qpixmapcache.h"
|
||||||
#include "qobject.h"
|
#include "qobject.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
@ -642,14 +641,14 @@ void QPixmapCache::clear()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QPixmapCache::flushDetachedPixmaps()
|
Q_AUTOTEST_EXPORT void qt_qpixmapcache_flush_detached_pixmaps() // for tst_qpixmapcache
|
||||||
{
|
{
|
||||||
if (!qt_pixmapcache_thread_test())
|
if (!qt_pixmapcache_thread_test())
|
||||||
return;
|
return;
|
||||||
pm_cache()->flushDetachedPixmaps(true);
|
pm_cache()->flushDetachedPixmaps(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int QPixmapCache::totalUsed()
|
Q_AUTOTEST_EXPORT int qt_qpixmapcache_qpixmapcache_total_used() // for tst_qpixmapcache
|
||||||
{
|
{
|
||||||
if (!qt_pixmapcache_thread_test())
|
if (!qt_pixmapcache_thread_test())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -46,11 +46,6 @@ public:
|
|||||||
static void remove(const QString &key);
|
static void remove(const QString &key);
|
||||||
static void remove(const Key &key);
|
static void remove(const Key &key);
|
||||||
static void clear();
|
static void clear();
|
||||||
|
|
||||||
#ifdef Q_TEST_QPIXMAPCACHE
|
|
||||||
static void flushDetachedPixmaps();
|
|
||||||
static int totalUsed();
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
Q_DECLARE_SHARED(QPixmapCache::Key)
|
Q_DECLARE_SHARED(QPixmapCache::Key)
|
||||||
|
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#define Q_TEST_QPIXMAPCACHE
|
|
||||||
|
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
|
|
||||||
#include <qpixmapcache.h>
|
#include <qpixmapcache.h>
|
||||||
#include "private/qpixmapcache_p.h"
|
#include "private/qpixmapcache_p.h"
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE // The test requires QT_BUILD_INTERNAL
|
||||||
|
Q_AUTOTEST_EXPORT void qt_qpixmapcache_flush_detached_pixmaps();
|
||||||
|
Q_AUTOTEST_EXPORT int qt_qpixmapcache_qpixmapcache_total_used();
|
||||||
|
Q_AUTOTEST_EXPORT int q_QPixmapCache_keyHashSize();
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class tst_QPixmapCache : public QObject
|
class tst_QPixmapCache : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -160,7 +164,7 @@ void tst_QPixmapCache::setCacheLimit()
|
|||||||
p1->detach();
|
p1->detach();
|
||||||
QPixmapCache::Key key3 = QPixmapCache::insert(*p1);
|
QPixmapCache::Key key3 = QPixmapCache::insert(*p1);
|
||||||
p1->detach();
|
p1->detach();
|
||||||
QPixmapCache::flushDetachedPixmaps();
|
qt_qpixmapcache_flush_detached_pixmaps();
|
||||||
key2 = QPixmapCache::insert(*p1);
|
key2 = QPixmapCache::insert(*p1);
|
||||||
QCOMPARE(getPrivate(key2)->key, 1);
|
QCOMPARE(getPrivate(key2)->key, 1);
|
||||||
//This old key is not valid anymore after the flush
|
//This old key is not valid anymore after the flush
|
||||||
@ -458,10 +462,6 @@ void tst_QPixmapCache::pixmapKey()
|
|||||||
QVERIFY(!getPrivate(key8));
|
QVERIFY(!getPrivate(key8));
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
extern int q_QPixmapCache_keyHashSize();
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
void tst_QPixmapCache::noLeak()
|
void tst_QPixmapCache::noLeak()
|
||||||
{
|
{
|
||||||
QPixmapCache::Key key;
|
QPixmapCache::Key key;
|
||||||
@ -499,7 +499,7 @@ void tst_QPixmapCache::strictCacheLimit()
|
|||||||
QPixmapCache::insert(id + "-b", pixmap);
|
QPixmapCache::insert(id + "-b", pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVERIFY(QPixmapCache::totalUsed() <= limit);
|
QVERIFY(qt_qpixmapcache_qpixmapcache_total_used() <= limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QPixmapCache::noCrashOnLargeInsert()
|
void tst_QPixmapCache::noCrashOnLargeInsert()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user