build fix for the case when QT_NO_STYLE_STYLESHEET is defined

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-02-26 21:56:12 +02:00
parent e6c7cf9300
commit 106c44d412
5 changed files with 33 additions and 6 deletions

View file

@ -132,10 +132,14 @@ void tst_QAbstractSpinBox::task183108_clear()
void tst_QAbstractSpinBox::task228728_cssselector()
{
#ifndef QT_NO_STYLE_STYLESHEET
//QAbstractSpinBox does some call to stylehint into his constructor.
//so while the stylesheet want to access property, it should not crash
qApp->setStyleSheet("[alignment=\"1\"], [text=\"foo\"] { color:black; }" );
QSpinBox box;
#else // QT_NO_STYLE_STYLESHEET
QSKIP("Katie compiled without stylesheet support (QT_NO_STYLE_STYLESHEET)", SkipAll);
#endif // QT_NO_STYLE_STYLESHEET
}
QTEST_MAIN(tst_QAbstractSpinBox)

View file

@ -1429,7 +1429,7 @@ void tst_QMainWindow::restoreStateDockWidgetBug()
{
QByteArray state;
//save state
// save state
{
QMainWindow mw1;
QDockWidget *dw1 = new QDockWidget();
@ -1444,14 +1444,16 @@ void tst_QMainWindow::restoreStateDockWidgetBug()
state = mw1.saveState();
}
//restore state
// restore state
QMainWindow mw2;
QDockWidget *dw2 = new QDockWidget();
dw2->setObjectName("Left DockWidget");
mw2.addDockWidget(Qt::LeftDockWidgetArea, dw2);
mw2.setCentralWidget(new QTextEdit());
mw2.restoreState(state);
#ifndef QT_NO_STYLE_STYLESHEET
mw2.setStyleSheet("color:red");
#endif // QT_NO_STYLE_STYLESHEET
mw2.show();
QApplication::processEvents();
@ -1936,7 +1938,7 @@ void tst_QMainWindow::QTBUG2774_stylechange()
QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height())));
QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 30)));
#ifndef QT_NO_STYLE_STYLESHEET
{
QTest::qWait(1000);
mw.setStyleSheet("QMainWindow::separator { width: 50px; height:50px; }");
@ -1954,6 +1956,7 @@ void tst_QMainWindow::QTBUG2774_stylechange()
QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height())));
QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 1)));
}
#endif // QT_NO_STYLE_STYLESHEET
}
void tst_QMainWindow::QTBUG21378_animationFinished()

View file

@ -568,10 +568,14 @@ void tst_QMenu::layoutDirection()
void tst_QMenu::task208001_stylesheet()
{
//test if it crash
#ifndef QT_NO_STYLE_STYLESHEET
// test if it crash
QMainWindow main;
main.setStyleSheet("QMenu [title =\"File\"] { color: red;}");
main.menuBar()->addMenu("File");
#else // QT_NO_STYLE_STYLESHEET
QSKIP("Katie compiled without stylesheet support (QT_NO_STYLE_STYLESHEET)", SkipAll);
#endif // QT_NO_STYLE_STYLESHEET
}
void tst_QMenu::activeSubMenuPosition()

View file

@ -27,8 +27,10 @@
#include <qstylesheetstyle_p.h>
//TESTED_CLASS=
//TESTED_FILES=
// TESTED_CLASS=
// TESTED_FILES=
#ifndef QT_NO_STYLE_STYLESHEET
class tst_QStyleSheetStyle : public QObject
{
@ -1625,3 +1627,9 @@ void tst_QStyleSheetStyle::QTBUG15910_crashNullWidget()
QTEST_MAIN(tst_QStyleSheetStyle)
#include "moc_tst_qstylesheetstyle.cpp"
#else // QT_NO_STYLE_STYLESHEET
QTEST_NOOP_MAIN
#endif // QT_NO_STYLE_STYLESHEET

View file

@ -23,6 +23,8 @@
#include <QtGui>
#include <qtest.h>
#ifndef QT_NO_STYLE_STYLESHEET
class tst_qstylesheetstyle : public QObject
{
Q_OBJECT
@ -172,3 +174,9 @@ void tst_qstylesheetstyle::grid()
QTEST_MAIN(tst_qstylesheetstyle)
#include "moc_main.cpp"
#else // QT_NO_STYLE_STYLESHEET
QTEST_NOOP_MAIN
#endif // QT_NO_STYLE_STYLESHEET