本文整理汇总了C++中QLCChannel::createCopy方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCChannel::createCopy方法的具体用法?C++ QLCChannel::createCopy怎么用?C++ QLCChannel::createCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCChannel
的用法示例。
在下文中一共展示了QLCChannel::createCopy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copy
void QLCChannel_Test::copy()
{
QLCChannel* channel = new QLCChannel();
QVERIFY(channel->capabilities().size() == 0);
channel->setName("Foobar");
channel->setGroup(QLCChannel::Tilt);
channel->setControlByte(QLCChannel::ControlByte(3));
channel->setColour(QLCChannel::Yellow);
QLCCapability* cap1 = new QLCCapability(10, 19, "10-19");
QVERIFY(channel->addCapability(cap1) == true);
QLCCapability* cap2 = new QLCCapability(50, 59, "50-59");
QVERIFY(channel->addCapability(cap2) == true);
QLCCapability* cap3 = new QLCCapability(40, 49, "40-49");
QVERIFY(channel->addCapability(cap3) == true);
QLCCapability* cap4 = new QLCCapability(0, 9, "0-9");
QVERIFY(channel->addCapability(cap4) == true);
QLCCapability* cap5 = new QLCCapability(200, 209, "200-209");
QVERIFY(channel->addCapability(cap5) == true);
QLCCapability* cap6 = new QLCCapability(30, 39, "30-39");
QVERIFY(channel->addCapability(cap6) == true);
QLCCapability* cap7 = new QLCCapability(26, 29, "26-29");
QVERIFY(channel->addCapability(cap7) == true);
QLCCapability* cap8 = new QLCCapability(20, 25, "20-25");
QVERIFY(channel->addCapability(cap8) == true);
/* Create a copy of the original channel */
QLCChannel* copy = channel->createCopy();
QVERIFY(copy->name() == "Foobar");
QVERIFY(copy->group() == QLCChannel::Tilt);
QVERIFY(copy->controlByte() == QLCChannel::ControlByte(3));
QVERIFY(copy->colour() == QLCChannel::Yellow);
/* Verify that the capabilities in the copied channel are also
copies i.e. their pointers are not the same as the originals. */
QList <QLCCapability*> caps(copy->capabilities());
QVERIFY(caps.size() == 8);
QVERIFY(caps.at(0) != cap1);
QVERIFY(caps.at(0)->name() == cap1->name());
QVERIFY(caps.at(0)->min() == cap1->min());
QVERIFY(caps.at(0)->max() == cap1->max());
QVERIFY(caps.at(1) != cap2);
QVERIFY(caps.at(1)->name() == cap2->name());
QVERIFY(caps.at(1)->min() == cap2->min());
QVERIFY(caps.at(1)->max() == cap2->max());
QVERIFY(caps.at(2) != cap3);
QVERIFY(caps.at(2)->name() == cap3->name());
QVERIFY(caps.at(2)->min() == cap3->min());
QVERIFY(caps.at(2)->max() == cap3->max());
QVERIFY(caps.at(3) != cap4);
QVERIFY(caps.at(3)->name() == cap4->name());
QVERIFY(caps.at(3)->min() == cap4->min());
QVERIFY(caps.at(3)->max() == cap4->max());
QVERIFY(caps.at(4) != cap5);
QVERIFY(caps.at(4)->name() == cap5->name());
QVERIFY(caps.at(4)->min() == cap5->min());
QVERIFY(caps.at(4)->max() == cap5->max());
QVERIFY(caps.at(5) != cap6);
QVERIFY(caps.at(5)->name() == cap6->name());
QVERIFY(caps.at(5)->min() == cap6->min());
QVERIFY(caps.at(5)->max() == cap6->max());
QVERIFY(caps.at(6) != cap7);
QVERIFY(caps.at(6)->name() == cap7->name());
QVERIFY(caps.at(6)->min() == cap7->min());
QVERIFY(caps.at(6)->max() == cap7->max());
QVERIFY(caps.at(7) != cap8);
QVERIFY(caps.at(7)->name() == cap8->name());
QVERIFY(caps.at(7)->min() == cap8->min());
QVERIFY(caps.at(7)->max() == cap8->max());
}