void QLCFixtureDef_Test::type() { QLCFixtureDef* fd = new QLCFixtureDef(); fd->setType("Scanner"); QVERIFY(fd->type() == "Scanner"); delete fd; }
void AddFixture::fillTree() { QPtrListIterator <QLCFixtureDef> it(*_app->fixtureDefList()); QLCFixtureDef* fixtureDef = NULL; QListViewItem* parent = NULL; QListViewItem* node = NULL; QString str; /* Clear the tree of any previous data */ m_tree->clear(); /* Add all known fixture definitions. */ while ( (fixtureDef = *it) != NULL ) { parent = NULL; /* Search for an existing manufacturer parent node from the tree. If such is found, it will be used as the parent for the current fixture. If not, the manufacturer will be added as a new parent and then used for the current fixture. */ for (node = m_tree->firstChild(); node != NULL; node = node->nextSibling()) { if (node->text(KColumnName) == fixtureDef->manufacturer()) { parent = node; break; } } /* If an existing manufacturer parent node was not found, we must create one. Otherwise we use the found node as the parent for the new item. */ if (parent == NULL) parent = new QListViewItem(m_tree, fixtureDef->manufacturer()); /* Create a new fixture node, under the parent node */ node = new QListViewItem(parent); node->setText(KColumnName, fixtureDef->model()); node->setText(KColumnType, fixtureDef->type()); /* Store the fixture pointer into the tree */ str.sprintf("%d", (unsigned long) fixtureDef); node->setText(KColumnPointer, str); ++it; } /* Create a node & parent for generic dimmers */ parent = new QListViewItem(m_tree); parent->setText(KColumnName, KXMLFixtureGeneric); node = new QListViewItem(parent); node->setText(KColumnName, KXMLFixtureGeneric); node->setText(KColumnType, KXMLFixtureDimmer); node->setText(KColumnPointer, "0"); }
void QLCFixtureDef_Test::initial() { QLCFixtureDef* fd = new QLCFixtureDef(); QVERIFY(fd->manufacturer().isEmpty()); QVERIFY(fd->model().isEmpty()); QVERIFY(fd->name() == " "); QVERIFY(fd->type() == "Dimmer"); delete fd; }
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()); }
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; }