本文整理汇总了C++中Chaser::steps方法的典型用法代码示例。如果您正苦于以下问题:C++ Chaser::steps方法的具体用法?C++ Chaser::steps怎么用?C++ Chaser::steps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chaser
的用法示例。
在下文中一共展示了Chaser::steps方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCopy
void Chaser_Test::createCopy()
{
Doc doc(this);
Chaser* c1 = new Chaser(m_doc);
c1->setName("First");
c1->setFadeInSpeed(42);
c1->setFadeOutSpeed(69);
c1->setDuration(1337);
c1->setDirection(Chaser::Backward);
c1->setRunOrder(Chaser::SingleShot);
c1->addStep(ChaserStep(20));
c1->addStep(ChaserStep(30));
c1->addStep(ChaserStep(40));
doc.addFunction(c1);
QVERIFY(c1->id() != Function::invalidId());
Function* f = c1->createCopy(&doc);
QVERIFY(f != NULL);
QVERIFY(f != c1);
QVERIFY(f->id() != c1->id());
Chaser* copy = qobject_cast<Chaser*> (f);
QVERIFY(copy != NULL);
QVERIFY(copy->fadeInSpeed() == 42);
QVERIFY(copy->fadeOutSpeed() == 69);
QVERIFY(copy->duration() == 1337);
QVERIFY(copy->direction() == Chaser::Backward);
QVERIFY(copy->runOrder() == Chaser::SingleShot);
QVERIFY(copy->steps().size() == 3);
QVERIFY(copy->steps().at(0) == ChaserStep(20));
QVERIFY(copy->steps().at(1) == ChaserStep(30));
QVERIFY(copy->steps().at(2) == ChaserStep(40));
}
示例2: createCopy
void Chaser_Test::createCopy()
{
Doc doc(this, m_cache);
Chaser* c1 = new Chaser(m_doc);
c1->setName("First");
c1->setBus(15);
c1->setDirection(Chaser::Backward);
c1->setRunOrder(Chaser::SingleShot);
c1->addStep(20);
c1->addStep(30);
c1->addStep(40);
doc.addFunction(c1);
QVERIFY(c1->id() != Function::invalidId());
Function* f = c1->createCopy(&doc);
QVERIFY(f != NULL);
QVERIFY(f != c1);
QVERIFY(f->id() != c1->id());
Chaser* copy = qobject_cast<Chaser*> (f);
QVERIFY(copy != NULL);
QVERIFY(copy->busID() == 15);
QVERIFY(copy->direction() == Chaser::Backward);
QVERIFY(copy->runOrder() == Chaser::SingleShot);
QVERIFY(copy->steps().size() == 3);
QVERIFY(copy->steps().at(0) == 20);
QVERIFY(copy->steps().at(1) == 30);
QVERIFY(copy->steps().at(2) == 40);
}
示例3: functionRemoved
void VCCueList_Test::functionRemoved()
{
QWidget w;
VCCueList cl(&w, m_doc);
Chaser* c = createChaser(m_doc);
cl.setChaser(c->id());
// Chaser members are removed from list
m_doc->deleteFunction(c->steps().first().fid);
QCOMPARE(cl.m_tree->topLevelItemCount(), 4);
// deferred changes arrive afetr 100ms
QTest::qWait(150);
QCOMPARE(cl.m_tree->topLevelItemCount(), 3);
QCOMPARE(cl.m_tree->topLevelItem(0)->text(0), QString("1"));
QCOMPARE(cl.m_tree->topLevelItem(1)->text(0), QString("2"));
QCOMPARE(cl.m_tree->topLevelItem(2)->text(0), QString("3"));
QCOMPARE(cl.m_tree->topLevelItem(0)->text(1), QString("Second"));
QCOMPARE(cl.m_tree->topLevelItem(1)->text(1), QString("Third"));
QCOMPARE(cl.m_tree->topLevelItem(2)->text(1), QString("Fourth"));
// Chaser is removed completely
m_doc->deleteFunction(c->id());
QCOMPARE(cl.m_tree->topLevelItemCount(), 0);
QCOMPARE(cl.chaserID(), Function::invalidId());
}
示例4: armMissingFunction
void Chaser_Test::armMissingFunction()
{
Doc* doc = new Doc(this, m_cache);
Fixture* fxi = new Fixture(doc);
fxi->setName("Test Fixture");
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(123); // Nonexistent function
c->addStep(s2->id());
c->addStep(55); // Nonexistent function
QVERIFY(c->steps().size() == 4);
c->arm();
QVERIFY(c->steps().size() == 2); // Nonexistent functions are removed
delete doc;
}
示例5: armSuccess
void Chaser_Test::armSuccess()
{
Doc* doc = new Doc(this, m_cache);
Fixture* fxi = new Fixture(doc);
fxi->setName("Test Fixture");
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);
QVERIFY(s1->id() != Function::invalidId());
Scene* s2 = new Scene(doc);
s2->setName("Scene2");
s2->setValue(fxi->id(), 0, 0);
s2->setValue(fxi->id(), 1, 0);
doc->addFunction(s2);
QVERIFY(s2->id() != Function::invalidId());
Chaser* c = new Chaser(doc);
c->setName("Chaser");
c->addStep(s1->id());
c->addStep(s2->id());
QVERIFY(c->steps().size() == 2);
c->arm();
QVERIFY(c->steps().size() == 2);
delete doc;
}
示例6: chaser
void VCCueList_Test::chaser()
{
QWidget w;
VCCueList cl(&w, m_doc);
Chaser* c = createChaser(m_doc);
// Try to put a non-chaser as the chaser
cl.setChaser(c->steps().first().fid);
QCOMPARE(cl.chaserID(), Function::invalidId());
QCOMPARE(cl.m_tree->topLevelItemCount(), 0);
// Put a real chaser as the chaser
cl.setChaser(c->id());
QCOMPARE(cl.chaserID(), c->id());
QCOMPARE(cl.m_tree->topLevelItemCount(), 4);
QCOMPARE(cl.m_tree->topLevelItem(0)->text(0), QString("1"));
QCOMPARE(cl.m_tree->topLevelItem(1)->text(0), QString("2"));
QCOMPARE(cl.m_tree->topLevelItem(2)->text(0), QString("3"));
QCOMPARE(cl.m_tree->topLevelItem(3)->text(0), QString("4"));
QCOMPARE(cl.m_tree->topLevelItem(0)->text(1), QString("First"));
QCOMPARE(cl.m_tree->topLevelItem(1)->text(1), QString("Second"));
QCOMPARE(cl.m_tree->topLevelItem(2)->text(1), QString("Third"));
QCOMPARE(cl.m_tree->topLevelItem(3)->text(1), QString("Fourth"));
}
示例7: manualActivation
void VCCueList_Test::manualActivation()
{
QWidget w;
VCCueList cl(&w, m_doc);
Chaser* c = createChaser(m_doc);
c->setDuration(Function::infiniteSpeed());
cl.setChaser(c->id());
Scene* s1 = qobject_cast<Scene*> (m_doc->function(c->steps()[0].fid));
//Scene* s2 = qobject_cast<Scene*> (m_doc->function(c->steps()[1].fid));
Scene* s3 = qobject_cast<Scene*> (m_doc->function(c->steps()[2].fid));
//Scene* s4 = qobject_cast<Scene*> (m_doc->function(c->steps()[3].fid));
Q_ASSERT(s1 /*&& s2*/ && s3/* && s4*/);
// Switch mode
m_doc->setMode(Doc::Operate);
MasterTimer* timer = m_doc->masterTimer();
// QVERIFY(cl.m_runner == NULL);
cl.slotItemActivated(cl.m_tree->topLevelItem(2));
// QVERIFY(cl.m_runner != NULL);
timer->timerTick();
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
// Same item
cl.slotItemActivated(cl.m_tree->topLevelItem(2));
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
// Another item
cl.slotItemActivated(cl.m_tree->topLevelItem(0));
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
// Crash check
cl.slotItemActivated(NULL);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
}
示例8: nextPrevious
void VCCueList_Test::nextPrevious()
{
QWidget w;
VCCueList cl(&w, m_doc);
Chaser* c = createChaser(m_doc);
c->setDuration(Function::infiniteSpeed());
cl.setChaser(c->id());
QCOMPARE(c->steps().size(), 4);
Scene* s1 = qobject_cast<Scene*> (m_doc->function(c->steps()[0].fid));
Scene* s2 = qobject_cast<Scene*> (m_doc->function(c->steps()[1].fid));
Scene* s3 = qobject_cast<Scene*> (m_doc->function(c->steps()[2].fid));
Scene* s4 = qobject_cast<Scene*> (m_doc->function(c->steps()[3].fid));
Q_ASSERT(s1 && s2 && s3 && s4);
// Not in operate mode, check for crashes
cl.slotNextCue();
cl.slotPreviousCue();
cl.slotItemActivated(cl.m_tree->topLevelItem(2));
// QVERIFY(cl.m_runner == NULL);
// Switch mode
m_doc->setMode(Doc::Operate);
MasterTimer* timer = m_doc->masterTimer();
// Create runner with a next action -> first item should be activated
cl.slotNextCue();
// QVERIFY(cl.m_runner != NULL);
timer->timerTick();
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
cl.slotNextCue();
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s2);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s2);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s2);
cl.slotNextCue();
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s3);
cl.slotPreviousCue();
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s2);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s2);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s2);
cl.slotPreviousCue();
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
// Wrap around to the last cue
cl.slotPreviousCue();
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s4);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s4);
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s4);
// Wrap around to the next cue
cl.slotNextCue();
timer->timerTick();
QCOMPARE(timer->runningFunctions(), 2);
QCOMPARE(timer->m_functionList[1], s1);
//.........这里部分代码省略.........