tst_QFrame: fix memleak in testPainting()
Similar to 5be58ac9271555eed3a2884d827f30c164d2277d for tst_QWidget, this test leaked the result of QStyleFactory::create() and the fix is the same: cache across the test function calls. This time, it's for performance; there's like 50 different data tags for this function... Amends a8723871ee7125b97ce5467b94198e93a528c960. Pick-to: 6.9 6.8 6.5 5.15 Change-Id: I95cc1dc4459489904f3a5e0347570eb07ccdfde8 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
8352112e58
commit
44a2d8cc20
@ -19,6 +19,15 @@ private slots:
|
||||
void testInitStyleOption();
|
||||
void testPainting_data();
|
||||
void testPainting();
|
||||
|
||||
private:
|
||||
mutable std::unique_ptr<QStyle> m_style;
|
||||
QStyle *fusionStyle() const
|
||||
{
|
||||
if (!m_style)
|
||||
m_style.reset(QStyleFactory::create(QStringLiteral("fusion")));
|
||||
return m_style.get();
|
||||
}
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QFrame::Shape)
|
||||
@ -141,7 +150,7 @@ void tst_QFrame::testPainting()
|
||||
QFETCH(QFrame::Shadow, shadow);
|
||||
|
||||
QFrame frame;
|
||||
frame.setStyle(QStyleFactory::create(QStringLiteral("fusion")));
|
||||
frame.setStyle(fusionStyle());
|
||||
frame.setPalette(qt_fusionPalette());
|
||||
frame.setFrameStyle(shape | shadow);
|
||||
frame.setLineWidth(lineWidth);
|
||||
|
Loading…
x
Reference in New Issue
Block a user