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


C++ QLCFixtureDef::addMode方法代码示例

本文整理汇总了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;
}
开发者ID:Andersbakken,项目名称:qlc-svn,代码行数:26,代码来源:qlcfixturedef_test.cpp

示例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;
}
开发者ID:Andersbakken,项目名称:qlc-svn,代码行数:22,代码来源:qlcfixturedef_test.cpp

示例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);
}
开发者ID:Andersbakken,项目名称:qlc-svn,代码行数:41,代码来源:qlcfixturedef_test.cpp

示例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;
}
开发者ID:Andersbakken,项目名称:qlc-svn,代码行数:36,代码来源:qlcfixturedef_test.cpp


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