Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-24777

Qt Test rows defined with QTest::addRow() are not recognized

    XMLWordPrintable

Details

    • All
    • c9d2a8d69e9eed398ccc6e4973aae0158b869be4 (qt-creator/qt-creator/4.14)

    Description

      When defining test rows using QTest::addRow(), they are not recognized by the test integration. Only rows defined with QTest::newRow() are recognized.

      Take as example this simple test:

      #include <QtTest>
      #include <QObject>
      
      class Test : public QObject
      {
      	Q_OBJECT
      
      private slots:
      	void testMethod();
      	void testMethod_data();
      };
      
      
      void Test::testMethod()
      {
      	QFETCH( int, dummy );
      
      	QVERIFY( dummy > -1 );
      }
      
      void Test::testMethod_data()
      {
      	QTest::addColumn<int>( "dummy" );
      
      	QTest::newRow( "row 1" ) << 17;
      	QTest::addRow( "row 2" ) << 42;
      }
      
      QTEST_MAIN( Test )
      
      #include "QtUnitTest.moc"
      

      Only "row 1" is recognized:

      Attachments

        Activity

          People

            cstenger Christian Stenger
            jochen.ulrich_cm Jochen Ulrich
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: