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


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

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


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

示例1: removeMode

void QLCFixtureDef_Test::removeMode()
{
    QLCFixtureDef* fd = new QLCFixtureDef();
    QLCFixtureMode* mode1 = new QLCFixtureMode(fd);
    QLCFixtureMode* mode2 = new QLCFixtureMode(fd);

    QVERIFY(fd->modes().size() == 0);
    QVERIFY(fd->removeMode(NULL) == false);
    QVERIFY(fd->removeMode(mode1) == false);
    QVERIFY(fd->removeMode(mode2) == false);
    QVERIFY(fd->modes().size() == 0);

    fd->addMode(mode1);
    fd->addMode(mode2);
    QVERIFY(fd->modes().size() == 2);

    QVERIFY(fd->removeMode(mode1) == true);
    QVERIFY(fd->modes().size() == 1);
    QVERIFY(fd->modes().at(0) == mode2);

    QVERIFY(fd->removeMode(mode1) == false);
    QVERIFY(fd->modes().size() == 1);
    QVERIFY(fd->modes().at(0) == mode2);

    QVERIFY(fd->removeMode(NULL) == false);
    QVERIFY(fd->modes().size() == 1);
    QVERIFY(fd->modes().at(0) == mode2);

    QVERIFY(fd->removeMode(mode2) == true);
    QVERIFY(fd->modes().size() == 0);

    delete fd;
}
开发者ID:Andersbakken,项目名称:qlc-svn,代码行数:33,代码来源:qlcfixturedef_test.cpp

示例2: init

void EFXFixture_Test::init()
{
    {
        QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
        QVERIFY(def != NULL);
        QLCFixtureMode* mode = def->modes().first();
        QVERIFY(mode != NULL);

        Fixture* fxi = new Fixture(m_doc);
        fxi->setFixtureDefinition(def, mode);
        m_doc->addFixture(fxi);
        m_fixture8bit = fxi->id();
    }

    {
        QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "MH-440");
        QVERIFY(def != NULL);
        QLCFixtureMode* mode = def->modes().first();
        QVERIFY(mode != NULL);

        Fixture* fxi = new Fixture(m_doc);
        fxi->setFixtureDefinition(def, mode);
        m_doc->addFixture(fxi);
        m_fixture16bit = fxi->id();
    }

    {
        QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "CY-200");
        QVERIFY(def != NULL);
        QLCFixtureMode* mode = def->modes().first();
        QVERIFY(mode != NULL);

        Fixture* fxi = new Fixture(m_doc);
        fxi->setFixtureDefinition(def, mode);
        m_doc->addFixture(fxi);
        m_fixturePanOnly = fxi->id();
    }

    {
        QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("American DJ", "Sweeper Beam Quad LED");
        QVERIFY(def != NULL);
        QLCFixtureMode* mode = def->modes().last(); // 39 Channel mode
        QVERIFY(mode != NULL);

        Fixture* fxi = new Fixture(m_doc);
        fxi->setFixtureDefinition(def, mode);
        m_doc->addFixture(fxi);
        m_fixtureLedBar = fxi->id();
    }
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:50,代码来源:efxfixture_test.cpp

示例3: initTestCase

void VCXYPadFixtureEditor_Test::initTestCase()
{
    m_doc = new Doc(this);

    QDir dir(INTERNAL_FIXTUREDIR);
    dir.setFilter(QDir::Files);
    dir.setNameFilters(QStringList() << QString("*%1").arg(KExtFixture));
    QVERIFY(m_doc->fixtureDefCache()->loadMap(dir) == true);

    QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
    QVERIFY(def != NULL);
    QLCFixtureMode* mode = def->modes()[0];
    QVERIFY(mode != NULL);

    Fixture* fxi = new Fixture(m_doc);
    fxi->setName("Fixture 1");
    fxi->setFixtureDefinition(def, mode);
    fxi->setAddress(0);

    fxi = new Fixture(m_doc);
    fxi->setName("Fixture 2");
    fxi->setFixtureDefinition(def, mode);
    fxi->setAddress(10);

    fxi = new Fixture(m_doc);
    fxi->setName("Fixture 3");
    fxi->setFixtureDefinition(def, mode);
    fxi->setAddress(20);
}
开发者ID:PML369,项目名称:qlcplus,代码行数:29,代码来源:vcxypadfixtureeditor_test.cpp

