tests/benchmarks/qstylesheetstyle/main.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    47 {
    47 {
    48     Q_OBJECT
    48     Q_OBJECT
    49 private slots:
    49 private slots:
    50     void empty();
    50     void empty();
    51     void empty_events();
    51     void empty_events();
    52     
    52 
    53     void simple();
    53     void simple();
    54     void simple_events();
    54     void simple_events();
    55     
    55 
    56     void grid_data();
    56     void grid_data();
    57     void grid();
    57     void grid();
    58     
    58 
    59 private:
    59 private:
    60     QWidget *buildSimpleWidgets();
    60     QWidget *buildSimpleWidgets();
    61     
    61 
    62 };
    62 };
    63 
    63 
    64 
    64 
    65 QWidget *tst_qstylesheetstyle::buildSimpleWidgets()
    65 QWidget *tst_qstylesheetstyle::buildSimpleWidgets()
    66 {
    66 {
   101         qApp->processEvents();
   101         qApp->processEvents();
   102     }
   102     }
   103     delete w;
   103     delete w;
   104 }
   104 }
   105 
   105 
   106 static const char *simple_css = 
   106 static const char *simple_css =
   107    " QLineEdit { background: red; }   QPushButton { border: 1px solid yellow; color: pink; }  \n"
   107    " QLineEdit { background: red; }   QPushButton { border: 1px solid yellow; color: pink; }  \n"
   108    " QCheckBox { margin: 3px 5px; background-color:red; } QAbstractButton { background-color: #456; } \n"
   108    " QCheckBox { margin: 3px 5px; background-color:red; } QAbstractButton { background-color: #456; } \n"
   109    " QFrame { padding: 3px; } QLabel { color: black } QSpinBox:hover { background-color:blue; }  ";
   109    " QFrame { padding: 3px; } QLabel { color: black } QSpinBox:hover { background-color:blue; }  ";
   110 
   110 
   111 void tst_qstylesheetstyle::simple()
   111 void tst_qstylesheetstyle::simple()
   136 void tst_qstylesheetstyle::grid_data()
   136 void tst_qstylesheetstyle::grid_data()
   137 {
   137 {
   138         QTest::addColumn<bool>("events");
   138         QTest::addColumn<bool>("events");
   139         QTest::addColumn<bool>("show");
   139         QTest::addColumn<bool>("show");
   140         QTest::addColumn<int>("N");
   140         QTest::addColumn<int>("N");
   141         for (int n = 5; n <= 25; n += 5) { 
   141         for (int n = 5; n <= 25; n += 5) {
   142            const QByteArray nString = QByteArray::number(n*n);
   142            const QByteArray nString = QByteArray::number(n*n);
   143             QTest::newRow(("simple--" + nString).constData()) << false << false << n;
   143             QTest::newRow(("simple--" + nString).constData()) << false << false << n;
   144             QTest::newRow(("events--" + nString).constData()) << true << false << n;
   144             QTest::newRow(("events--" + nString).constData()) << true << false << n;
   145             QTest::newRow(("show--" + nString).constData()) << true << true << n;
   145             QTest::newRow(("show--" + nString).constData()) << true << true << n;
   146         }
   146         }
   150 void tst_qstylesheetstyle::grid()
   150 void tst_qstylesheetstyle::grid()
   151 {
   151 {
   152     QFETCH(bool, events);
   152     QFETCH(bool, events);
   153     QFETCH(bool, show);
   153     QFETCH(bool, show);
   154     QFETCH(int, N);
   154     QFETCH(int, N);
       
   155 
       
   156 #ifdef Q_OS_SYMBIAN
       
   157     // Symbian has limited stack (max 80k), which will run out when N >= 20 due to
       
   158     // QWidget::show() using recursion among grid labels somewhere down the line.
       
   159     if (show && N >= 20)
       
   160         QSKIP("Grid too big for device to show", SkipSingle);
       
   161 #endif
   155 
   162 
   156     QWidget *w = new QWidget();
   163     QWidget *w = new QWidget();
   157     QGridLayout *layout = new QGridLayout(w);
   164     QGridLayout *layout = new QGridLayout(w);
   158     w->setLayout(layout);
   165     w->setLayout(layout);
   159     QString stylesheet;
   166     QString stylesheet;