qstringbuilder: also accept QStringRef

This commit is contained in:
hjk
2009-05-25 17:00:31 +02:00
parent 295a0102b7
commit a31ce64b9c
2 changed files with 23 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ public:
: l1literal("some string literal"),
l1string("some string literal"),
string(l1string),
stringref(&string, 2, 10),
achar('c')
{}
@@ -90,6 +91,18 @@ private slots:
}
void separator_2c() { SEP("2 string refs"); }
void b_2_stringref() {
QBENCHMARK { r = stringref % stringref; }
COMPARE(r, stringref.toString() + stringref.toString());
}
void s_2_stringref() {
QBENCHMARK { r = stringref.toString() + stringref.toString(); }
COMPARE(r, QString(stringref % stringref));
}
void separator_2b() { SEP("3 strings"); }
void b_3_string() {
@@ -188,6 +201,7 @@ private:
const QLatin1Literal l1literal;
const QLatin1String l1string;
const QString string;
const QStringRef stringref;
const QLatin1Char achar;
QString r;