auto tests: updated for new QStyle pure virtuals

QStyle::standardIconImplementation() & layoutSpacingImplementation()
are removed, and standardIcon() & layoutSpacing() made pure virtual.

Change-Id: If8ab6cfef0b639b7973be22dd630ba3e6f39a225
Reviewed-by: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
This commit is contained in:
J-P Nurmi 2012-08-28 15:33:35 +02:00 committed by Qt by Nokia
parent 50e3da79bf
commit 60783291ff
3 changed files with 34 additions and 20 deletions

View File

@ -1135,19 +1135,18 @@ public:
int hspacing;
int vspacing;
protected slots:
int layoutSpacingImplementation(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2,
Qt::Orientation orientation,
const QStyleOption *option = 0,
const QWidget *widget = 0) const;
int layoutSpacing(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2,
Qt::Orientation orientation,
const QStyleOption *option = 0,
const QWidget *widget = 0) const;
};
#define CT1(c) CT2(c, c)
#define CT2(c1, c2) ((uint)c1 << 16) | (uint)c2
int CustomLayoutStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1,
int CustomLayoutStyle::layoutSpacing(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2,
Qt::Orientation orientation,
const QStyleOption * /*option = 0*/,
@ -1233,7 +1232,7 @@ void tst_QGraphicsAnchorLayout::styleDefaults()
QGraphicsWidget *window = new QGraphicsWidget(0, Qt::Window);
// Test layoutSpacingImplementation
// Test layoutSpacing
CustomLayoutStyle *style = new CustomLayoutStyle;
style->hspacing = -1;
style->vspacing = -1;

View File

@ -85,8 +85,8 @@ private slots:
void styleDependentSpacingsAndMargins_data();
void styleDependentSpacingsAndMargins();
void layoutSpacingImplementation_data();
void layoutSpacingImplementation();
void layoutSpacing_data();
void layoutSpacing();
void spacing();
void spacerWithSpacing();
void contentsRect();
@ -944,12 +944,11 @@ public:
int vspacing;
bool reimplementSubelementRect;
protected slots:
int layoutSpacingImplementation(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2,
Qt::Orientation orientation,
const QStyleOption *option = 0,
const QWidget *widget = 0) const;
int layoutSpacing(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2,
Qt::Orientation orientation,
const QStyleOption *option = 0,
const QWidget *widget = 0) const;
};
@ -978,7 +977,7 @@ QRect CustomLayoutStyle::subElementRect(SubElement sr, const QStyleOption *opt,
#define CT1(c) CT2(c, c)
#define CT2(c1, c2) ((uint)c1 << 16) | (uint)c2
int CustomLayoutStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1,
int CustomLayoutStyle::layoutSpacing(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2,
Qt::Orientation orientation,
const QStyleOption * /*option = 0*/,
@ -1091,7 +1090,7 @@ void tst_QGridLayout::styleDependentSpacingsAndMargins()
}
}
void tst_QGridLayout::layoutSpacingImplementation_data()
void tst_QGridLayout::layoutSpacing_data()
{
QTest::addColumn<QWidget*>("widget");
// expected
@ -1103,7 +1102,7 @@ void tst_QGridLayout::layoutSpacingImplementation_data()
CustomLayoutStyle *style = new CustomLayoutStyle();
{
// If the layoutSpacing is negative, the layouting code will call
// layoutSpacingImplementation()
// layoutSpacing()
style->hspacing = -1;
style->vspacing = -1;
style->reimplementSubelementRect = false;
@ -1441,7 +1440,7 @@ void tst_QGridLayout::layoutSpacingImplementation_data()
}
void tst_QGridLayout::layoutSpacingImplementation()
void tst_QGridLayout::layoutSpacing()
{
QFETCH(QWidget *, widget);
QFETCH(PointList, expectedpositions);

View File

@ -1168,6 +1168,22 @@ class ProxyStyle : public QStyle
return style->generatedIconPixmap(mode, pix, opt);
}
int layoutSpacing(QSizePolicy::ControlType c1,
QSizePolicy::ControlType c2,
Qt::Orientation ori,
const QStyleOption *opt,
const QWidget *w) const
{
return style->layoutSpacing(c1, c2, ori, opt, w);
}
QIcon standardIcon(StandardPixmap si,
const QStyleOption *opt,
const QWidget *w) const
{
return style->standardIcon(si, opt, w);
}
private:
QStyle *style;
};