本文整理汇总了C++中QLCFixtureDef::addMode方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCFixtureDef::addMode方法的具体用法?C++ QLCFixtureDef::addMode怎么用?C++ QLCFixtureDef::addMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCFixtureDef
的用法示例。
在下文中一共展示了QLCFixtureDef::addMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addMode
void QLCFixtureDef_Test::addMode()
{
QLCFixtureDef* fd = new QLCFixtureDef();
QLCFixtureMode* mode1 = new QLCFixtureMode(fd);
QLCFixtureMode* mode2 = new QLCFixtureMode(fd);
QVERIFY(fd->modes().size() == 0);
fd->addMode(NULL);
QVERIFY(fd->modes().size() == 0);
fd->addMode(mode1);
QVERIFY(fd->modes().size() == 1);
QVERIFY(fd->modes().at(0) == mode1);
fd->addMode(mode1);
QVERIFY(fd->modes().size() == 1);
QVERIFY(fd->modes().at(0) == mode1);
fd->addMode(mode2);
QVERIFY(fd->modes().size() == 2);
QVERIFY(fd->modes().at(0) == mode1);
QVERIFY(fd->modes().at(1) == mode2);
delete fd;
}
示例2: mode
void QLCFixtureDef_Test::mode()
{
QLCFixtureDef* fd = new QLCFixtureDef();
QLCFixtureMode* mode1 = new QLCFixtureMode(fd);
mode1->setName("foo");
fd->addMode(mode1);
QLCFixtureMode* mode2 = new QLCFixtureMode(fd);
mode2->setName("bar");
fd->addMode(mode2);
QLCFixtureMode* mode3 = new QLCFixtureMode(fd);
mode3->setName("xyzzy");
fd->addMode(mode3);
QVERIFY(fd->mode("foo") == mode1);
QVERIFY(fd->mode("bar") == mode2);
QVERIFY(fd->mode("xyzzy") == mode3);
QVERIFY(fd->mode("foobar") == NULL);
delete fd;
}
示例3: saveLoadXML
void QLCFixtureDef_Test::saveLoadXML()
{
const QString path("qlcfixturedef_test_saveXML.qxf");
QLCFixtureDef* def = new QLCFixtureDef;
def->setManufacturer("Foobar");
def->setModel("Xyzzy");
def->setType("Blinder");
QLCChannel* ch = new QLCChannel;
ch->setName("Whatever");
def->addChannel(ch);
QLCFixtureMode* mode = new QLCFixtureMode(def);
mode->setName("Barfoo");
def->addMode(mode);
mode->insertChannel(ch, 0);
QVERIFY(def->saveXML(QString("zxcvb:/path/to/nowhere") + path) != QFile::NoError);
QCOMPARE(def->saveXML(path), QFile::NoError);
// Test only QLCFixtureDef's doings and don't go into channel/mode details
// since they are tested in their individual unit tests.
QLCFixtureDef* def2 = new QLCFixtureDef;
QCOMPARE(def2->loadXML(QString()), QFile::OpenError);
QCOMPARE(def2->loadXML("/path/beyond/this/universe/foo.qxf"), QFile::ReadError);
QCOMPARE(def2->loadXML("readonly.xml"), QFile::ReadError);
QCOMPARE(def2->loadXML(path), QFile::NoError);
QCOMPARE(def2->manufacturer(), def->manufacturer());
QCOMPARE(def2->model(), def->model());
QCOMPARE(def2->channels().size(), 1);
QCOMPARE(def2->channels().at(0)->name(), ch->name());
QCOMPARE(def2->modes().size(), 1);
QCOMPARE(def2->modes().at(0)->name(), mode->name());
delete def;
delete def2;
QFile::remove(path);
QVERIFY(QFile::exists(path) == false);
}
示例4: copy
void QLCFixtureDef_Test::copy()
{
QLCFixtureDef* fd = new QLCFixtureDef();
fd->setManufacturer("Martin");
fd->setModel("MAC600");
fd->setType("Moving Head");
QLCChannel* ch = new QLCChannel();
ch->setName("TestChannel");
fd->addChannel(ch);
QLCFixtureMode* mode = new QLCFixtureMode(fd);
mode->setName("TestMode");
fd->addMode(mode);
mode->insertChannel(ch, 0);
QLCFixtureDef* copy = new QLCFixtureDef(fd);
QVERIFY(copy->manufacturer() == "Martin");
QVERIFY(copy->model() == "MAC600");
QVERIFY(copy->type() == "Moving Head");
/* Verify that modes and channels get copied and that the channels in
the copied mode are from the copied fixtureDef and not the one that
the copy is taken FROM. */
QVERIFY(copy->channels().at(0)->name() == "TestChannel");
QVERIFY(copy->modes().at(0)->name() == "TestMode");
QVERIFY(copy->modes().at(0)->channels().size() == 1);
QVERIFY(copy->modes().size() == 1);
QVERIFY(copy->modes().at(0)->channel(0) != ch);
QVERIFY(copy->modes().at(0)->channel(0) == copy->channels().at(0));
QVERIFY(copy->channels().at(0)->name() == "TestChannel");
QVERIFY(copy->modes().at(0)->channel(0)->name() == "TestChannel");
delete fd;
delete copy;
}