????QTestLib ??????????????????????????????????????????Qt+=testlib?????????????????

#include <QtTest/QtTest>
class TestQString: public QObject
{
  Q_OBJECT
private slots:
  // ???private slot???????????????????????
  void testToLower();
  // ??“_data”??β???????????????????????????
  void testToLower_data();
};
void TestQString::testToLower()
{
  // ???????????
  QFETCH(QString?? string);
  QFETCH(QString?? result);
  // ??????????????????????????????????
  QCOMPARE(string.toLower()?? result);
}
void TestQString::testToLower_data()
{
  // ?????????
  QTest::addColumn<QString>("string");
  QTest::addColumn<QString>("result");
  // ??????????
  QTest::newRow("lower") << "hello" << "hello";
  QTest::newRow("mixed") << "HeLlO" << "hello";
  QTest::newRow("upper") << "HELLO" << "hello";
}
// ???????????е???????
QTEST_MAIN(TestQString)
#include "testqstring.moc"

????????Qt???????????????????????private slot??

????initTestCase()????????????????

????cleanupTestCase()????????????????

????init()??????????????????????

????cleanup()??????????????к?????

????????????????????????????

********* Start testing of TestQString *********
Config: Using QTest library 4.5.3?? Qt 4.5.3
PASS   : TestQString::initTestCase()
PASS   : TestQString::testToLower()
PASS   : TestQString::cleanupTestCase()
Totals: 3 passed?? 0 failed?? 0 skipped
********* Finished testing of TestQString *********