summaryrefslogtreecommitdiffstats
path: root/tests/manual/dialogs
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-08-25 16:24:07 +0200
committerShawn Rutledge <shawn.rutledge@digia.com>2014-08-25 17:04:47 +0200
commit0ce707d1d5ac420d9f2639ab82d0ccf9bca02f98 (patch)
tree9d6effc148a511cd82acfa7dc9ee2e7d5d97ffcb /tests/manual/dialogs
parent9d9ef74a6c260b10cf7ee0ec8837261715d29a5c (diff)
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 <gabriel.dedietrich@digia.com>
Diffstat (limited to 'tests/manual/dialogs')
-rw-r--r--tests/manual/dialogs/colordialogpanel.cpp18
-rw-r--r--tests/manual/dialogs/colordialogpanel.h2
2 files changed, 20 insertions, 0 deletions
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<const QColorDialog *>(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();