summaryrefslogtreecommitdiffstats
path: root/kunittest/runnergui.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
commit4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch)
treeb0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kunittest/runnergui.cpp
parent1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff)
downloadtdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz
tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kunittest/runnergui.cpp')
-rw-r--r--kunittest/runnergui.cpp122
1 files changed, 61 insertions, 61 deletions
diff --git a/kunittest/runnergui.cpp b/kunittest/runnergui.cpp
index ef5afe98..ded28e57 100644
--- a/kunittest/runnergui.cpp
+++ b/kunittest/runnergui.cpp
@@ -23,13 +23,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <qmetaobject.h>
-#include <qregexp.h>
-#include <qpushbutton.h>
-#include <qtextedit.h>
-#include <qlabel.h>
-#include <qprogressbar.h>
-#include <qcombobox.h>
+#include <tqmetaobject.h>
+#include <tqregexp.h>
+#include <tqpushbutton.h>
+#include <tqtextedit.h>
+#include <tqlabel.h>
+#include <tqprogressbar.h>
+#include <tqcombobox.h>
#include <dcopclient.h>
#include <dcopobject.h>
@@ -68,7 +68,7 @@ namespace KUnitTest
* @param name The name of the test.
* @param info The debug info.
*/
- bool addDebugInfo(const QString &name, const QString &info)
+ bool addDebugInfo(const TQString &name, const TQString &info)
{
Tester *tester = Runner::self()->registry().find(name.local8Bit());
if ( tester == 0L ) return false;
@@ -78,7 +78,7 @@ namespace KUnitTest
return true;
}
- bool addSlotDebugInfo(const QString &name, const QString &slt, const QString &info)
+ bool addSlotDebugInfo(const TQString &name, const TQString &slt, const TQString &info)
{
Tester *tester = Runner::self()->registry().find(name.local8Bit());
@@ -95,7 +95,7 @@ namespace KUnitTest
RunnerGUI *m_rg;
};
- RunnerGUI::RunnerGUI(QWidget *parent) : QHBox(parent)
+ RunnerGUI::RunnerGUI(TQWidget *parent) : TQHBox(parent)
{
m_dcop = new RunnerGUIDCOPImpl(this);
@@ -107,12 +107,12 @@ namespace KUnitTest
m_testerWidget->selectCombo()->insertItem("Selected tests . . .");
RegistryIteratorType it(Runner::self()->registry());
- QStringList suites;
+ TQStringList suites;
for ( ; it.current(); ++it )
{
addTester(it.currentKey(), it.current());
- QString test = it.currentKey();
+ TQString test = it.currentKey();
int index = test.find("::");
if ( index != -1 ) test = test.left(index);
@@ -125,7 +125,7 @@ namespace KUnitTest
// configure the resultslist
m_testerWidget->resultList()->setAllColumnsShowFocus(true);
- m_testerWidget->resultList()->setSelectionMode(QListView::Extended);
+ m_testerWidget->resultList()->setSelectionMode(TQListView::Extended);
m_testerWidget->resultList()->setRootIsDecorated(true);
m_testerWidget->resultList()->setColumnAlignment(g_finishedColumn, Qt::AlignHCenter);
m_testerWidget->resultList()->setColumnAlignment(g_skippedColumn, Qt::AlignHCenter);
@@ -140,10 +140,10 @@ namespace KUnitTest
// init the progress bar
configureProgressBar(Runner::self()->numberOfTestCases(), 0);
- connect(Runner::self(), SIGNAL(finished(const char *, Tester *)), this, SLOT(addTestResult(const char *, Tester *)));
- connect(m_testerWidget->resultList(), SIGNAL(clicked(QListViewItem *)), this, SLOT(showDetails(QListViewItem *)));
- connect(m_testerWidget, SIGNAL(run()), this, SLOT(runSuite()));
- connect(m_testerWidget->details(), SIGNAL(doubleClicked(int, int)), this, SLOT(doubleClickedOnDetails(int, int)));
+ connect(Runner::self(), TQT_SIGNAL(finished(const char *, Tester *)), this, TQT_SLOT(addTestResult(const char *, Tester *)));
+ connect(m_testerWidget->resultList(), TQT_SIGNAL(clicked(TQListViewItem *)), this, TQT_SLOT(showDetails(TQListViewItem *)));
+ connect(m_testerWidget, TQT_SIGNAL(run()), this, TQT_SLOT(runSuite()));
+ connect(m_testerWidget->details(), TQT_SIGNAL(doubleClicked(int, int)), this, TQT_SLOT(doubleClickedOnDetails(int, int)));
}
RunnerGUI::~RunnerGUI()
@@ -161,23 +161,23 @@ namespace KUnitTest
{
if ( Runner::self()->numberOfTests() > 0 )
m_testerWidget->resultsLabel()->setText(
- QString("Test cases: %1 | Tests performed: %5, Skipped: <font color=\"#f7a300\">%4</font> | Passed: <font color=\"#009900\">%2</font>, Failed: <font color=\"#990000\">%3</font>")
+ TQString("Test cases: %1 | Tests performed: %5, Skipped: <font color=\"#f7a300\">%4</font> | Passed: <font color=\"#009900\">%2</font>, Failed: <font color=\"#990000\">%3</font>")
.arg(Runner::self()->numberOfTestCases())
.arg(Runner::self()->numberOfPassedTests())
.arg(Runner::self()->numberOfFailedTests())
.arg(Runner::self()->numberOfSkippedTests())
.arg(Runner::self()->numberOfTests()) );
else
- m_testerWidget->resultsLabel()->setText(QString("Test cases: %1").arg(Runner::self()->numberOfTestCases()));
+ m_testerWidget->resultsLabel()->setText(TQString("Test cases: %1").arg(Runner::self()->numberOfTestCases()));
}
void RunnerGUI::addTestResult(const char *name, Tester *test)
{
- QStringList scopes = QStringList::split("::", name);
- QString suite = scopes[0];
+ TQStringList scopes = TQStringList::split("::", name);
+ TQString suite = scopes[0];
// find the suite item
- QListViewItem *item = 0L;
+ TQListViewItem *item = 0L;
for ( uint i = 0; i < scopes.count(); ++i )
item = getItem(scopes[i], item);
@@ -185,7 +185,7 @@ namespace KUnitTest
{
SlotTester *sltest = static_cast<SlotTester*>(test);
TestResultsListIteratorType it(sltest->resultsList());
- QListViewItem *slotItem = 0L;
+ TQListViewItem *slotItem = 0L;
for ( ; it.current(); ++it)
{
slotItem = getItem(it.currentKey(), item);
@@ -201,28 +201,28 @@ namespace KUnitTest
void RunnerGUI::addTester(const char *name, Tester *test)
{
- QStringList scopes = QStringList::split("::", name);
- QString suite = scopes[0];
+ TQStringList scopes = TQStringList::split("::", name);
+ TQString suite = scopes[0];
// find the suite item
- QListViewItem *item = 0L;
+ TQListViewItem *item = 0L;
for ( uint i = 0; i < scopes.count(); ++i )
item = getItem(scopes[i], item);
if ( test->inherits("KUnitTest::SlotTester") )
{
- QStrList allSlots = test->metaObject()->slotNames();
+ TQStrList allSlots = test->metaObject()->slotNames();
for ( char *sl = allSlots.first(); sl; sl = allSlots.next() )
{
- if ( QString(sl).startsWith("test") )
+ if ( TQString(sl).startsWith("test") )
getItem(sl, item);
}
}
}
- QListViewItem *RunnerGUI::getItem(const QString &name, QListViewItem *item /*= 0L*/)
+ TQListViewItem *RunnerGUI::getItem(const TQString &name, TQListViewItem *item /*= 0L*/)
{
- QListViewItem *parent = item;
+ TQListViewItem *parent = item;
if ( item == 0L ) item = m_testerWidget->resultList()->firstChild();
else item = item->firstChild();
@@ -234,9 +234,9 @@ namespace KUnitTest
if ( item == 0L )
{
if ( parent == 0L )
- item = new QListViewItem(m_testerWidget->resultList());
+ item = new TQListViewItem(m_testerWidget->resultList());
else
- item = new QListViewItem(parent);
+ item = new TQListViewItem(parent);
item->setText(g_nameColumn, name);
}
@@ -246,44 +246,44 @@ namespace KUnitTest
void RunnerGUI::reset()
{
- QListViewItemIterator it( m_testerWidget->resultList() );
+ TQListViewItemIterator it( m_testerWidget->resultList() );
while ( it.current() )
{
- QListViewItem *item = it.current();
+ TQListViewItem *item = it.current();
item->setText(g_finishedColumn, "0");
item->setText(g_skippedColumn, "0");
item->setText(g_failedColumn, "0");
item->setText(g_xfailedColumn, "0");
item->setText(g_passedColumn, "0");
item->setText(g_xpassedColumn, "0");
- item->setPixmap(g_nameColumn, QPixmap());
+ item->setPixmap(g_nameColumn, TQPixmap());
++it;
}
}
- void RunnerGUI::setSummary(QListViewItem *item, TestResults *res)
+ void RunnerGUI::setSummary(TQListViewItem *item, TestResults *res)
{
if ( item == 0L ) return;
bool ok;
int val = item->text(g_finishedColumn).toInt(&ok); if (!ok) val = 0;
- item->setText(g_finishedColumn, QString::number(val + res->testsFinished()));
+ item->setText(g_finishedColumn, TQString::number(val + res->testsFinished()));
val = item->text(g_skippedColumn).toInt(&ok); if (!ok) val = 0;
- item->setText(g_skippedColumn, QString::number(val + res->skipped()));
+ item->setText(g_skippedColumn, TQString::number(val + res->skipped()));
val = item->text(g_passedColumn).toInt(&ok); if (!ok) val = 0;
- item->setText(g_passedColumn, QString::number(val + res->passed()));
+ item->setText(g_passedColumn, TQString::number(val + res->passed()));
val = item->text(g_failedColumn).toInt(&ok); if (!ok) val = 0;
- item->setText(g_failedColumn, QString::number(val + res->errors()));
+ item->setText(g_failedColumn, TQString::number(val + res->errors()));
val = item->text(g_xfailedColumn).toInt(&ok); if (!ok) val = 0;
- item->setText(g_xfailedColumn, QString::number(val + res->xfails()));
+ item->setText(g_xfailedColumn, TQString::number(val + res->xfails()));
val = item->text(g_xpassedColumn).toInt(&ok); if (!ok) val = 0;
- item->setText(g_xpassedColumn, QString::number(val + res->xpasses()));
+ item->setText(g_xpassedColumn, TQString::number(val + res->xpasses()));
bool passed = (item->text(g_failedColumn).toInt(&ok) + item->text(g_xfailedColumn).toInt(&ok)) == 0;
item->setPixmap(g_nameColumn, passed ? SmallIcon("button_ok") : SmallIcon("button_cancel") );
@@ -291,9 +291,9 @@ namespace KUnitTest
setSummary(item->parent(), res);
}
- QString RunnerGUI::fullName(QListViewItem *item)
+ TQString RunnerGUI::fullName(TQListViewItem *item)
{
- QString name = item->text(g_nameColumn);
+ TQString name = item->text(g_nameColumn);
while ( (item = item->parent()) != 0L )
name = item->text(g_nameColumn) + "::" + name;
@@ -312,14 +312,14 @@ namespace KUnitTest
}
else if ( m_testerWidget->selectCombo()->currentItem() == 1 )
{
- QListViewItemIterator it( m_testerWidget->resultList() );
- QStringList prefixes;
+ TQListViewItemIterator it( m_testerWidget->resultList() );
+ TQStringList prefixes;
while ( it.current() )
{
- QListViewItem *item = it.current();
+ TQListViewItem *item = it.current();
if ( item->isSelected() )
{
- QString prefix = fullName(item);
+ TQString prefix = fullName(item);
if ( prefix.endsWith("()") )
{
int index = prefix.findRev("::");
@@ -337,11 +337,11 @@ namespace KUnitTest
}
else
{
- QString suite = m_testerWidget->selectCombo()->currentText();
- QStringList tests;
+ TQString suite = m_testerWidget->selectCombo()->currentText();
+ TQStringList tests;
RegistryIteratorType it(Runner::self()->registry());
for ( ; it.current(); ++it )
- if ( QString(it.currentKey()).startsWith(suite) )
+ if ( TQString(it.currentKey()).startsWith(suite) )
tests.append(it.currentKey());
configureProgressBar(tests.count(), 0);
@@ -353,11 +353,11 @@ namespace KUnitTest
showDetails(m_testerWidget->resultList()->currentItem());
}
- void RunnerGUI::showDetails(QListViewItem *item)
+ void RunnerGUI::showDetails(TQListViewItem *item)
{
if ( item == 0L ) return;
- QString name = fullName(item);
+ TQString name = fullName(item);
if ( name.endsWith("()") ) name = fullName(item->parent());
Tester *tester = Runner::self()->registry().find(name.local8Bit());
@@ -374,7 +374,7 @@ namespace KUnitTest
m_testerWidget->details()->setText("No test found with name: " + fullName(item));
else
{
- QTextEdit *te = m_testerWidget->details();
+ TQTextEdit *te = m_testerWidget->details();
te->clear();
@@ -401,7 +401,7 @@ namespace KUnitTest
}
}
- void RunnerGUI::appendList(QTextEdit *te, const QStringList &list)
+ void RunnerGUI::appendList(TQTextEdit *te, const TQStringList &list)
{
for ( uint i = 0; i < list.count(); ++i )
te->append(list[i]);
@@ -409,20 +409,20 @@ namespace KUnitTest
void RunnerGUI::doubleClickedOnDetails(int para, int /*pos*/)
{
- static QRegExp reFileAndLine("^(.*)\\[([0-9]+)\\]:");
+ static TQRegExp reFileAndLine("^(.*)\\[([0-9]+)\\]:");
- QString line = m_testerWidget->details()->text(para);
+ TQString line = m_testerWidget->details()->text(para);
m_testerWidget->details()->setSelection(para, 0, para, line.length()-1);
if ( reFileAndLine.search(line) != -1 )
{
DCOPClient client;
client.attach();
- QByteArray data;
- QDataStream arg(data, IO_WriteOnly);
+ TQByteArray data;
+ TQDataStream arg(data, IO_WriteOnly);
bool ok;
- arg << QString(reFileAndLine.cap(1)) << (reFileAndLine.cap(2).toInt(&ok) - 1);
- client.send("kdevelop-*", "KDevPartController", "editDocument(QString,int)", data);
+ arg << TQString(reFileAndLine.cap(1)) << (reFileAndLine.cap(2).toInt(&ok) - 1);
+ client.send("kdevelop-*", "KDevPartController", "editDocument(TQString,int)", data);
client.send("kdevelop-*", "MainWindow", "raise()", "");
client.detach();