示例4: status

void Fixture_Test::status()
{
    // This test is mostly just a stability check since checking lots of
    // detailed HTML formatting is not that useful.
    QString info;

    Fixture fxi(this);
    info = fxi.status();

    fxi.setID(1337);
    info = fxi.status();

    fxi.setName("Test Fixture");
    info = fxi.status();

    fxi.setUniverse(2);
    info = fxi.status();

    fxi.setAddress(438);
    info = fxi.status();

    fxi.setChannels(12);
    info = fxi.status();

    QLCFixtureDef* fixtureDef;
    fixtureDef = m_doc->fixtureDefCache()->fixtureDef("Martin", "MAC250+");
    Q_ASSERT(fixtureDef != NULL);

    QLCFixtureMode* fixtureMode;
    fixtureMode = fixtureDef->modes().at(0);
    Q_ASSERT(fixtureMode != NULL);

    fxi.setFixtureDefinition(fixtureDef, fixtureMode);
    info = fxi.status();
}
开发者ID:PML369,项目名称:qlcplus,代码行数:35,代码来源:fixture_test.cpp

示例5: channels

void Fixture_Test::channels()
{
    Fixture fxi(this);
    QLCFixtureDef* fixtureDef = m_doc->fixtureDefCache()->fixtureDef("i-Pix", "BB4");
    QVERIFY(fixtureDef != NULL);
    QLCFixtureMode* fixtureMode = fixtureDef->modes().last();
    QVERIFY(fixtureMode != NULL);
    fxi.setFixtureDefinition(fixtureDef, fixtureMode);

    QCOMPARE(fxi.channel("red", Qt::CaseInsensitive), quint32(3));
    QCOMPARE(fxi.channel("red", Qt::CaseInsensitive, QLCChannel::Intensity), quint32(3));
    QCOMPARE(fxi.channel("brown", Qt::CaseInsensitive), QLCChannel::invalid());

    QSet <quint32> chs;
    chs << 3 << 4 << 21 << 22 << 12 << 13 << 30 << 31;
    QCOMPARE(chs, fxi.channels("red", Qt::CaseInsensitive));
    QCOMPARE(chs, fxi.channels("red", Qt::CaseInsensitive, QLCChannel::Intensity));
    chs.clear();
    chs << 5 << 6 << 23 << 24 << 14 << 15 << 32 << 33;
    QCOMPARE(chs, fxi.channels("green", Qt::CaseInsensitive));
    chs.clear();
    QCOMPARE(chs, fxi.channels("green"));
    chs.clear();
    chs << 7 << 8 << 16 << 17 << 25 << 26 << 34 << 35;
    QCOMPARE(chs, fxi.channels("blue", Qt::CaseInsensitive));
    chs.clear();
    QCOMPARE(chs, fxi.channels("green", Qt::CaseInsensitive, QLCChannel::Colour));
    chs.clear();
    QCOMPARE(fxi.channels("brown", Qt::CaseInsensitive, QLCChannel::Intensity), chs);
}
开发者ID:CCLinck21,项目名称:qlcplus,代码行数:30,代码来源:fixture_test.cpp

示例6: initTestCase

void RGBMatrix_Test::initTestCase()
{
    m_doc = new Doc(this);

    QDir fxiDir(INTERNAL_FIXTUREDIR);
    fxiDir.setFilter(QDir::Files);
    fxiDir.setNameFilters(QStringList() << QString("*%1").arg(KExtFixture));
    QVERIFY(m_doc->fixtureDefCache()->loadMap(fxiDir) == true);

    QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Stairville", "LED PAR56");
    QVERIFY(def != NULL);
    QLCFixtureMode* mode = def->modes().first();
    QVERIFY(mode != NULL);

    FixtureGroup* grp = new FixtureGroup(m_doc);
    grp->setName("Test Group");
    grp->setSize(QSize(5, 5));
    m_doc->addFixtureGroup(grp);

    for (int i = 0; i < 25; i++)
    {
        Fixture* fxi = new Fixture(m_doc);
        fxi->setFixtureDefinition(def, mode);
        fxi->setAddress(i * fxi->channels());
        m_doc->addFixture(fxi);

        grp->assignFixture(fxi->id());
    }

    QVERIFY(m_doc->rgbScriptsCache()->load(QDir(INTERNAL_SCRIPTDIR)));
    QVERIFY(m_doc->rgbScriptsCache()->names().size() != 0);
}
开发者ID:mattharris,项目名称:qlcplus,代码行数:32,代码来源:rgbmatrix_test.cpp

