void QLCFixtureHead_Test::load() { QBuffer buffer; buffer.open(QIODevice::WriteOnly | QIODevice::Text); QXmlStreamWriter xmlWriter(&buffer); xmlWriter.writeStartElement("Head"); xmlWriter.writeTextElement("Channel", "0"); xmlWriter.writeTextElement("Channel", "1"); xmlWriter.writeTextElement("Channel", "15"); xmlWriter.writeTextElement("Foo", "25"); xmlWriter.writeTextElement("Channel", "42"); xmlWriter.writeEndDocument(); xmlWriter.setDevice(NULL); buffer.close(); buffer.open(QIODevice::ReadOnly | QIODevice::Text); QXmlStreamReader xmlReader(&buffer); xmlReader.readNextStartElement(); QLCFixtureHead head; QVERIFY(head.loadXML(xmlReader)); QCOMPARE(head.channels().size(), 4); QVERIFY(head.channels().contains(0)); QVERIFY(head.channels().contains(1)); QVERIFY(head.channels().contains(15)); QVERIFY(head.channels().contains(42)); }
bool QLCFixtureMode::loadXML(const QDomElement& root) { if (root.tagName() != KXMLQLCFixtureMode) { qWarning() << Q_FUNC_INFO << "Mode tag not found"; return false; } /* Mode name */ QString str = root.attribute(KXMLQLCFixtureModeName); if (str.isEmpty() == true) { qWarning() << Q_FUNC_INFO << "Mode has no name"; return false; } else { setName(str); } /* Subtags */ QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCFixtureModeChannel) { /* Channel */ Q_ASSERT(m_fixtureDef != NULL); str = tag.attribute(KXMLQLCFixtureModeChannelNumber); insertChannel(m_fixtureDef->channel(tag.text()), str.toInt()); } else if (tag.tagName() == KXMLQLCFixtureHead) { /* Head */ QLCFixtureHead head; if (head.loadXML(tag) == true) insertHead(-1, head); } else if (tag.tagName() == KXMLQLCPhysical) { /* Physical */ QLCPhysical physical; physical.loadXML(tag); setPhysical(physical); } else { qWarning() << Q_FUNC_INFO << "Unknown Fixture Mode tag:" << tag.tagName(); } node = node.nextSibling(); } // Cache all head channels cacheHeads(); return true; }
QLCFixtureMode *Fixture::genericDimmerMode(QLCFixtureDef *def, int channels) { Q_ASSERT(def != NULL); QLCFixtureMode *mode = new QLCFixtureMode(def); mode->setName(QString("%1 Channel").arg(channels)); QList<QLCChannel *>chList = def->channels(); for (int i = 0; i < chList.count(); i++) { QLCChannel *ch = chList.at(i); mode->insertChannel(ch, i); QLCFixtureHead head; head.addChannel(i); mode->insertHead(-1, head); } QLCPhysical physical; physical.setWidth(300 * channels); physical.setHeight(300); physical.setDepth(300); mode->setPhysical(physical); def->addMode(mode); return mode; }
bool QLCFixtureMode::loadXML(QXmlStreamReader &doc) { if (doc.name() != KXMLQLCFixtureMode) { qWarning() << Q_FUNC_INFO << "Mode tag not found"; return false; } /* Mode name */ QString str = doc.attributes().value(KXMLQLCFixtureModeName).toString(); if (str.isEmpty() == true) { qWarning() << Q_FUNC_INFO << "Mode has no name"; return false; } else { setName(str); } /* Subtags */ while (doc.readNextStartElement()) { if (doc.name() == KXMLQLCFixtureModeChannel) { /* Channel */ Q_ASSERT(m_fixtureDef != NULL); str = doc.attributes().value(KXMLQLCFixtureModeChannelNumber).toString(); insertChannel(m_fixtureDef->channel(doc.readElementText()), str.toInt()); } else if (doc.name() == KXMLQLCFixtureHead) { /* Head */ QLCFixtureHead head; if (head.loadXML(doc) == true) insertHead(-1, head); } else if (doc.name() == KXMLQLCPhysical) { /* Physical */ QLCPhysical physical; physical.loadXML(doc); setPhysical(physical); } else { qWarning() << Q_FUNC_INFO << "Unknown Fixture Mode tag:" << doc.name(); doc.skipCurrentElement(); } } // Cache all head channels cacheHeads(); return true; }
QLCFixtureMode *Fixture::genericRGBPanelMode(QLCFixtureDef *def, Components components, quint32 width, quint32 height) { Q_ASSERT(def != NULL); QLCFixtureMode *mode = new QLCFixtureMode(def); int compNum = 3; if (components == BGR) { mode->setName("BGR"); } else if (components == RGBW) { mode->setName("RGBW"); compNum = 4; } else if (components == RGBWW) { mode->setName("RGBWW"); compNum = 5; } else mode->setName("RGB"); QList<QLCChannel *>channels = def->channels(); for (int i = 0; i < channels.count(); i++) { QLCChannel *ch = channels.at(i); mode->insertChannel(ch, i); if (i%compNum == 0) { QLCFixtureHead head; head.addChannel(i); head.addChannel(i+1); head.addChannel(i+2); if (components == RGBW) head.addChannel(i+3); else if (components == RGBWW) { head.addChannel(i+3); head.addChannel(i+4); } mode->insertHead(-1, head); } } QLCPhysical physical; physical.setWidth(width); physical.setHeight(height); physical.setDepth(height); mode->setPhysical(physical); return mode; }
void QLCFixtureHead_Test::save() { QLCFixtureHead head; head.addChannel(0); head.addChannel(1); head.addChannel(2); head.addChannel(3); QBuffer buffer; buffer.open(QIODevice::WriteOnly | QIODevice::Text); QXmlStreamWriter xmlWriter(&buffer); QVERIFY(head.saveXML(&xmlWriter)); xmlWriter.setDevice(NULL); buffer.close(); buffer.open(QIODevice::ReadOnly | QIODevice::Text); QXmlStreamReader xmlReader(&buffer); xmlReader.readNextStartElement(); QCOMPARE(xmlReader.name().toString(), QString("Head")); int ch = 0; while (xmlReader.readNextStartElement()) { if (xmlReader.name() == "Channel") { QString chNum = xmlReader.readElementText(); QVERIFY(chNum.toInt() == 0 || chNum.toInt() == 1 || chNum.toInt() == 2 || chNum.toInt() == 3); ch++; } else { QFAIL(QString("Unexpected tag: %1").arg(xmlReader.name().toString()).toUtf8().constData()); xmlReader.skipCurrentElement(); } } QCOMPARE(ch, 4); }
void Fixture::setFixtureDefinition(QLCFixtureDef* fixtureDef, QLCFixtureMode* fixtureMode) { if (fixtureDef != NULL && fixtureMode != NULL) { if (m_fixtureDef != NULL && m_fixtureDef != fixtureDef && m_fixtureDef->manufacturer() == KXMLFixtureGeneric && m_fixtureDef->model() == KXMLFixtureGeneric) { delete m_fixtureDef; } m_fixtureDef = fixtureDef; m_fixtureMode = fixtureMode; // If there are no head entries in the mode, create one that contains // all channels. This const_cast is a bit heretic, but it's easier this // way, than to change everything def & mode related non-const, which would // be worse than one constness violation here. if (fixtureMode->heads().size() == 0) { QLCFixtureHead head; for (int i = 0; i < fixtureMode->channels().size(); i++) head.addChannel(i); fixtureMode->insertHead(-1, head); } m_values.resize(fixtureMode->channels().size()); m_values.fill(0); // Cache all head channels fixtureMode->cacheHeads(); } else { m_fixtureDef = NULL; m_fixtureMode = NULL; } emit changed(m_id); }
void QLCFixtureHead_Test::cacheChannelsColor() { QLCFixtureMode mode(m_fixtureDef); QCOMPARE(mode.channels().size(), 0); m_ch1->setGroup(QLCChannel::Pan); m_ch1->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch1, 0); m_ch2->setGroup(QLCChannel::Colour); m_ch2->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch2, 1); m_ch3->setGroup(QLCChannel::Tilt); m_ch3->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch3, 2); m_ch4->setGroup(QLCChannel::Colour); m_ch4->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch4, 3); QLCFixtureHead head; head.addChannel(0); head.addChannel(1); head.addChannel(2); head.addChannel(3); head.cacheChannels(&mode); QCOMPARE(quint32(head.colorWheels().count()), quint32(2)); QCOMPARE(head.colorWheels().at(0), quint32(1)); QCOMPARE(head.colorWheels().at(1), quint32(3)); }
void Fixture::setFixtureDefinition(const QLCFixtureDef* fixtureDef, const QLCFixtureMode* fixtureMode) { if (fixtureDef != NULL && fixtureMode != NULL) { m_fixtureDef = fixtureDef; m_fixtureMode = fixtureMode; // If there are no head entries in the mode, create one that contains // all channels. This const_cast is a bit heretic, but it's easier this // way, than to change everything def & mode related non-const, which would // be worse than one constness violation here. QLCFixtureMode* mode = const_cast<QLCFixtureMode*> (fixtureMode); if (mode->heads().size() == 0) { QLCFixtureHead head; for (int i = 0; i < mode->channels().size(); i++) head.addChannel(i); mode->insertHead(-1, head); } // Cache all head channels mode->cacheHeads(); if (m_genericChannel != NULL) delete m_genericChannel; m_genericChannel = NULL; } else { m_fixtureDef = NULL; m_fixtureMode = NULL; createGenericChannel(); } emit changed(m_id); }
void EditMode::refreshHeadList() { m_headList->clear(); for (int i = 0; i < m_mode->heads().size(); i++) { QTreeWidgetItem* item = new QTreeWidgetItem(m_headList); QLCFixtureHead head = m_mode->heads().at(i); QList <quint32> channels(head.channels()); qSort(channels.begin(), channels.end()); QString summary; QListIterator <quint32> it(channels); while (it.hasNext() == true) { quint32 chnum = it.next(); const QLCChannel* ch = m_mode->channel(chnum); QTreeWidgetItem* chitem = new QTreeWidgetItem(item); if (ch != NULL) chitem->setText(0, QString("%1: %2").arg(chnum + 1).arg(ch->name())); else chitem->setText(0, QString("%1: INVALID!")); chitem->setFlags(0); // Disable channel selection inside heads summary += QString::number(chnum + 1); if (it.hasNext() == true) summary += QString(", "); } item->setText(0, QString("Head %1 (%2)").arg(i + 1).arg(summary)); } m_headList->resizeColumnToContents(0); }
void QLCFixtureHead_Test::doublePanTilt() { // Test that the first found Pan/Tilt channel is used // - for the case the user forgets to set the latter to LSB // - in most cases the Pan MSB channel comes first QLCFixtureMode mode(m_fixtureDef); QCOMPARE(mode.channels().size(), 0); m_ch1->setGroup(QLCChannel::Pan); m_ch1->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch1, 0); m_ch2->setGroup(QLCChannel::Pan); m_ch2->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch2, 1); m_ch3->setGroup(QLCChannel::Tilt); m_ch3->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch3, 2); m_ch4->setGroup(QLCChannel::Tilt); m_ch4->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch4, 3); QLCFixtureHead head; head.addChannel(0); head.addChannel(1); head.addChannel(2); head.addChannel(3); head.cacheChannels(&mode); QCOMPARE(head.panMsbChannel(), quint32(0)); QCOMPARE(head.panLsbChannel(), QLCChannel::invalid()); QCOMPARE(head.tiltMsbChannel(), quint32(2)); QCOMPARE(head.tiltLsbChannel(), QLCChannel::invalid()); }
void RGBMatrix::updateMapChannels(const RGBMap& map, const FixtureGroup* grp) { quint32 mdAssigned = QLCChannel::invalid(); quint32 mdFxi = Fixture::invalidId(); uint fadeTime = 0; if (overrideFadeInSpeed() == defaultSpeed()) fadeTime = fadeInSpeed(); else fadeTime = overrideFadeInSpeed(); // Create/modify fade channels for ALL pixels in the color map. for (int y = 0; y < map.size(); y++) { for (int x = 0; x < map[y].size(); x++) { QLCPoint pt(x, y); GroupHead grpHead(grp->head(pt)); Fixture* fxi = doc()->fixture(grpHead.fxi); if (fxi == NULL) continue; if (grpHead.fxi != mdFxi) { mdAssigned = QLCChannel::invalid(); mdFxi = grpHead.fxi; } QLCFixtureHead head = fxi->head(grpHead.head); QVector <quint32> rgb = head.rgbChannels(); QVector <quint32> cmy = head.cmyChannels(); if (rgb.size() == 3) { // RGB color mixing FadeChannel fc; fc.setFixture(doc(), grpHead.fxi); fc.setChannel(rgb.at(0)); fc.setTarget(qRed(map[y][x])); insertStartValues(fc, fadeTime); m_fader->add(fc); fc.setChannel(rgb.at(1)); fc.setTarget(qGreen(map[y][x])); insertStartValues(fc, fadeTime); m_fader->add(fc); fc.setChannel(rgb.at(2)); fc.setTarget(qBlue(map[y][x])); insertStartValues(fc, fadeTime); m_fader->add(fc); } else if (cmy.size() == 3) { // CMY color mixing QColor col(map[y][x]); FadeChannel fc; fc.setFixture(doc(), grpHead.fxi); fc.setChannel(cmy.at(0)); fc.setTarget(col.cyan()); insertStartValues(fc, fadeTime); m_fader->add(fc); fc.setChannel(cmy.at(1)); fc.setTarget(col.magenta()); insertStartValues(fc, fadeTime); m_fader->add(fc); fc.setChannel(cmy.at(2)); fc.setTarget(col.yellow()); insertStartValues(fc, fadeTime); m_fader->add(fc); } if (m_dimmerControl && head.masterIntensityChannel() != QLCChannel::invalid()) { //qDebug() << "RGBMatrix: found dimmer at" << head.masterIntensityChannel(); // Simple intensity (dimmer) channel QColor col(map[y][x]); FadeChannel fc; fc.setFixture(doc(), grpHead.fxi); fc.setChannel(head.masterIntensityChannel()); if (col.value() == 0 && mdAssigned != head.masterIntensityChannel()) fc.setTarget(0); else { fc.setTarget(255); if (mdAssigned == QLCChannel::invalid()) mdAssigned = head.masterIntensityChannel(); } insertStartValues(fc, fadeTime); m_fader->add(fc); } } } }
void QLCFixtureMode_Test::copy() { QLCFixtureMode* mode = new QLCFixtureMode(m_fixtureDef); mode->setName("Test Mode"); mode->insertChannel(m_ch1, 0); mode->insertChannel(m_ch2, 1); mode->insertChannel(m_ch3, 2); mode->insertChannel(m_ch4, 3); QLCFixtureHead head; head.addChannel(0); head.addChannel(1); head.addChannel(2); mode->insertHead(-1, head); /* Create a copy of the mode to the same fixtureDef as the original */ QLCFixtureMode* copy = new QLCFixtureMode(m_fixtureDef, mode); QVERIFY(copy != NULL); QVERIFY(copy->name() == "Test Mode"); QVERIFY(copy->channels().size() == 4); QVERIFY(copy->channel(0) == m_ch1); QVERIFY(copy->channel(1) == m_ch2); QVERIFY(copy->channel(2) == m_ch3); QVERIFY(copy->channel(3) == m_ch4); QCOMPARE(copy->heads().size(), 1); QVERIFY(copy->heads().at(0).channels().contains(0) == true); QVERIFY(copy->heads().at(0).channels().contains(1) == true); QVERIFY(copy->heads().at(0).channels().contains(2) == true); delete copy; copy = NULL; /* Create another fixture def with some channels matching, some not */ QLCFixtureDef* anotherDef = new QLCFixtureDef(); QLCChannel* ch1 = new QLCChannel(); ch1->setName("Channel 1"); // Should match anotherDef->addChannel(ch1); QLCChannel* ch2 = new QLCChannel(); ch2->setName("Channel 2, not the same name"); // Shouldn't match anotherDef->addChannel(ch2); QLCChannel* ch3 = new QLCChannel(); ch3->setName("Channel 3, still not the same name"); // Shouldn't match anotherDef->addChannel(ch3); QLCChannel* ch4 = new QLCChannel(); ch4->setName("Channel 4"); // Should match anotherDef->addChannel(ch4); QLCChannel* ch5 = new QLCChannel(); ch5->setName("Channel 5"); // Shouldn't match since original has 4 chans anotherDef->addChannel(ch5); /* Create a copy of the mode to the other fixtureDef */ copy = new QLCFixtureMode(anotherDef, mode); QVERIFY(copy->name() == "Test Mode"); QVERIFY(copy->channels().size() == 2); QVERIFY(copy->channel(0)->name() == "Channel 1"); QVERIFY(copy->channel(0) == ch1); QVERIFY(copy->channel(1)->name() == "Channel 4"); QVERIFY(copy->channel(1) == ch4); delete copy; delete anotherDef; }
void QLCFixtureMode_Test::heads() { QLCFixtureMode* mode = new QLCFixtureMode(m_fixtureDef); QLCFixtureHead head; head.addChannel(0); head.addChannel(10); head.addChannel(20); mode->insertHead(-1, head); QCOMPARE(mode->heads().size(), 1); QVERIFY(mode->m_heads[0].m_channels.contains(0) == true); QVERIFY(mode->m_heads[0].m_channels.contains(10) == true); QVERIFY(mode->m_heads[0].m_channels.contains(20) == true); QLCFixtureHead head2; head2.addChannel(1); head2.addChannel(2); mode->insertHead(10, head2); QCOMPARE(mode->heads().size(), 2); QVERIFY(mode->m_heads[0].m_channels.contains(0) == true); QVERIFY(mode->m_heads[0].m_channels.contains(10) == true); QVERIFY(mode->m_heads[0].m_channels.contains(20) == true); QVERIFY(mode->m_heads[1].m_channels.contains(0) == false); QVERIFY(mode->m_heads[1].m_channels.contains(1) == true); QVERIFY(mode->m_heads[1].m_channels.contains(2) == true); QLCFixtureHead head3; head3.addChannel(3); head3.addChannel(4); mode->insertHead(1, head3); QCOMPARE(mode->heads().size(), 3); QVERIFY(mode->m_heads[0].m_channels.contains(0) == true); QVERIFY(mode->m_heads[0].m_channels.contains(10) == true); QVERIFY(mode->m_heads[0].m_channels.contains(20) == true); QVERIFY(mode->m_heads[1].m_channels.contains(3) == true); QVERIFY(mode->m_heads[1].m_channels.contains(4) == true); QVERIFY(mode->m_heads[2].m_channels.contains(1) == true); QVERIFY(mode->m_heads[2].m_channels.contains(2) == true); QLCFixtureHead head4; head4.addChannel(15); head4.addChannel(16); mode->replaceHead(4, head4); QCOMPARE(mode->heads().size(), 3); QVERIFY(mode->m_heads[0].m_channels.contains(0) == true); QVERIFY(mode->m_heads[0].m_channels.contains(10) == true); QVERIFY(mode->m_heads[0].m_channels.contains(20) == true); QVERIFY(mode->m_heads[1].m_channels.contains(3) == true); QVERIFY(mode->m_heads[1].m_channels.contains(4) == true); QVERIFY(mode->m_heads[2].m_channels.contains(1) == true); QVERIFY(mode->m_heads[2].m_channels.contains(2) == true); mode->replaceHead(2, head4); QCOMPARE(mode->heads().size(), 3); QVERIFY(mode->m_heads[0].m_channels.contains(0) == true); QVERIFY(mode->m_heads[0].m_channels.contains(10) == true); QVERIFY(mode->m_heads[0].m_channels.contains(20) == true); QVERIFY(mode->m_heads[1].m_channels.contains(3) == true); QVERIFY(mode->m_heads[1].m_channels.contains(4) == true); QVERIFY(mode->m_heads[2].m_channels.contains(15) == true); QVERIFY(mode->m_heads[2].m_channels.contains(16) == true); mode->removeHead(15); QCOMPARE(mode->heads().size(), 3); mode->removeHead(1); QCOMPARE(mode->heads().size(), 2); QVERIFY(mode->m_heads[0].m_channels.contains(0) == true); QVERIFY(mode->m_heads[0].m_channels.contains(10) == true); QVERIFY(mode->m_heads[0].m_channels.contains(20) == true); QVERIFY(mode->m_heads[1].m_channels.contains(15) == true); QVERIFY(mode->m_heads[1].m_channels.contains(16) == true); mode->removeHead(0); QCOMPARE(mode->heads().size(), 1); QVERIFY(mode->m_heads[0].m_channels.contains(15) == true); QVERIFY(mode->m_heads[0].m_channels.contains(16) == true); mode->removeHead(0); QCOMPARE(mode->heads().size(), 0); delete mode; }
void RGBMatrix::updateMapChannels(const RGBMap& map, const FixtureGroup* grp) { uint fadeTime = (overrideFadeInSpeed() == defaultSpeed()) ? fadeInSpeed() : overrideFadeInSpeed(); // Create/modify fade channels for ALL pixels in the color map. for (int y = 0; y < map.size(); y++) { for (int x = 0; x < map[y].size(); x++) { QLCPoint pt(x, y); GroupHead grpHead(grp->head(pt)); Fixture* fxi = doc()->fixture(grpHead.fxi); if (fxi == NULL) continue; QLCFixtureHead head = fxi->head(grpHead.head); QVector <quint32> rgb = head.rgbChannels(); QVector <quint32> cmy = head.cmyChannels(); quint32 masterDim = fxi->masterIntensityChannel(); quint32 headDim = head.channelNumber(QLCChannel::Intensity, QLCChannel::MSB); // Collect all dimmers that affect current head: // They are the master dimmer (affects whole fixture) // and per-head dimmer. // // If there are no RGB or CMY channels, the least important* dimmer channel // is used to create grayscale image. // // The rest of the dimmer channels are set to full if dimmer control is // enabled and target color is > 0 (see // http://www.qlcplus.org/forum/viewtopic.php?f=29&t=11090) // // Note: If there is only one head, and only one dimmer channel, // make it a master dimmer in fixture definition. // // *least important - per head dimmer if present, // otherwise per fixture dimmer if present QVector <quint32> dim; if (masterDim != QLCChannel::invalid()) dim << masterDim; if (headDim != QLCChannel::invalid()) dim << headDim; uint col = map[y][x]; if (rgb.size() == 3) { // RGB color mixing { FadeChannel fc(doc(), grpHead.fxi, rgb.at(0)); fc.setTarget(qRed(col)); insertStartValues(fc, fadeTime); m_fader->add(fc); } { FadeChannel fc(doc(), grpHead.fxi, rgb.at(1)); fc.setTarget(qGreen(col)); insertStartValues(fc, fadeTime); m_fader->add(fc); } { FadeChannel fc(doc(), grpHead.fxi, rgb.at(2)); fc.setTarget(qBlue(col)); insertStartValues(fc, fadeTime); m_fader->add(fc); } } else if (cmy.size() == 3) { // CMY color mixing QColor cmyCol(col); { FadeChannel fc(doc(), grpHead.fxi, cmy.at(0)); fc.setTarget(cmyCol.cyan()); insertStartValues(fc, fadeTime); m_fader->add(fc); } { FadeChannel fc(doc(), grpHead.fxi, cmy.at(1)); fc.setTarget(cmyCol.magenta()); insertStartValues(fc, fadeTime); m_fader->add(fc); } { FadeChannel fc(doc(), grpHead.fxi, cmy.at(2)); fc.setTarget(cmyCol.yellow()); insertStartValues(fc, fadeTime); m_fader->add(fc); } } else if (!dim.empty()) { // Set dimmer to value of the color (e.g. for PARs) FadeChannel fc(doc(), grpHead.fxi, dim.last()); // the weights are taken from // https://en.wikipedia.org/wiki/YUV#SDTV_with_BT.601 fc.setTarget(0.299 * qRed(col) + 0.587 * qGreen(col) + 0.114 * qBlue(col)); insertStartValues(fc, fadeTime); m_fader->add(fc); dim.pop_back(); } if (m_dimmerControl) { // Set the rest of the dimmer channels to full on foreach(quint32 ch, dim) { FadeChannel fc(doc(), grpHead.fxi, ch); fc.setTarget(col == 0 ? 0 : 255); insertStartValues(fc, fadeTime); m_fader->add(fc); } } } }
void QLCFixtureHead_Test::cacheChannelsPanTilt() { QLCFixtureMode mode(m_fixtureDef); QCOMPARE(mode.channels().size(), 0); m_ch1->setGroup(QLCChannel::Pan); m_ch1->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch1, 0); m_ch2->setGroup(QLCChannel::Pan); m_ch2->setControlByte(QLCChannel::LSB); mode.insertChannel(m_ch2, 1); m_ch3->setGroup(QLCChannel::Tilt); m_ch3->setControlByte(QLCChannel::MSB); mode.insertChannel(m_ch3, 2); m_ch4->setGroup(QLCChannel::Tilt); m_ch4->setControlByte(QLCChannel::LSB); mode.insertChannel(m_ch4, 3); QLCFixtureHead head; head.addChannel(0); head.addChannel(1); head.addChannel(2); head.addChannel(3); head.cacheChannels(&mode); QCOMPARE(head.panMsbChannel(), quint32(0)); QCOMPARE(head.panLsbChannel(), quint32(1)); QCOMPARE(head.tiltMsbChannel(), quint32(2)); QCOMPARE(head.tiltLsbChannel(), quint32(3)); QCOMPARE(head.rgbChannels(), QVector <quint32> ()); QCOMPARE(head.cmyChannels(), QVector <quint32> ()); QCOMPARE(head.masterIntensityChannel(), QLCChannel::invalid()); head.cacheChannels((QLCFixtureMode*) 0xDEADBEEF); QCOMPARE(head.panMsbChannel(), quint32(0)); QCOMPARE(head.panLsbChannel(), quint32(1)); QCOMPARE(head.tiltMsbChannel(), quint32(2)); QCOMPARE(head.tiltLsbChannel(), quint32(3)); QCOMPARE(head.rgbChannels(), QVector <quint32> ()); QCOMPARE(head.cmyChannels(), QVector <quint32> ()); QCOMPARE(head.masterIntensityChannel(), QLCChannel::invalid()); }
void QLCFixtureHead_Test::cacheChannelsCmyMaster() { QLCFixtureMode mode(m_fixtureDef); QCOMPARE(mode.channels().size(), 0); m_ch1->setGroup(QLCChannel::Intensity); m_ch1->setColour(QLCChannel::Cyan); mode.insertChannel(m_ch1, 0); m_ch2->setGroup(QLCChannel::Intensity); m_ch2->setColour(QLCChannel::Magenta); mode.insertChannel(m_ch2, 1); m_ch3->setGroup(QLCChannel::Intensity); m_ch3->setColour(QLCChannel::NoColour); mode.insertChannel(m_ch3, 2); m_ch4->setGroup(QLCChannel::Intensity); m_ch4->setColour(QLCChannel::Yellow); mode.insertChannel(m_ch4, 3); QLCFixtureHead head; head.addChannel(0); head.addChannel(1); head.addChannel(2); head.addChannel(3); head.cacheChannels(&mode); QCOMPARE(head.panMsbChannel(), QLCChannel::invalid()); QCOMPARE(head.panLsbChannel(), QLCChannel::invalid()); QCOMPARE(head.tiltMsbChannel(), QLCChannel::invalid()); QCOMPARE(head.tiltLsbChannel(), QLCChannel::invalid()); QCOMPARE(head.rgbChannels(), QVector <quint32> ()); QCOMPARE(head.cmyChannels(), QVector <quint32> () << 0 << 1 << 3); QCOMPARE(head.masterIntensityChannel(), quint32(2)); }
void QLCFixtureHead_Test::channels() { QLCFixtureHead head; QCOMPARE(head.channels().size(), 0); head.addChannel(0); QCOMPARE(head.channels().size(), 1); QCOMPARE(head.channels().contains(0), true); head.addChannel(0); QCOMPARE(head.channels().size(), 1); QCOMPARE(head.channels().contains(0), true); head.addChannel(5000); QCOMPARE(head.channels().size(), 2); QCOMPARE(head.channels().contains(0), true); QCOMPARE(head.channels().contains(5000), true); head.removeChannel(1); QCOMPARE(head.channels().size(), 2); QCOMPARE(head.channels().contains(0), true); QCOMPARE(head.channels().contains(5000), true); head.removeChannel(0); QCOMPARE(head.channels().size(), 1); QCOMPARE(head.channels().contains(5000), true); head.removeChannel(5000); QCOMPARE(head.channels().size(), 0); }