aboutsummaryrefslogtreecommitdiffstats
path: root/tests/qt4-qstring-from-array/main.cpp
blob: aa17b857fe25d272cf16dd96e31b932c5e03c4ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <QtCore/QString>
#include <QtCore/QByteArray>




QByteArray returns_byte_array() { return {}; }
void receivesQString(const QString &) {}







void test()
{
    QByteArray bytearray;
    QString s1("test");
    QString s2(bytearray);
    QString s3(bytearray + bytearray);
    QString s4 = QString("test");
    QString s5 = QString(bytearray);
    QString s6 = QString(bytearray + bytearray);
    QString s7 = QString(); // OK
    QString s8 = QString(QString()); // OK
    s1 = "test";
    s1 = "test"
          "bar";
    s1 = bytearray;

    if (s1 == "test") {}
    if (s1 == bytearray) {}
    if (s1 == bytearray + "test") {}

    s1 = bytearray + bytearray;
    s1 += bytearray;
    s1 += bytearray + bytearray;
    s1.append("foo");
    s1.prepend(bytearray);
    s1 = true ? "foo" : "bar";

    QString s9(returns_byte_array() + bytearray);
    s1.append(returns_byte_array());

    receivesQString("test");
}