static IrcBufferModel* createBufferModel(QObject* parent) { IrcConnection* connection = new IrcConnection(parent); connection->setNickName("communi"); IrcBufferModel* model = new IrcBufferModel(connection); IrcBuffer* server = new Server(model); server->setName("Lorem Ipsum"); server->setSticky(true); model->add(server); model->add(createChannel("donec", model)); model->add(createChannel("convallis", model)); model->add(createChannel("sagittis", model)); model->add(createChannel("magna", model)); model->add(createChannel("tincidunt", model)); model->add(createChannel("phasellus ", model)); model->add(createChannel("tellus", model)); model->add(createChannel("fermentum", model)); model->add(createChannel("pharetra", model)); model->add(createChannel("vehicula", model)); model->add(createChannel("aliquam", model)); model->add(createChannel("bibendum", model)); model->add(createChannel("semper", model)); model->add(createChannel("dictum", model)); model->add(createChannel("rhoncus", model)); return model; }
void tst_IrcBuffer::testSticky() { IrcBuffer buffer; QVERIFY(!buffer.isSticky()); QSignalSpy spy(&buffer, SIGNAL(stickyChanged(bool))); QVERIFY(spy.isValid()); buffer.setSticky(true); QVERIFY(buffer.isSticky()); QCOMPARE(spy.count(), 1); QVERIFY(spy.last().last().toBool()); buffer.setSticky(false); QVERIFY(!buffer.isSticky()); QCOMPARE(spy.count(), 2); QVERIFY(!spy.last().last().toBool()); }