From 0ce707d1d5ac420d9f2639ab82d0ccf9bca02f98 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 25 Aug 2014 16:24:07 +0200 Subject: QColorDialog manual test improvements Show debug output for rejected and currentColorChanged signals, because accepting is not the only scenario to be tested. Task-number: QTBUG-40855 Change-Id: If741ab19392e7d4314e0eff82a939d202ae86b48 Reviewed-by: Gabriel de Dietrich --- tests/manual/dialogs/colordialogpanel.cpp | 18 ++++++++++++++++++ tests/manual/dialogs/colordialogpanel.h | 2 ++ 2 files changed, 20 insertions(+) (limited to 'tests/manual/dialogs') diff --git a/tests/manual/dialogs/colordialogpanel.cpp b/tests/manual/dialogs/colordialogpanel.cpp index 24416fdfa1..eb4bbd0a93 100644 --- a/tests/manual/dialogs/colordialogpanel.cpp +++ b/tests/manual/dialogs/colordialogpanel.cpp @@ -169,6 +169,8 @@ void ColorDialogPanel::execModal() QColorDialog dialog(this); applySettings(&dialog); connect(&dialog, SIGNAL(accepted()), this, SLOT(accepted())); + connect(&dialog, SIGNAL(rejected()), this, SLOT(rejected())); + connect(&dialog, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(currentColorChanged(const QColor&))); dialog.setWindowTitle(tr("Modal Color Dialog Qt %1").arg(QLatin1String(QT_VERSION_STR))); dialog.exec(); } @@ -180,6 +182,8 @@ void ColorDialogPanel::showModal() m_modalDialog = new QColorDialog(this); m_modalDialog->setModal(true); connect(m_modalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted())); + connect(m_modalDialog.data(), SIGNAL(rejected()), this, SLOT(rejected())); + connect(m_modalDialog.data(), SIGNAL(currentColorChanged(const QColor&)), this, SLOT(currentColorChanged(const QColor&))); m_modalDialog->setWindowTitle(tr("Modal Color Dialog #%1 Qt %2") .arg(++n) .arg(QLatin1String(QT_VERSION_STR))); @@ -195,6 +199,8 @@ void ColorDialogPanel::showNonModal() static int n = 0; m_nonModalDialog = new QColorDialog(this); connect(m_nonModalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted())); + connect(m_nonModalDialog.data(), SIGNAL(rejected()), this, SLOT(rejected())); + connect(m_nonModalDialog.data(), SIGNAL(currentColorChanged(const QColor&)), this, SLOT(currentColorChanged(const QColor&))); m_nonModalDialog->setWindowTitle(tr("Non-Modal Color Dialog #%1 Qt %2") .arg(++n) .arg(QLatin1String(QT_VERSION_STR))); @@ -223,12 +229,24 @@ void ColorDialogPanel::accepted() const QColorDialog *d = qobject_cast(sender()); Q_ASSERT(d); m_result.clear(); + qDebug() << "Current color: " << d->currentColor() + << "Selected color: " << d->selectedColor(); QDebug(&m_result).nospace() << "Current color: " << d->currentColor() << "\nSelected color: " << d->selectedColor(); QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent. } +void ColorDialogPanel::rejected() +{ + qDebug() << "rejected"; +} + +void ColorDialogPanel::currentColorChanged(const QColor &color) +{ + qDebug() << color; +} + void ColorDialogPanel::showAcceptedResult() { QMessageBox::information(this, tr("Color Dialog Accepted"), m_result, QMessageBox::Ok); diff --git a/tests/manual/dialogs/colordialogpanel.h b/tests/manual/dialogs/colordialogpanel.h index 7f2898cea0..33670d0d80 100644 --- a/tests/manual/dialogs/colordialogpanel.h +++ b/tests/manual/dialogs/colordialogpanel.h @@ -64,6 +64,8 @@ public slots: void deleteNonModalDialog(); void deleteModalDialog(); void accepted(); + void rejected(); + void currentColorChanged(const QColor & color); void showAcceptedResult(); void restoreDefaults(); -- cgit v1.2.3