示例7: fixtureDef

void Fixture_Test::fixtureDef()
{
    Fixture fxi(this);

    QVERIFY(fxi.fixtureDef() == NULL);
    QVERIFY(fxi.fixtureMode() == NULL);
    QVERIFY(fxi.channels() == 0);
    QVERIFY(fxi.channel(0) == NULL);
    QCOMPARE(fxi.panMsbChannel(), QLCChannel::invalid());
    QCOMPARE(fxi.tiltMsbChannel(), QLCChannel::invalid());
    QCOMPARE(fxi.panLsbChannel(), QLCChannel::invalid());
    QCOMPARE(fxi.tiltLsbChannel(), QLCChannel::invalid());
    QCOMPARE(fxi.masterIntensityChannel(), QLCChannel::invalid());

    QLCFixtureDef* fixtureDef;
    fixtureDef = m_doc->fixtureDefCache()->fixtureDef("Martin", "MAC300");
    Q_ASSERT(fixtureDef != NULL);

    fxi.setFixtureDefinition(fixtureDef, NULL);
    QVERIFY(fxi.fixtureDef() == NULL);
    QVERIFY(fxi.fixtureMode() == NULL);

    QLCFixtureMode* fixtureMode;
    fixtureMode = fixtureDef->modes().last();
    Q_ASSERT(fixtureMode != NULL);

    fxi.setFixtureDefinition(NULL, fixtureMode);
    QVERIFY(fxi.fixtureDef() == NULL);
    QVERIFY(fxi.fixtureMode() == NULL);

    fxi.setFixtureDefinition(fixtureDef, fixtureMode);
    QVERIFY(fxi.fixtureDef() != NULL);
    QVERIFY(fxi.fixtureMode() != NULL);
    QVERIFY(fxi.fixtureDef() == fixtureDef);
    QVERIFY(fxi.fixtureMode() == fixtureMode);

    QVERIFY(fxi.channels() == quint32(fixtureMode->channels().count()));
    QVERIFY(fxi.channel(fxi.channels() - 1) != NULL);
    QVERIFY(fxi.channel(fxi.channels()) == NULL);

    QVERIFY(fxi.channel(QLCChannel::Pan) != QLCChannel::invalid());
    const QLCChannel* ch = fxi.channel(fxi.channel(QLCChannel::Pan));
    QVERIFY(ch != NULL);

    QCOMPARE(fxi.panMsbChannel(), quint32(7));
    QCOMPARE(fxi.tiltMsbChannel(), quint32(9));
    QCOMPARE(fxi.panLsbChannel(), quint32(8));
    QCOMPARE(fxi.tiltLsbChannel(), quint32(10));
    QCOMPARE(fxi.masterIntensityChannel(), quint32(1));
    QCOMPARE(fxi.rgbChannels(), QVector <quint32> ());
    QCOMPARE(fxi.cmyChannels(), QVector <quint32> () << 2 << 3 << 4);
}
开发者ID:PML369,项目名称:qlcplus,代码行数:52,代码来源:fixture_test.cpp

示例8: insertStartValue

