当前位置: 首页>>代码示例>>C++>>正文


C++ Chaser::write方法代码示例

本文整理汇总了C++中Chaser::write方法的典型用法代码示例。如果您正苦于以下问题:C++ Chaser::write方法的具体用法?C++ Chaser::write怎么用?C++ Chaser::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chaser的用法示例。


在下文中一共展示了Chaser::write方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tap

void Chaser_Test::tap()
{
    Scene* s1 = new Scene(m_doc);
    m_doc->addFunction(s1);

    Scene* s2 = new Scene(m_doc);
    m_doc->addFunction(s2);

    Scene* s3 = new Scene(m_doc);
    m_doc->addFunction(s3);

    Scene* s4 = new Scene(m_doc);
    m_doc->addFunction(s4);

    Chaser* c = new Chaser(m_doc);
    c->addStep(s1->id());
    c->addStep(s2->id());
    c->addStep(s3->id());
    c->addStep(s4->id());
    m_doc->addFunction(c);

    c->preRun(m_doc->masterTimer());
    QVERIFY(c->m_runner != NULL);
    QCOMPARE(c->duration(), uint(0));
    c->write(m_doc->masterTimer(), QList<Universe*>());
    QCOMPARE(c->m_runner->m_next, false);
    c->tap();
    QTest::qWait(MasterTimer::tick());
    c->tap();
    QCOMPARE(c->m_runner->m_next, true);
}
开发者ID:Jeija,项目名称:qlcplus,代码行数:31,代码来源:chaser_test.cpp

示例2: writeBusZeroSingleShotBackward

void Chaser_Test::writeBusZeroSingleShotBackward()
{
	Doc* doc = new Doc(this, m_cache);

	Bus::instance()->setValue(Bus::defaultFade(), 0);
	Bus::instance()->setValue(Bus::defaultHold(), 0);

	Fixture* fxi = new Fixture(doc);
	fxi->setAddress(0);
	fxi->setUniverse(0);
	fxi->setChannels(2);
	doc->addFixture(fxi);

	Scene* s1 = new Scene(doc);
	s1->setName("Scene1");
	s1->setValue(fxi->id(), 0, UCHAR_MAX);
	s1->setValue(fxi->id(), 1, UCHAR_MAX);
	doc->addFunction(s1);

	Scene* s2 = new Scene(doc);
	s2->setName("Scene2");
	s2->setValue(fxi->id(), 0, 0);
	s2->setValue(fxi->id(), 1, 0);
	doc->addFunction(s2);

	Chaser* c = new Chaser(doc);
	c->setName("Chaser");
	c->setRunOrder(Chaser::SingleShot);
	c->setDirection(Chaser::Backward);
	c->addStep(s1->id());
	c->addStep(s2->id());

	s1->arm();
	s2->arm();
	c->arm();

	QByteArray uni;
	MasterTimerStub* mts = new MasterTimerStub(this, NULL, uni);

	QVERIFY(c->stopped() == true);
	mts->startFunction(c);
	QVERIFY(c->stopped() == false);

	/* SingleShot will stop automatically after the last step */
	c->write(mts, &uni);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s2);
	QVERIFY(s2->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s2->stopped() == true);
	mts->stopFunction(s2);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s1);
	QVERIFY(s1->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(c->stopped() == true);
	mts->stopFunction(c);
	QVERIFY(s1->stopped() == true);
	QVERIFY(s2->stopped() == true);

	c->disarm();
	s1->disarm();
	s2->disarm();

	delete mts;
	delete doc;
}
开发者ID:,项目名称:,代码行数:73,代码来源:

示例3: writeBusZeroPingPongForward

