aboutsummaryrefslogtreecommitdiffstats
path: root/tests/writing-to-temporary/main.cpp
blob: f5f1106de3928c1a8243eacaa63c978539e46be3 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <QtCore/QSize>
#include <QtGui/QColor>
#include <QtGui/QTextTableCell>
#include <QtXml/QDomNode>











struct Foo
{
    int m;
    void setM(int v) { m = v; }
    int setX(int v) { return 0; }
    void setY() const {}
    static void setM_static(int) {}
};


Foo getFoo() { return Foo(); }
Foo& getFooRef() { static Foo f; return f; }
Foo* getFooPtr() { return new Foo(); }

void test()
{
    getFoo().setM(1); // Warning
    getFoo().setM_static(1);
    getFoo().setX(1); // OK
    getFoo().setY(); // OK
    getFooRef().setM(1); // OK
    getFooPtr()->setM(1); // OK

    Foo f;
    f.setM(1); // OK
}



QSize getSize() { return QSize(); }

void testKnownTypes()
{
    getSize().transpose(); // Warning
}

QDomNode getNode() { return {}; }

void testDisallowedType() // bug #354363
{
    getNode().firstChild(); // OK
    QDomNode node;
    node.firstChild().setPrefix(""); // OK
}

void testQColor()
{
    QColor col;
    int *c, *m, *y, *k, *a;
    col.toCmyk().getCmyk(c, m, y, k, a);
}


void test363428()
{
    QTextCursor cursor;
    QTextTable *currentTable;
    currentTable->cellAt(cursor).setFormat(QTextCharFormat());
}

bool returnsBool() { return true; }

void testTernary()
{
    QStringList list;
    (returnsBool() ? list : list).append(""); // OK
}