void CueStack_Test::insertStartValue()
{
    QList<Universe*> ua;
    ua.append(new Universe(0, new GrandMaster()));
    ua.at(0)->setChannelCapability(0, QLCChannel::Pan);
    CueStack cs(m_doc);
    cs.preRun();

    FadeChannel fc;
    fc.setChannel(0);
    fc.setStart(0);
    fc.setTarget(255);
    fc.setCurrent(127);

    cs.m_fader->add(fc);

    fc.setTarget(64);
    cs.insertStartValue(fc, ua);
    QCOMPARE(fc.start(), uchar(127));
    QCOMPARE(fc.current(), uchar(127));

    cs.m_fader->remove(fc);

    // HTP channel in universes
    ua[0]->write(0, 192);
    cs.insertStartValue(fc, ua);
    QCOMPARE(fc.start(), uchar(0));
    QCOMPARE(fc.current(), uchar(0));

    QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
    QVERIFY(def != NULL);

    QLCFixtureMode* mode = def->modes().first();
    QVERIFY(mode != NULL);

    Fixture* fxi = new Fixture(m_doc);
    fxi->setFixtureDefinition(def, mode);
    fxi->setName("Test Scanner");
    fxi->setAddress(0);
    fxi->setUniverse(0);
    m_doc->addFixture(fxi);

    // LTP channel (Pan) in universes
    ua[0]->write(0, 192);
    cs.insertStartValue(fc, ua);
    QCOMPARE(fc.start(), uchar(192));
    QCOMPARE(fc.current(), uchar(192));

    MasterTimer mt(m_doc);
    cs.postRun(&mt);
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:51,代码来源:cuestack_test.cpp

示例9: group

void FadeChannel_Test::group()
{
    Doc doc(this);

    FadeChannel fc;

    // Only a channel given, no fixture at the address -> intensity
    fc.setChannel(2);
    QCOMPARE(fc.group(&doc), QLCChannel::Intensity);

    Fixture* fxi = new Fixture(&doc);
    fxi->setAddress(10);
    fxi->setChannels(5);
    doc.addFixture(fxi);

    // Fixture and channel given, fixture is a dimmer -> intensity
    fc.setFixture(&doc, fxi->id());
    QCOMPARE(fc.group(&doc), QLCChannel::Intensity);

    QDir dir(INTERNAL_FIXTUREDIR);
    dir.setFilter(QDir::Files);
    dir.setNameFilters(QStringList() << QString("*%1").arg(KExtFixture));
    QVERIFY(doc.fixtureDefCache()->load(dir) == true);

    QLCFixtureDef* def = doc.fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
    QVERIFY(def != NULL);

    QLCFixtureMode* mode = def->modes().first();
    QVERIFY(mode != NULL);

    fxi = new Fixture(&doc);
    fxi->setAddress(0);
    fxi->setFixtureDefinition(def, mode);
    doc.addFixture(fxi);

    // Fixture and channel given, but channel is beyond fixture's channels -> intensity
    fc.setFixture(&doc, fxi->id());
    fc.setChannel(50);
    QCOMPARE(fc.group(&doc), QLCChannel::Intensity);

    // Only a channel given, no fixture given but a fixture occupies the address.
    // Check that reverse address -> fixture lookup works.
    fc.setFixture(&doc, Fixture::invalidId());
    fc.setChannel(2);
    QCOMPARE(fc.group(&doc), QLCChannel::Colour);

    // Fixture and channel given, but fixture doesn't exist -> intensity
    fc.setFixture(&doc, 12345);
    fc.setChannel(2);
    QCOMPARE(fc.group(&doc), QLCChannel::Intensity);
}
开发者ID:basileus,项目名称:qlcplus,代码行数:51,代码来源:fadechannel_test.cpp

示例10: 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

示例11: type

void Fixture_Test::type()
{
    Fixture fxi(this);
    QCOMPARE(fxi.type(), QString(KXMLFixtureDimmer));

    QLCFixtureDef* fixtureDef;
    fixtureDef = m_doc->fixtureDefCache()->fixtureDef("Martin", "MAC250+");
    QVERIFY(fixtureDef != NULL);

    QLCFixtureMode* fixtureMode;
    fixtureMode = fixtureDef->modes().at(0);
    QVERIFY(fixtureMode != NULL);

    fxi.setFixtureDefinition(fixtureDef, fixtureMode);
    QCOMPARE(fxi.type(), fixtureDef->type());
}
开发者ID:PML369,项目名称:qlcplus,代码行数:16,代码来源:fixture_test.cpp

示例12: modeChange

void VCXYPad_Test::modeChange()
{
    //UniverseArray ua(512);
    QWidget w;

    Fixture* fxi = new Fixture(m_doc);
    QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Futurelight", "DJScan250");
    QVERIFY(def != NULL);
    QLCFixtureMode* mode = def->modes().first();
    QVERIFY(mode != NULL);
    fxi->setFixtureDefinition(def, mode);
    m_doc->addFixture(fxi);

    VCXYPad pad(&w, m_doc);
    pad.show();
    w.show();
    pad.resize(QSize(200, 200));

    VCXYPadFixture xy(m_doc);
    xy.setHead(GroupHead(fxi->id(), 0));
    pad.appendFixture(xy);
    QCOMPARE(pad.fixtures().size(), 1);
    QCOMPARE(pad.fixtures()[0].m_xMSB, QLCChannel::invalid());
    QCOMPARE(pad.fixtures()[0].m_xLSB, QLCChannel::invalid());

    m_doc->setMode(Doc::Operate);
    QVERIFY(pad.fixtures()[0].m_xMSB != QLCChannel::invalid());
    QVERIFY(pad.fixtures()[0].m_yMSB != QLCChannel::invalid());
    QCOMPARE(m_doc->masterTimer()->m_dmxSourceList.size(), 1);
    QCOMPARE(m_doc->masterTimer()->m_dmxSourceList[0], &pad);
/*
    // FIXME !!
    pad.m_area->setPosition(QPoint(pad.m_area->width(), pad.m_area->height()));
    pad.writeDMX(m_doc->masterTimer(), &ua);
    QCOMPARE(ua.preGMValues()[0], char(255));
    QCOMPARE(ua.preGMValues()[1], char(255));

    pad.m_area->setPosition(QPoint(pad.m_area->width() / 2, pad.m_area->height() / 4));
    pad.writeDMX(m_doc->masterTimer(), &ua);
    QCOMPARE(ua.preGMValues()[0], char(128));
    QCOMPARE(ua.preGMValues()[1], char(64));
*/
    m_doc->setMode(Doc::Design);
    QCOMPARE(pad.fixtures()[0].m_xMSB, QLCChannel::invalid());
    QCOMPARE(pad.fixtures()[0].m_yMSB, QLCChannel::invalid());
    QCOMPARE(m_doc->masterTimer()->m_dmxSourceList.size(), 0);
}
开发者ID:Babbsdrebbler,项目名称:qlcplus,代码行数:47,代码来源:vcxypad_test.cpp

示例13: modes

void QLCFixtureDef_Test::modes()
{
    QLCFixtureDef* fd = new QLCFixtureDef();
    QLCFixtureMode* mode1 = new QLCFixtureMode(fd);
    QLCFixtureMode* mode2 = new QLCFixtureMode(fd);
    QLCFixtureMode* mode3 = new QLCFixtureMode(fd);

    QVERIFY(fd->modes().size() == 0);
    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);
    fd->addMode(mode3);
    QVERIFY(fd->modes().size() == 3);
    QVERIFY(fd->modes().at(0) == mode1);
    QVERIFY(fd->modes().at(1) == mode2);
    QVERIFY(fd->modes().at(2) == mode3);

    delete fd;
}
开发者ID:Andersbakken,项目名称:qlc-svn,代码行数:23,代码来源:qlcfixturedef_test.cpp

