tests: remove use of obsolete QStyleOption*V<N>

They are obsolete since Qt 5.0.

Change-Id: Iefe47684526832def8fc5be5a170817059dcc530
Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
This commit is contained in:
Marc Mutz 2015-11-02 16:42:21 +01:00
parent 60bb802598
commit 99d1969284
5 changed files with 13 additions and 31 deletions

View File

@ -2020,8 +2020,7 @@ void tst_QListView::styleOptionViewItem()
public:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QVERIFY(qstyleoption_cast<const QStyleOptionViewItemV4 *>(&option));
QStyleOptionViewItemV4 opt(option);
QStyleOptionViewItem opt(option);
initStyleOption(&opt, index);
QCOMPARE(opt.index, index);

View File

@ -3075,7 +3075,7 @@ void tst_QTreeView::styleOptionViewItem()
{
class MyDelegate : public QStyledItemDelegate
{
static QString posToString(QStyleOptionViewItemV4::ViewItemPosition pos) {
static QString posToString(QStyleOptionViewItem::ViewItemPosition pos) {
static const char* s_pos[] = { "Invalid", "Beginning", "Middle", "End", "OnlyOne" };
return s_pos[pos];
}
@ -3088,8 +3088,7 @@ void tst_QTreeView::styleOptionViewItem()
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
QVERIFY(qstyleoption_cast<const QStyleOptionViewItemV4 *>(&option));
QStyleOptionViewItemV4 opt(option);
QStyleOptionViewItem opt(option);
initStyleOption(&opt, index);
QVERIFY(!opt.text.isEmpty());
@ -3097,20 +3096,20 @@ void tst_QTreeView::styleOptionViewItem()
//qDebug() << index << opt.text;
if (allCollapsed)
QCOMPARE(!(opt.features & QStyleOptionViewItemV2::Alternate), !(index.row() % 2));
QCOMPARE(!(opt.features & QStyleOptionViewItemV2::HasCheckIndicator), !opt.text.contains("Checkable"));
QCOMPARE(!(opt.features & QStyleOptionViewItem::Alternate), !(index.row() % 2));
QCOMPARE(!(opt.features & QStyleOptionViewItem::HasCheckIndicator), !opt.text.contains("Checkable"));
if (opt.text.contains("Beginning"))
QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItemV4::Beginning));
QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItem::Beginning));
if (opt.text.contains("Middle"))
QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItemV4::Middle));
QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItem::Middle));
if (opt.text.contains("End"))
QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItemV4::End));
QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItem::End));
if (opt.text.contains("OnlyOne"))
QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItemV4::OnlyOne));
QCOMPARE(posToString(opt.viewItemPosition), posToString(QStyleOptionViewItem::OnlyOne));
if (opt.text.contains("Checked"))
QCOMPARE(opt.checkState, Qt::Checked);
@ -4192,7 +4191,7 @@ void tst_QTreeView::taskQTBUG_25333_adjustViewOptionsForIndex()
#ifdef QT_BUILD_INTERNAL
{
QStyleOptionViewItemV4 option;
QStyleOptionViewItem option;
view.aiv_priv()->adjustViewOptionsForIndex(&option, model.indexFromItem(item1));

View File

@ -43,7 +43,6 @@ class tst_QStyleOption: public QObject
private slots:
void qstyleoptioncast_data();
void qstyleoptioncast();
void copyconstructors();
};
// Just a simple container for QStyleOption-pointer
@ -133,21 +132,6 @@ void tst_QStyleOption::qstyleoptioncast()
delete testOption;
}
void tst_QStyleOption::copyconstructors()
{
QStyleOptionFrame frame;
QStyleOptionFrameV2 frame2(frame);
QCOMPARE(frame2.version, int(QStyleOptionFrameV2::Version));
frame2 = frame;
QCOMPARE(frame2.version, int(QStyleOptionFrameV2::Version));
QStyleOptionProgressBar bar;
QStyleOptionProgressBarV2 bar2(bar);
QCOMPARE(bar2.version, int(QStyleOptionProgressBarV2::Version));
bar2 = bar;
QCOMPARE(bar2.version, int(QStyleOptionProgressBarV2::Version));
}
QTEST_MAIN(tst_QStyleOption)
#include "tst_qstyleoption.moc"

View File

@ -1301,9 +1301,9 @@ void tst_QStyleSheetStyle::proxyStyle()
QTest::qWait(100);
// Test for QTBUG-7198 - style sheet overrides custom element size
QStyleOptionViewItemV4 opt;
QStyleOptionViewItem opt;
opt.initFrom(w);
opt.features |= QStyleOptionViewItemV2::HasCheckIndicator;
opt.features |= QStyleOptionViewItem::HasCheckIndicator;
QVERIFY(pb5->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator,
&opt, pb5).width() == 3);
delete w;

View File

@ -267,7 +267,7 @@ void tst_QProgressBar::sizeHint()
//test if the sizeHint is big enough
QFontMetrics fm = bar.fontMetrics();
QStyleOptionProgressBarV2 opt;
QStyleOptionProgressBar opt;
bar.initStyleOption(&opt);
QSize size = QSize(9 * 7 + fm.width(QLatin1Char('0')) * 4, fm.height() + 8);
size= bar.style()->sizeFromContents(QStyle::CT_ProgressBar, &opt, size, &bar);