mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Show character count in password generator dialog (#10940)
Displays the number of characters in the password field in the password generator dialog. This fixes #10858.
This commit is contained in:
@@ -895,6 +895,7 @@ void TestGui::testPasswordEntryEntropy()
|
||||
pwGeneratorWidget->findChild<PasswordWidget*>("editNewPassword")->findChild<QLineEdit*>("passwordEdit");
|
||||
auto* entropyLabel = pwGeneratorWidget->findChild<QLabel*>("entropyLabel");
|
||||
auto* strengthLabel = pwGeneratorWidget->findChild<QLabel*>("strengthLabel");
|
||||
auto* passwordLengthLabel = pwGeneratorWidget->findChild<QLabel*>("passwordLengthLabel");
|
||||
|
||||
QFETCH(QString, password);
|
||||
QFETCH(QString, expectedStrengthLabel);
|
||||
@@ -902,10 +903,12 @@ void TestGui::testPasswordEntryEntropy()
|
||||
// Dynamically calculate entropy due to variances with zxcvbn wordlists
|
||||
PasswordHealth health(password);
|
||||
auto expectedEntropy = QString("Entropy: %1 bit").arg(QString::number(health.entropy(), 'f', 2));
|
||||
auto expectedPasswordLength = QString("Characters: %1").arg(QString::number(password.length()));
|
||||
|
||||
generatedPassword->setText(password);
|
||||
QCOMPARE(entropyLabel->text(), expectedEntropy);
|
||||
QCOMPARE(strengthLabel->text(), expectedStrengthLabel);
|
||||
QCOMPARE(passwordLengthLabel->text(), expectedPasswordLength);
|
||||
|
||||
QTest::mouseClick(generatedPassword, Qt::LeftButton);
|
||||
QTest::keyClick(generatedPassword, Qt::Key_Escape););
|
||||
|
||||
Reference in New Issue
Block a user