void ImportACEFileFiller::commonScenario() {
    GTGlobals::sleep(500);
    QWidget* dialog = QApplication::activeModalWidget();
    GT_CHECK(dialog, "activeModalWidget is NULL");

    if (isReadOnly) {
        QRadioButton* rb = GTWidget::findExactWidget<QRadioButton*>(os, "0_radio", dialog);
        CHECK_SET_ERR(rb != NULL, "Radio Button not found");
        GTRadioButton::click(os, rb);
        GTGlobals::sleep();
    } else {
        QRadioButton* rb = GTWidget::findExactWidget<QRadioButton*>(os, "1_radio", dialog);
        CHECK_SET_ERR(rb != NULL, "Radio Button not found");
        GTRadioButton::click(os, rb);
        GTGlobals::sleep();

        if (!sourceUrl.isEmpty()) {
            GTLineEdit::setText(os, "sourseLineEdit", sourceUrl, QApplication::activeModalWidget());
        }

        if (!destinationUrl.isEmpty()) {
            GTLineEdit::setText(os, "fileNameEdit", destinationUrl, QApplication::activeModalWidget(), dialog);
        }
    }

    GTUtilsDialog::clickButtonBox(os, dialog, QDialogButtonBox::Ok);
}
void GTUtilsMSAEditorSequenceArea::checkSelectedRect(HI::GUITestOpStatus &os, const QRect &expectedRect)
{
    MSAEditorSequenceArea *msaEditArea = qobject_cast<MSAEditorSequenceArea*>(GTWidget::findWidget(os, "msa_editor_sequence_area"));
    CHECK_SET_ERR(msaEditArea != NULL, "MsaEditorSequenceArea not found");

    QRect msaEditRegion = msaEditArea->getSelection().getRect();
    CHECK_SET_ERR(expectedRect == msaEditRegion, QString("Unexpected selection region. Expected: [(%1,%2) (%3,%4)]. Actual: [(%5,%6) (%7,%8)]")
                  .arg(expectedRect.topLeft().x()).arg(expectedRect.topLeft().y()).arg(expectedRect.bottomRight().x()).arg(expectedRect.bottomRight().y())
                  .arg(msaEditRegion.topLeft().x()).arg(msaEditRegion.topLeft().y()).arg(msaEditRegion.bottomRight().x()).arg(msaEditRegion.bottomRight().y()));
}
void checkValues(HI::GUITestOpStatus &os, int expected){
    QSlider* thresholdSlider = qobject_cast<QSlider*>(GTWidget::findWidget(os, "thresholdSlider"));
    CHECK_SET_ERR(thresholdSlider != NULL, "thresholdSlider not found");
    int actualSliderValue = thresholdSlider->value();
    CHECK_SET_ERR(actualSliderValue == expected, QString("wrong value for slider. Exected: %1, actual: %2").arg(expected).arg(actualSliderValue));

    QSpinBox* thresholdSpinBox = qobject_cast<QSpinBox*>(GTWidget::findWidget(os, "thresholdSpinBox"));
    CHECK_SET_ERR(thresholdSpinBox != NULL, "thresholdSpin not found");
    int actualSpinValue = thresholdSpinBox->value();
    CHECK_SET_ERR(actualSpinValue == expected, QString("wrong value for Spin. Exected: %1, actual: %2").arg(expected).arg(actualSpinValue));
}
void GTUtilsMSAEditorSequenceArea::checkConsensus(HI::GUITestOpStatus &os, QString cons){
    QWidget *consArea = GTWidget::findWidget(os,"consArea");
    CHECK_SET_ERR(consArea!=NULL,"consArea is NULL");

    QObject *parent = consArea->findChild<QObject*>("parent");
    CHECK_SET_ERR(parent!=NULL,"parent is NULL");

    QObject *child = parent->findChild<QObject*>();
    CHECK_SET_ERR(child!=NULL,"child is NULL");
    CHECK_SET_ERR(child->objectName()==cons,"Wrong consensus. Currens consensus is  "+child->objectName());
    GTGlobals::sleep(1000);
}
void ExportSelectedRegionFiller::commonScenario()
{
    QWidget *dialog = QApplication::activeModalWidget();
    GT_CHECK(dialog != NULL, "dialog not found");

    QLineEdit *lineEdit = qobject_cast<QLineEdit*>(GTWidget::findWidget(os, "fileNameEdit", dialog));
    GT_CHECK(lineEdit != NULL, "File name line edit not found");
    defaultExportPath = GTLineEdit::copyText(os, lineEdit);
    GTLineEdit::setText(os, lineEdit, path + name);

    if(!seqName.isEmpty()) {
        QCheckBox *customSeqCheckBox = dialog->findChild<QCheckBox*>("customSeqNameBox");
        GT_CHECK(customSeqCheckBox != NULL, "Sequence name checkbox not found");
        GTCheckBox::setChecked(os, customSeqCheckBox, true);
        QLineEdit *sequenceNameEdit = qobject_cast<QLineEdit*>(GTWidget::findWidget(os, "sequenceNameEdit", dialog));
        GT_CHECK(sequenceNameEdit != NULL, "Sequence name line edit not found");
        GTLineEdit::setText(os, sequenceNameEdit, seqName);
    }

    QCheckBox *translateButton = qobject_cast<QCheckBox*>(GTWidget::findWidget(os, "translateButton"));
    CHECK_SET_ERR(translateButton != NULL, "translateButton not found!");
    GTCheckBox::setChecked(os, translateButton, translate);

    if (translate) {
        QCheckBox *allTFramesButton = qobject_cast<QCheckBox *>(GTWidget::findWidget(os, "allTFramesButton"));
        GTCheckBox::setChecked(os, allTFramesButton, saveAllAminoFrames);
    }

    GTUtilsDialog::clickButtonBox(os, dialog, QDialogButtonBox::Ok);
}
void GTUtilsMSAEditorSequenceArea::selectSequence(HI::GUITestOpStatus &os, const QString &seqName) {
    MSAEditorSequenceArea *msaEditArea = qobject_cast<MSAEditorSequenceArea*>
            (GTWidget::findWidget(os, "msa_editor_sequence_area"));
    CHECK_SET_ERR(msaEditArea != NULL, "MsaEditorSequenceArea not found");

    QStringList names = getVisibleNames(os);
    int row = 0;
    while (names[row] != seqName) {
        row++;
    }
    click(os, QPoint(-5, row));
}
void checkLimits(HI::GUITestOpStatus &os, int minVal, int maxVal){
    QSlider* thresholdSlider = qobject_cast<QSlider*>(GTWidget::findWidget(os, "thresholdSlider"));
    CHECK_SET_ERR(thresholdSlider != NULL, "thresholdSlider not found");
    int actualSliderMin = thresholdSlider->minimum();
    int actualSliderMax = thresholdSlider->maximum();
    CHECK_SET_ERR(actualSliderMin == minVal, QString("wrong minimal value for slider. Expected: %1, actual: %2").arg(minVal).arg(actualSliderMin));
    CHECK_SET_ERR(actualSliderMax == maxVal, QString("wrong maximim value for slider. Expected: %1, actual: %2").arg(maxVal).arg(actualSliderMin));

    QSpinBox* thresholdSpinBox = qobject_cast<QSpinBox*>(GTWidget::findWidget(os, "thresholdSpinBox"));
    CHECK_SET_ERR(thresholdSpinBox != NULL, "thresholdSpin not found");
    int actualSpinMin = thresholdSpinBox->minimum();
    int actualSpinMax = thresholdSpinBox->maximum();
    CHECK_SET_ERR(actualSpinMin == minVal, QString("wrong minimal value for spin. Expected: %1, actual: %2").arg(minVal).arg(actualSpinMin));
    CHECK_SET_ERR(actualSpinMax == maxVal, QString("wrong maximim value for spin. Expected: %1, actual: %2").arg(maxVal).arg(actualSpinMin));
}
void BlastAllSupportDialogFiller::test_3211() {
    //Expected state: there is a "Request to Local BLAST Database" dialog without an annotation widget.
    QWidget *widget = GTWidget::findWidget(os, "rbCreateNewTable", NULL, GTGlobals::FindOptions(false));
    CHECK_SET_ERR(NULL == widget, "Annotations widget exists");

    //2. Set any input sequence.
    GTUtilsDialog::waitForDialog(os, new GTFileDialogUtils(os, UGUITest::dataDir + "samples/FASTA/human_T1.fa"));
    GTWidget::click(os, GTWidget::findWidget(os, "browseInput"));
    GTUtilsTaskTreeView::waitTaskFinished(os);

    //Expected state: an annotation widget was added.
    GTWidget::findWidget(os, "rbCreateNewTable");

    //3. Set any another input sequence.
    GTUtilsDialog::waitForDialog(os, new GTFileDialogUtils(os, UGUITest::testDir + "_common_data/fasta/human_T1_cutted.fa"));
    GTWidget::click(os, GTWidget::findWidget(os, "browseInput"));
    GTUtilsTaskTreeView::waitTaskFinished(os);
    //Expected state: there is a single annotation widget.
    GTWidget::findWidget(os, "rbCreateNewTable");

    GTUtilsDialog::clickButtonBox(os, dialog, QDialogButtonBox::Cancel);
}
void GTUtilsMSAEditorSequenceArea::selectColumnInConsensus( HI::GUITestOpStatus &os, int columnNumber ) {
    QWidget *activeWindow = GTUtilsMdi::activeWindow( os );
    const MSAEditorSequenceArea *msaEditArea = qobject_cast<MSAEditorSequenceArea *>(
        GTWidget::findWidget( os, "msa_editor_sequence_area", activeWindow ) );
    GT_CHECK_RESULT( NULL != msaEditArea, "MsaEditorSequenceArea not found", );

    const QWidget *msaOffsetLeft = GTWidget::findWidget( os, "msa_editor_offsets_view_widget_left",
        activeWindow );
    GT_CHECK_RESULT( NULL != msaOffsetLeft, "MsaOffset Left not found", );

    QPoint shift = msaOffsetLeft->mapToGlobal( QPoint( 0, 0 ) );
    if ( msaOffsetLeft->isVisible( ) ) {
        shift = msaOffsetLeft->mapToGlobal( QPoint( msaOffsetLeft->rect( ).right( ), 0 ) );
    }

    const int posX = msaEditArea->getXByColumnNum( columnNumber ) + shift.x( );

    QWidget *consArea = GTWidget::findWidget( os,"consArea" );
    CHECK_SET_ERR( NULL != consArea,"consArea is NULL" );

    const int posY = consArea->mapToGlobal( consArea->rect( ).center( ) ).y( );
    GTMouseDriver::moveTo( QPoint( posX, posY ) );
    GTMouseDriver::click();
}
Exemplo n.º 10
0
void SaveProjectDialogFiller::commonScenario(){
    QWidget* dialog = QApplication::activeModalWidget();
    CHECK_SET_ERR(dialog, "save project dialog not found");

    GTUtilsDialog::clickButtonBox(os, dialog, b);
}
MAFFTSupportRunDialogFiller::MAFFTSupportRunDialogFiller(GUITestOpStatus &os, MAFFTSupportRunDialogFiller::Parameters *parameters)
    : Filler(os, "MAFFTSupportRunDialog"),
      parameters(parameters)
{
    CHECK_SET_ERR(parameters, "Invalid filler parameters: NULL pointer");
}