Ejemplo n.º 1
0
void tst_IrcChannel::testDebug()
{
    QString str;
    QDebug dbg(&str);

    dbg << static_cast<IrcChannel*>(0);
    QCOMPARE(str.trimmed(), QString::fromLatin1("IrcChannel(0x0)"));
    str.clear();

    IrcChannel channel;
    dbg << &channel;
    QVERIFY(QRegExp("IrcChannel\\(0x[0-9A-Fa-f]+\\) ").exactMatch(str));
    str.clear();

    channel.setObjectName("obj");
    dbg << &channel;
    QVERIFY(QRegExp("IrcChannel\\(0x[0-9A-Fa-f]+, name=obj\\) ").exactMatch(str));
    str.clear();

    channel.setPrefix("#");
    channel.setName("communi");
    dbg << &channel;
    QVERIFY(QRegExp("IrcChannel\\(0x[0-9A-Fa-f]+, name=obj, title=#communi\\) ").exactMatch(str));
    str.clear();
}
Ejemplo n.º 2
0
static IrcBuffer* createChannel(const QString& name, QObject* parent)
{
    IrcChannel* channel = new Channel(parent);
    channel->setPrefix("#");
    channel->setName(name);
    return channel;
}