Пример #1
0
void LedTests::copyConstructor() {
    QFETCH(Position, position);
    QFETCH(int, number);

    Led* led = new Led(iAnimation,
                  *iAnimation,
                  number,
                  position,
                  NULL);

    Led* copyLed = new Led(*led);

    QCOMPARE(copyLed->position(), led->position());
    QCOMPARE(copyLed->number(), led->number());

    // TODO add axis tests
}
Пример #2
0
void AxisDetailsWidget::addLed(int row, int column) {
    Led* led = iAnimation.ledAt(Position(row, column));

    if(led == NULL) {
        throw IllegalArgumentException("AnimationDetailsWidget::addLed : NULL led");
    }

    if(!iLedDetails.contains(led->number())) {
        int count = iLedDetails.count();
        qDebug("add new led, %d, %d", row, column);

        QLabel* ledNumberLabel = new QLabel(this);
        ledNumberLabel->setMaximumWidth(LED_LABEL_WIDTH);
        ledNumberLabel->setMinimumWidth(LED_LABEL_WIDTH);

        FrameListWidget* framesListWidget = new FrameListWidget(this, axisData(*led), *this);//, count);
        QToolButton* closeButton = new QToolButton(this);
        closeButton->setObjectName(QString::fromUtf8("detailsClose"));
        closeButton->setIcon(QIcon(":/images/delete.png"));

        iGridLayout->addWidget(closeButton, count, 0);
        iGridLayout->addWidget(ledNumberLabel, count, 1);
        iGridLayout->addWidget(framesListWidget, count, 2);
       // iGridLayout->setColumnStretch(1, 1);
       // iGridLayout->addWidget(new QWidget(), count, 3);
       // iGridLayout->setColumnStretch(3, 2);

        iLedDetails.insert(led->number(), new LedDetails(*this,
                                                         *led,
                                                         *ledNumberLabel,
                                                         *framesListWidget,
                                                         *closeButton));

        iCloseAll->setEnabled(true);
        iScrollAreaWidgetContents->setShowCurrentFrameLine(true);

        doResize();
        layout()->invalidate();
    }
}
Пример #3
0
void LedTests::constructor() {
    QFETCH(Position, position);
    QFETCH(int, number);
    QFETCH(QString, error);

    try {
        Led* led = new Led(iAnimation,
                      *iAnimation,
                      number,
                      position,
                      NULL);

        QCOMPARE(led->position(), position);
        QCOMPARE(led->number(), number);

    } catch(IllegalArgumentException& e){
        QCOMPARE(e.errorMessage(), error);

        return;
    }
}