コード例 #1
0
void tst_Q3RichText::append()
{
    Q3TextEdit textedit;
    QFETCH( QString, firstString );
    QFETCH( QString, secondString );
    QFETCH( QString, result );
    QFETCH( int, textFormat );

    textedit.setTextFormat( Qt::TextFormat(textFormat) );
    textedit.append( firstString );
    textedit.append( secondString );
    QCOMPARE( textedit.text().mid(textedit.text().indexOf("Hello World")), result );
}
コード例 #2
0
ファイル: runnergui.cpp プロジェクト: ShermanHuang/kdesdk
    void RunnerGUI::showDetails(Q3ListViewItem *item)
    {
        if ( item == 0L ) return;

        QString name = fullName(item);    
        if ( name.endsWith("()") ) name = fullName(item->parent());

        Tester *tester = Runner::self()->registry().find(name.local8Bit());

        if ( tester == 0L ) return;

        TestResults *res = 0L;
        if ( tester->inherits("KUnitTest::SlotTester") )
            res = static_cast<SlotTester*>(tester)->results(item->text(g_nameColumn).local8Bit());
        else
            res = tester->results();

        if ( tester == 0L ) 
            m_testerWidget->details()->setText("No test found with name: " + fullName(item));
        else
        {
            Q3TextEdit *te = m_testerWidget->details();

            te->clear();

            te->append("<qt><a name=\"errors\"><font color=\"#990000\">Errors</font></a>:<br></qt>");
            appendList(te, res->errorList());

            te->append("<qt><br><hr><font color=\"#c2c939\">Expected to fail</font>:<br></qt>");
            appendList(te, res->xfailList());

            te->append("<qt><br><hr><font color=\"#BF00B5\">Unexpected Success</font>:<br></qt>");
            appendList(te, res->xpassList());

            te->append("<qt><br><hr><font color=\"#009900\">Success</font>:<br></qt>");
            appendList(te, res->successList());

            te->append("<qt><br><hr><font color=\"#F7A300\">Skipped</font>:<br></qt>");
            appendList(te, res->skipList()); 

            te->append("<qt><br><hr><font color=\"#000099\">Debug</font>:<br></qt>");

            te->append(res->debugInfo());

            te->scrollToAnchor("errors");
        }
    }