示例14: channels

void Fixture_Test::channels()
{
    Fixture fxi(this);
    QLCFixtureDef* fixtureDef = m_doc->fixtureDefCache()->fixtureDef("i-Pix", "BB4");
    QVERIFY(fixtureDef != NULL);
    QLCFixtureMode* fixtureMode = fixtureDef->modes().last();
    QVERIFY(fixtureMode != NULL);
    fxi.setFixtureDefinition(fixtureDef, fixtureMode);

    QCOMPARE(fxi.channel(QLCChannel::Intensity, QLCChannel::Red), quint32(3));

    QSet <quint32> chs;
    chs << 3 << 4 << 21 << 22 << 12 << 13 << 30 << 31;
    QCOMPARE(chs, fxi.channels(QLCChannel::Intensity, QLCChannel::Red));
    chs.clear();
    chs << 5 << 6 << 23 << 24 << 14 << 15 << 32 << 33;
    QCOMPARE(chs, fxi.channels(QLCChannel::Intensity, QLCChannel::Green));
    chs.clear();
    chs << 7 << 8 << 16 << 17 << 25 << 26 << 34 << 35;
    QCOMPARE(chs, fxi.channels(QLCChannel::Intensity, QLCChannel::Blue));
    chs.clear();
    QCOMPARE(chs, fxi.channels(QLCChannel::Colour, QLCChannel::Blue));
}
开发者ID:PML369,项目名称:qlcplus,代码行数:23,代码来源:fixture_test.cpp

示例15: initialScanner

