tst_QWidget: use QStyleFactory instead of QWindowsStyle

QWindowsStyle is soon to become an internal class.

Change-Id: I75424d6fc2f36fb0faace86c960d78a4ba305658
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
This commit is contained in:
J-P Nurmi 2012-11-23 15:20:40 +01:00 committed by The Qt Project
parent ea104efa34
commit f308c296c5

View File

@ -55,7 +55,7 @@
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qstyle.h> #include <qstyle.h>
#include <qwidget.h> #include <qwidget.h>
#include <qwindowsstyle.h> #include <qstylefactory.h>
#include <qdesktopwidget.h> #include <qdesktopwidget.h>
#include <private/qwidget_p.h> #include <private/qwidget_p.h>
#include <private/qapplication_p.h> #include <private/qapplication_p.h>
@ -420,7 +420,7 @@ void tst_QWidget::getSetCheck()
QWidget child1(&obj1); QWidget child1(&obj1);
// QStyle * QWidget::style() // QStyle * QWidget::style()
// void QWidget::setStyle(QStyle *) // void QWidget::setStyle(QStyle *)
QScopedPointer<QWindowsStyle> var1(new QWindowsStyle); QScopedPointer<QStyle> var1(QStyleFactory::create(QLatin1String("Windows")));
obj1.setStyle(var1.data()); obj1.setStyle(var1.data());
QCOMPARE(static_cast<QStyle *>(var1.data()), obj1.style()); QCOMPARE(static_cast<QStyle *>(var1.data()), obj1.style());
obj1.setStyle((QStyle *)0); obj1.setStyle((QStyle *)0);
@ -4833,7 +4833,7 @@ void tst_QWidget::moveChild()
ColorWidget parent; ColorWidget parent;
// prevent custom styles // prevent custom styles
parent.setStyle(new QWindowsStyle); parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
ColorWidget child(&parent, Qt::blue); ColorWidget child(&parent, Qt::blue);
#ifndef Q_OS_WINCE #ifndef Q_OS_WINCE
@ -4881,7 +4881,7 @@ void tst_QWidget::showAndMoveChild()
{ {
QWidget parent(0, Qt::FramelessWindowHint); QWidget parent(0, Qt::FramelessWindowHint);
// prevent custom styles // prevent custom styles
parent.setStyle(new QWindowsStyle); parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
QDesktopWidget desktop; QDesktopWidget desktop;
QRect desktopDimensions = desktop.availableGeometry(&parent); QRect desktopDimensions = desktop.availableGeometry(&parent);
@ -4951,7 +4951,7 @@ void tst_QWidget::subtractOpaqueSiblings()
void tst_QWidget::deleteStyle() void tst_QWidget::deleteStyle()
{ {
QWidget widget; QWidget widget;
widget.setStyle(new QWindowsStyle); widget.setStyle(QStyleFactory::create(QLatin1String("Windows")));
widget.show(); widget.show();
delete widget.style(); delete widget.style();
qApp->processEvents(); qApp->processEvents();
@ -6043,7 +6043,7 @@ void tst_QWidget::render()
QWidget window; QWidget window;
window.resize(100, 100); window.resize(100, 100);
// prevent custom styles // prevent custom styles
window.setStyle(new QWindowsStyle); window.setStyle(QStyleFactory::create(QLatin1String("Windows")));
window.show(); window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(QTest::qWaitForWindowExposed(&window));
QWidget child(&window); QWidget child(&window);
@ -6062,7 +6062,7 @@ void tst_QWidget::render()
widget.setAutoFillBackground(true); widget.setAutoFillBackground(true);
widget.setPalette(Qt::red); widget.setPalette(Qt::red);
// prevent custom styles // prevent custom styles
widget.setStyle(new QWindowsStyle); widget.setStyle(QStyleFactory::create(QLatin1String("Windows")));
widget.show(); widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget)); QVERIFY(QTest::qWaitForWindowExposed(&widget));
QImage image(widget.size(), QImage::Format_RGB32); QImage image(widget.size(), QImage::Format_RGB32);
@ -6314,7 +6314,7 @@ void tst_QWidget::renderWithPainter()
{ {
QWidget widget(0, Qt::Tool); QWidget widget(0, Qt::Tool);
// prevent custom styles // prevent custom styles
widget.setStyle(new QWindowsStyle); widget.setStyle(QStyleFactory::create(QLatin1String("Windows")));
widget.show(); widget.show();
widget.resize(70, 50); widget.resize(70, 50);
widget.setAutoFillBackground(true); widget.setAutoFillBackground(true);