summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp14
-rw-r--r--src/testlib/qtestcase.cpp2
2 files changed, 15 insertions, 1 deletions
diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
index 5c22b7c235..b2816d6576 100644
--- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
+++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
@@ -246,5 +246,19 @@ void tst_MyXmlParser::parse()
}
//! [26]
+//! [27]
+void TestBenchmark::simple()
+{
+ QString str1 = QLatin1String("This is a test string");
+ QString str2 = QLatin1String("This is a test string");
+
+ QCOMPARE(str1.localeAwareCompare(str2), 0);
+
+ QBENCHMARK {
+ str1.localeAwareCompare(str2);
+ }
+}
+//! [27]
+
}
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 6f8b12bded..d4266c0f9d 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -483,7 +483,7 @@ QT_BEGIN_NAMESPACE
For example:
- \snippet qtestlib/tutorial5/benchmarking.cpp 0
+ \snippet code/src_qtestlib_qtestcase.cpp 27
\sa {Qt Test Overview#Creating a Benchmark}{Creating a Benchmark},
{Chapter 5: Writing a Benchmark}{Writing a Benchmark}