void AddFixture_Test::initialScanner()
{
    Fixture* fxi = new Fixture(m_doc);
    fxi->setName("My scanner");

    QLCFixtureDef* def = m_doc->fixtureDefCache()->fixtureDef("Martin", "MAC300");
    Q_ASSERT(def != NULL);
    Q_ASSERT(def != NULL);
    Q_ASSERT(def->channels().size() > 0);
    QLCFixtureMode* mode = def->modes().first();
    Q_ASSERT(def->modes().size() > 1);

    fxi->setFixtureDefinition(def, mode);
    fxi->setUniverse(2);
    fxi->setAddress(484);
    m_doc->addFixture(fxi);

    AddFixture af(NULL, m_doc, fxi);
    QVERIFY(m_doc == af.m_doc);
    QVERIFY(af.fixtureDef() == def);
    QVERIFY(af.mode() == mode);
    QVERIFY(af.name() == QString("My scanner"));
    QVERIFY(af.address() == 484);
    QVERIFY(af.universe() == 2);
    QVERIFY(af.amount() == 1);
    QVERIFY(af.gap() == 0);
    QVERIFY(af.channels() == fxi->channels());

    // Check that all makes & models are put to the tree
    QStringList makers(m_doc->fixtureDefCache()->manufacturers());
    QVERIFY(makers.isEmpty() == false);
    for (int i = 0; i < af.m_tree->topLevelItemCount(); i++)
    {
        QTreeWidgetItem* top = af.m_tree->topLevelItem(i);

        if (top->text(0) != KXMLFixtureGeneric)
        {
            QStringList models(m_doc->fixtureDefCache()->models(top->text(0)));
            for (int j = 0; j < top->childCount(); j++)
            {
                QTreeWidgetItem* child = top->child(j);
                QCOMPARE(child->childCount(), 0);
                QCOMPARE(models.removeAll(child->text(0)), 1);
            }

            QCOMPARE(makers.removeAll(top->text(0)), 1);
        }
        else
        {
            QCOMPARE(i, af.m_tree->topLevelItemCount() - 1); // Generic should be last
            QCOMPARE(top->childCount(), 3);
            QCOMPARE(top->child(0)->text(0), QString(KXMLFixtureGeneric));

            QStringList models(m_doc->fixtureDefCache()->models(top->text(0)));
            for (int j = 0; j < top->childCount(); j++)
            {
                QTreeWidgetItem* child = top->child(j);
                QCOMPARE(child->childCount(), 0);
                QCOMPARE(models.removeAll(child->text(0)), child->text(0) == KXMLFixtureGeneric ? 0 : 1);
            }

            QCOMPARE(makers.removeAll(top->text(0)), 1);
        }
    }
    QVERIFY(makers.isEmpty() == true);

    // Generic / Generic should be selected for dimmers
    QVERIFY(af.m_tree->currentItem() != NULL);
    QCOMPARE(af.m_tree->currentItem()->text(0), def->model());
    QVERIFY(af.m_tree->currentItem()->parent() != NULL);
    QCOMPARE(af.m_tree->currentItem()->parent()->text(0), def->manufacturer());

    QVERIFY(af.m_modeCombo->isEnabled() == true);
    QCOMPARE(af.m_modeCombo->count(), def->modes().size());
    QCOMPARE(af.m_modeCombo->itemText(0), mode->name());

    QVERIFY(af.m_universeCombo->isEnabled() == true);
    QCOMPARE(af.m_universeCombo->currentIndex(), 2);
    QCOMPARE(af.m_universeCombo->count(), 4);

    QVERIFY(af.m_addressSpin->isEnabled() == true);
    QCOMPARE(af.m_addressSpin->value(), 485);

    QVERIFY(af.m_channelsSpin->isEnabled() == false);
    QCOMPARE(af.m_channelsSpin->value(), (int) fxi->channels());

    QVERIFY(af.m_nameEdit->isEnabled() == true);
    QCOMPARE(af.m_nameEdit->text(), QString("My scanner"));
    QVERIFY(af.m_nameEdit->isModified() == true);

    QVERIFY(af.m_multipleGroup->isEnabled() == false);
    QVERIFY(af.m_gapSpin->isEnabled() == false);
    QCOMPARE(af.m_gapSpin->value(), 0);

    QVERIFY(af.m_amountSpin->isEnabled() == false);
    QCOMPARE(af.m_amountSpin->value(), 1);
}
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:97,代码来源:addfixture_test.cpp


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