Skip to content

Commit

Permalink
BUG: Fix ctkDICOMBrowserTester checking for use of native file dialog
Browse files Browse the repository at this point in the history
Follow-up of c4f1eee ("ENH: Update ctkFileDialog to use native dialog
by default", 2021-06-10).

Co-authored-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
  • Loading branch information
Punzo and jcfr committed Jan 13, 2024
1 parent 7b00d52 commit a30c3be
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMBrowserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,21 @@ void ctkDICOMBrowserTester::testImportDirectoryMode()
browser.setImportDirectoryMode(ctkDICOMBrowser::ImportDirectoryAddLink);
QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryAddLink);

QComboBox* comboBox = browser.importDialog()->bottomWidget()->findChild<QComboBox*>();
bool usingNativeDialog = !browser.importDialog()->testOption(QFileDialog::DontUseNativeDialog);
if (!usingNativeDialog)
{
QComboBox* comboBox = browser.importDialog()->bottomWidget()->findChild<QComboBox*>();

comboBox->setCurrentIndex(comboBox->findData(static_cast<int>(ctkDICOMBrowser::ImportDirectoryCopy)));
QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryCopy);
comboBox->setCurrentIndex(comboBox->findData(static_cast<int>(ctkDICOMBrowser::ImportDirectoryCopy)));
QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryCopy);

comboBox->setCurrentIndex(comboBox->findData(static_cast<int>(ctkDICOMBrowser::ImportDirectoryAddLink)));
QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryAddLink);
comboBox->setCurrentIndex(comboBox->findData(static_cast<int>(ctkDICOMBrowser::ImportDirectoryAddLink)));
QCOMPARE(browser.importDirectoryMode(), ctkDICOMBrowser::ImportDirectoryAddLink);
}
else
{
QCOMPARE(browser.importDialog()->bottomWidget(), nullptr);
}
}

// ----------------------------------------------------------------------------
Expand Down

0 comments on commit a30c3be

Please sign in to comment.