diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2012-03-16 14:08:13 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-01 20:13:51 +0200 |
commit | 1f5e058f79f95e869d8de300596137463492056c (patch) | |
tree | 57d8a72b8dddf3701f2c824c2f85f88174e1fb6f /src | |
parent | d5bc8ab811f380116c5a55a777150bc47a43a6bb (diff) |
Testability for password mask delay
Unit test to override mask delay value so running it is not dependent
on platform style hint.
Change-Id: Ic5cc12d32cf97e64729b3af54250bdc05c0c95ad
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qlineedit_p.h | 6 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol.cpp | 5 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol_p.h | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 3b7a0d1b91..d6af91fd65 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE -class QLineEditPrivate : public QWidgetPrivate +class Q_AUTOTEST_EXPORT QLineEditPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QLineEdit) public: @@ -109,6 +109,10 @@ public: return !control->isReadOnly(); } + static inline QLineEditPrivate *get(QLineEdit *lineEdit) { + return lineEdit->d_func(); + } + QPoint tripleClick; QBasicTimer tripleClickTimer; uint frame : 1; diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 20af574049..c9300d3cdd 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -785,6 +785,11 @@ void QWidgetLineControl::internalInsert(const QString &s) if (m_passwordEchoTimer != 0) killTimer(m_passwordEchoTimer); int delay = qGuiApp->styleHints()->passwordMaskDelay(); +#ifdef QT_BUILD_INTERNAL + if (m_passwordMaskDelayOverride >= 0) + delay = m_passwordMaskDelayOverride; +#endif + if (delay > 0) m_passwordEchoTimer = startTimer(delay); } diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index 88b816d1b6..ba3b202bda 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -98,6 +98,9 @@ public: , m_threadChecks(false) , m_textLayoutThread(0) #endif +#if defined(QT_BUILD_INTERNAL) + , m_passwordMaskDelayOverride(-1) +#endif , m_keyboardScheme(0) { init(txt); @@ -496,6 +499,11 @@ private: mutable QThread *m_textLayoutThread; #endif +public: +#if defined(QT_BUILD_INTERNAL) + int m_passwordMaskDelayOverride; +#endif + Q_SIGNALS: void cursorPositionChanged(int, int); void selectionChanged(); |