void Chaser_Test::writeBusZeroPingPongForward()
{
	Doc* doc = new Doc(this, m_cache);

	Bus::instance()->setValue(Bus::defaultFade(), 0);
	Bus::instance()->setValue(Bus::defaultHold(), 0);

	Fixture* fxi = new Fixture(doc);
	fxi->setAddress(0);
	fxi->setUniverse(0);
	fxi->setChannels(2);
	doc->addFixture(fxi);

	Scene* s1 = new Scene(doc);
	s1->setName("Scene1");
	s1->setValue(fxi->id(), 0, UCHAR_MAX);
	s1->setValue(fxi->id(), 1, UCHAR_MAX);
	doc->addFunction(s1);

	Scene* s2 = new Scene(doc);
	s2->setName("Scene2");
	s2->setValue(fxi->id(), 0, 127);
	s2->setValue(fxi->id(), 1, 127);
	doc->addFunction(s2);

	Scene* s3 = new Scene(doc);
	s3->setName("Scene2");
	s3->setValue(fxi->id(), 0, 0);
	s3->setValue(fxi->id(), 1, 0);
	doc->addFunction(s3);

	Chaser* c = new Chaser(doc);
	c->setName("Chaser");
	c->setRunOrder(Chaser::PingPong);
	c->addStep(s1->id());
	c->addStep(s2->id());
	c->addStep(s3->id());

	s1->arm();
	s2->arm();
	s3->arm();
	c->arm();

	QByteArray uni;
	MasterTimerStub* mts = new MasterTimerStub(this, NULL, uni);

	QVERIFY(c->stopped() == true);
	mts->startFunction(c);
	QVERIFY(c->stopped() == false);

	/* Since hold bus' value is 0 each call to write() starts the next
	   step in chaser. Last step comes first because the chaser is now
	   running backwards. */
	c->write(mts, &uni);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s1);
	QVERIFY(s1->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s1->stopped() == true);
	mts->stopFunction(s1);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s2);
	QVERIFY(s2->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s2->stopped() == true);
	mts->stopFunction(s2);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s3);
	QVERIFY(s3->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s3->stopped() == true);
	mts->stopFunction(s3);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s2);
	QVERIFY(s2->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s2->stopped() == true);
	mts->stopFunction(s2);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s1);
	QVERIFY(s1->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s1->stopped() == true);
	mts->stopFunction(s1);
	QVERIFY(c->stopped() == false);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: writeBusZeroLoopForward

void Chaser_Test::writeBusZeroLoopForward()
{
	Doc* doc = new Doc(this, m_cache);

	Bus::instance()->setValue(Bus::defaultFade(), 0);
	Bus::instance()->setValue(Bus::defaultHold(), 0);

	Fixture* fxi = new Fixture(doc);
	fxi->setAddress(0);
	fxi->setUniverse(0);
	fxi->setChannels(2);
	doc->addFixture(fxi);

	Scene* s1 = new Scene(doc);
	s1->setName("Scene1");
	s1->setValue(fxi->id(), 0, UCHAR_MAX);
	s1->setValue(fxi->id(), 1, UCHAR_MAX);
	doc->addFunction(s1);

	Scene* s2 = new Scene(doc);
	s2->setName("Scene2");
	s2->setValue(fxi->id(), 0, 0);
	s2->setValue(fxi->id(), 1, 0);
	doc->addFunction(s2);

	Chaser* c = new Chaser(doc);
	c->setName("Chaser");
	c->addStep(s1->id());
	c->addStep(s2->id());

	s1->arm();
	s2->arm();
	c->arm();

	QByteArray uni;
	MasterTimerStub* mts = new MasterTimerStub(this, NULL, uni);

	QVERIFY(c->stopped() == true);
	mts->startFunction(c);
	QVERIFY(c->stopped() == false);

	/* Since hold bus' value is 0 each call to write() starts the next
	   step in chaser. The functions must be manually removed from the
	   stub, which is OK (we're not testing the timer now), as long as
	   the correct step is always marked as stopped. */
	c->write(mts, &uni);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s1);
	QVERIFY(s1->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s1->stopped() == true);
	mts->stopFunction(s1);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s2);
	QVERIFY(s2->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s2->stopped() == true);
	mts->stopFunction(s2);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s1);
	QVERIFY(s1->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s1->stopped() == true);
	mts->stopFunction(s1);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s2);
	QVERIFY(s2->stopped() == false);

	c->write(mts, &uni);
	QVERIFY(s2->stopped() == true);
	mts->stopFunction(s2);
	QVERIFY(c->stopped() == false);
	QVERIFY(mts->m_functionList.size() == 2);
	QVERIFY(mts->m_functionList[0] == c);
	QVERIFY(mts->m_functionList[1] == s1);
	QVERIFY(s1->stopped() == false);

	c->stop();
	mts->stopFunction(c);
	QVERIFY(c->stopped() == true);
	QVERIFY(s1->stopped() == true);
	QVERIFY(s2->stopped() == true);

	c->disarm();
	s1->disarm();
	s2->disarm();

	delete mts;
	delete doc;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的Chaser::write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。