• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeunittest
 

tdeunittest

  • tdeunittest
tester.cpp
1/*
2 * Copyright (C) 2005 Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <iostream>
27using namespace std;
28
29#include <tqmetaobject.h>
30
31#include "tester.h"
32
33namespace KUnitTest
34{
35 SlotTester::SlotTester(const char *name) : Tester(name)
36 {
37 m_resultsList.setAutoDelete(true);
38 m_total = m_results;
39 }
40
41 void SlotTester::invokeMember(const TQString &str)
42 {
43 TQString slotname = TQString::number(TQ_SLOT_CODE) + str;
44 connect(this, TQ_SIGNAL(invoke()), this, slotname.ascii());
45 emit invoke();
46 disconnect(this, TQ_SIGNAL(invoke()), this, slotname.ascii());
47 }
48
49 void SlotTester::allTests()
50 {
51 TQStrList allSlots = metaObject()->slotNames();
52
53 if ( allSlots.contains("setUp()") > 0 ) invokeMember("setUp()");
54
55 for ( char *sl = allSlots.first(); sl; sl = allSlots.next() )
56 {
57 TQString str = sl;
58
59 if ( str.startsWith("test") )
60 {
61 m_results = results(sl);
62 m_results->clear();
63
64 cout << "KUnitTest_Debug_BeginSlot[" << sl << "]" << endl;
65 invokeMember(str);
66 cout << "KUnitTest_Debug_EndSlot[" << sl << "]" << endl;
67 }
68 }
69
70 if ( allSlots.contains("tearDown()") > 0 ) invokeMember("tearDown()");
71
72 m_total->clear();
73 }
74
75 TestResults *SlotTester::results(const char *sl)
76 {
77 if ( m_resultsList.find(sl) == 0L ) m_resultsList.insert(sl, new TestResults());
78
79 return m_resultsList[sl];
80 }
81}
82
83TQTextStream& operator<<( TQTextStream& str, const TQRect& r ) {
84 str << "[" << r.x() << "," << r.y() << " - " << r.width() << "x" << r.height() << "]";
85 return str;
86}
87
88TQTextStream& operator<<( TQTextStream& str, const TQPoint& r ) {
89 str << "(" << r.x() << "," << r.y() << ")";
90 return str;
91}
92
93TQTextStream& operator<<( TQTextStream& str, const TQSize& r ) {
94 str << "[" << r.width() << "x" << r.height() << "]";
95 return str;
96}
97
98#include "tester.moc"
99
KUnitTest::TestResults
Definition: tester.h:433
KUnitTest
Namespace for Unit testing classes.
Definition: module.h:40
tester.h

tdeunittest

Skip menu "tdeunittest"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

tdeunittest

Skip menu "tdeunittest"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeunittest by doxygen 1.9.4
This website is maintained by Timothy Pearson.