blob: 577e0da7b6e5a46f74c189b4f2670ed184e0c951 (
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
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#include <QtTest/QtTest>
#include "util.h"
#include "lineedit.h"
static QString xml = "<lineedit name=\"mylineedit\"/>\n";
class TestLineEdit: public QObject
{
Q_OBJECT
private slots:
void creation() { TEST_CREATION(LineEdit); }
void memleak() {
QDomDocument doc; doc.setContent(xml);
QDomElement e = doc.documentElement();
MacroWindow *w = createMacroWindow();
TEST_MEMLEAK(LineEdit le(e, w));
delete w;
}
void disable() { TEST_DISABLE(LineEdit); }
void value() { TEST_VALUE(LineEdit); }
void edit()
{
QDomDocument doc; doc.setContent(xml);
QDomElement e = doc.documentElement();
LineEdit le(e, createMacroWindow());
QString teststring("hello");
QTest::keyClicks(le.qwidget(), teststring);
QCOMPARE(le.value(), teststring);
}
void changeEmits()
{
QDomDocument doc; doc.setContent(xml);
QDomElement e = doc.documentElement();
LineEdit le(e, createMacroWindow());
QSignalSpy spy(&le, SIGNAL(wasChanged()));
QTest::keyClicks(le.qwidget(), "h");
QCOMPARE(spy.count(), 1);
}
};
QTEST_MAIN(TestLineEdit)
#include "testlineedit.moc"
|