summaryrefslogtreecommitdiffstats
path: root/kdecore/tests/kdebugtest.cpp
blob: ee49127ea8eac12cd8689a0a766b20412566277b (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "kdebug.h"
#include <tqwidget.h>
#include <kinstance.h>
#include <iostream>
#include <tqapplication.h>
#include <tqpen.h>
#include <tqvariant.h>

class TestWidget : public QWidget
{

public:
  TestWidget(TQWidget* parent, const char* name)
    : TQWidget(parent, name)
  {
    kdDebug().form("mytest %s", "hello") << endl;
    TQString test = "%20C this is a string";
    kdDebug(150) << test << endl;
    TQCString cstr = test.latin1();
    kdDebug(150) << test << endl;
    TQChar ch = 'a';
    kdDebug() << "TQChar a: " << ch << endl;
    ch = '\r';
    kdDebug() << "TQChar \\r: " << ch << endl;
    kdDebug() << k_lineinfo << "error on this line" << endl;
    kdDebug(2 == 2) << "this is right " << perror << endl;
    kdDebug() << "Before instance creation" << endl;
    kdDebug(1202) << "Before instance creation" << endl;
    KInstance i("kdebugtest");
    kdDebug(1) << "kDebugInfo with inexisting area number" << endl;
    kdDebug(1202) << "This number has a value of " << 5 << endl;
    // kdDebug() << "This number should come out as appname " << 5 << " " << "test" << endl;
    kdWarning() << "1+1 = " << 1+1+1 << endl;
    kdError(1+1 != 2) << "there is something really odd!" << endl;
    TQString s = "mystring";
    kdDebug() << s << endl;
    kdError(1202) << "Error !!!" << endl;
    kdError() << "Error with no area" << endl;

    kdDebug() << "Printing a null TQWidget pointer: " << (TQWidget*)0 << endl;

    kdDebug() << "char " << '^' << " " << char(26) << endl;
    TQPoint p(0,9);
    kdDebug() << p << endl;

    TQRect r(9,12,58,234);
    kdDebug() << r << endl;

    TQRegion reg(r);
    reg += TQRect(1,60,200,59);
    kdDebug() << reg << endl;

    TQStringList sl;
    sl << "hi" << "this" << "list" << "is" << "short";
    kdDebug() << sl << endl;

    TQValueList<int> il;
    kdDebug() << "Empty TQValueList<int>: " << il << endl;
    il << 1 << 2 << 3 << 4 << 5;
    kdDebug() << "TQValueList<int> filled: " << il << endl;

    Q_LLONG big = 65536LL*65536*500;
    kdDebug() << big << endl;

    TQVariant v( 0.12345 );
    kdDebug() << "Variant: " << v << endl;
    v = TQPen( Qt::red );
    kdDebug() << "Variant: " << v << endl;

    TQByteArray data( 6 );
    data[0] = 42;
    data[1] = 'H';
    data[2] = 'e';
    data[3] = 'l';
    data[4] = 'l';
    data[5] = 'o';
    kdDebug() << data << endl;
    data.resize( 80 );
    data.fill( 42 );
    kdDebug() << data << endl;
  }
  void resizeEvent(TQResizeEvent*)
  {
    kdDebug() << this << endl;
  }
};

int main(int argc, char** argv)
{
  TQApplication app(argc, argv);
  TestWidget widget(0, "NoNameWidget");
  widget.setGeometry(45, 54, 120, 80);
  widget.show();
  app.setMainWidget(&widget);
  app.exec();
  return 0;
}