tests/auto/qtableview/tst_qtableview.cpp
changeset 30 5dc02b23752f
parent 22 79de32ba3296
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   200     void taskQTBUG_4516_clickOnRichTextLabel();
   200     void taskQTBUG_4516_clickOnRichTextLabel();
   201     void taskQTBUG_5237_wheelEventOnHeader();
   201     void taskQTBUG_5237_wheelEventOnHeader();
   202     void taskQTBUG_8585_crashForNoGoodReason();
   202     void taskQTBUG_8585_crashForNoGoodReason();
   203     void taskQTBUG_7774_RtoLVisualRegionForSelection();
   203     void taskQTBUG_7774_RtoLVisualRegionForSelection();
   204     void taskQTBUG_8777_scrollToSpans();
   204     void taskQTBUG_8777_scrollToSpans();
       
   205     void taskQTBUG_10169_sizeHintForRow();
   205 
   206 
   206     void mouseWheel_data();
   207     void mouseWheel_data();
   207     void mouseWheel();
   208     void mouseWheel();
   208 
   209 
   209     void addColumnWhileEditing();
   210     void addColumnWhileEditing();
   474     }
   475     }
   475 
   476 
   476     QModelIndexList selectedIndexes() const
   477     QModelIndexList selectedIndexes() const
   477     {
   478     {
   478         return QTableView::selectedIndexes();
   479         return QTableView::selectedIndexes();
       
   480     }
       
   481 
       
   482     int sizeHintForRow(int row) const
       
   483     {
       
   484         return QTableView::sizeHintForRow(row);
   479     }
   485     }
   480 
   486 
   481     bool checkSignalOrder;
   487     bool checkSignalOrder;
   482 public slots:
   488 public slots:
   483     void currentChanged(QModelIndex , QModelIndex ) {
   489     void currentChanged(QModelIndex , QModelIndex ) {
  4040         QTest::keyClick(&table, Qt::Key_Down);
  4046         QTest::keyClick(&table, Qt::Key_Down);
  4041 
  4047 
  4042     QVERIFY(table.verticalScrollBar()->value() > 10);
  4048     QVERIFY(table.verticalScrollBar()->value() > 10);
  4043 }
  4049 }
  4044 
  4050 
       
  4051 void tst_QTableView::taskQTBUG_10169_sizeHintForRow()
       
  4052 { 
       
  4053     QtTestTableView tableView; 
       
  4054     QStandardItemModel model(1, 3); 
       
  4055     model.setData(model.index(0, 0), "Word wrapping text goes here.");
       
  4056     tableView.setModel(&model);
       
  4057     tableView.verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
       
  4058     const int orderedHeight = tableView.sizeHintForRow(0);
       
  4059     tableView.horizontalHeader()->moveSection(2, 0);
       
  4060     const int reorderedHeight = tableView.sizeHintForRow(0);
       
  4061 
       
  4062     //the order of the columns shouldn't matter.
       
  4063     QCOMPARE(orderedHeight, reorderedHeight);
       
  4064 }
       
  4065 
  4045 QTEST_MAIN(tst_QTableView)
  4066 QTEST_MAIN(tst_QTableView)
  4046 #include "tst_qtableview.moc"
  4067 #include "tst_qtableview.moc"