diff --git a/src/gui/PasswordGeneratorWidget.cpp b/src/gui/PasswordGeneratorWidget.cpp
index 59960ff43..dac7d0e0a 100644
--- a/src/gui/PasswordGeneratorWidget.cpp
+++ b/src/gui/PasswordGeneratorWidget.cpp
@@ -96,7 +96,7 @@ void PasswordGeneratorWidget::loadSettings()
m_ui->comboBoxWordList->setCurrentText(config()->get("generator/WordList", "eff_large.wordlist").toString());
// Password or diceware?
- m_ui->tabWidget->setCurrentIndex(config()->get("generator/Type", 1).toInt());
+ m_ui->tabWidget->setCurrentIndex(config()->get("generator/Type", 0).toInt());
}
void PasswordGeneratorWidget::saveSettings()
diff --git a/src/gui/PasswordGeneratorWidget.ui b/src/gui/PasswordGeneratorWidget.ui
index 0f803ba97..5cd37ad06 100644
--- a/src/gui/PasswordGeneratorWidget.ui
+++ b/src/gui/PasswordGeneratorWidget.ui
@@ -204,9 +204,9 @@ QProgressBar::chunk {
QTabWidget::Rounded
- 0
+ 1
-
+
Random
@@ -442,7 +442,7 @@ QProgressBar::chunk {
-
+
Diceware
diff --git a/src/gui/PasswordGeneratorWidget.ui.autosave b/src/gui/PasswordGeneratorWidget.ui.autosave
deleted file mode 100644
index 4c4ea1cd1..000000000
--- a/src/gui/PasswordGeneratorWidget.ui.autosave
+++ /dev/null
@@ -1,615 +0,0 @@
-
-
- PasswordGeneratorWidget
-
-
-
- 0
- 0
- 575
- 305
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 284
-
-
-
-
- 16777215
- 16777215
-
-
-
-
-
-
-
- QLayout::SetMinimumSize
-
- -
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 50
- 5
-
-
-
-
- 16777215
- 5
-
-
-
- QProgressBar {
- border: none;
- height: 2px;
- font-size: 1px;
- background-color: transparent;
- padding: 0 1px;
-}
-QProgressBar::chunk {
- background-color: #c0392b;
- border-radius: 2px;
-}
-
-
- 200
-
-
- 100
-
-
- false
-
-
- Qt::Horizontal
-
-
- false
-
-
- QProgressBar::TopToBottom
-
-
- %p%
-
-
-
- -
-
-
- Password:
-
-
- editNewPassword
-
-
-
- -
-
-
-
-
-
-
- 70
- 0
-
-
-
-
- 16777215
- 30
-
-
-
- strength
-
-
- Qt::PlainText
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- 3
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 70
- 0
-
-
-
- entropy
-
-
- Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing
-
-
- 3
-
-
-
-
-
- -
-
-
- 999
-
-
-
- -
-
-
- true
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
- QTabWidget::North
-
-
- QTabWidget::Rounded
-
-
- 0
-
-
- true
-
-
-
- Random
-
-
-
-
-
-
-
-
-
- Character Types
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 0
- 25
-
-
-
- Qt::StrongFocus
-
-
- Upper Case Letters
-
-
- A-Z
-
-
- true
-
-
- optionButtons
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 25
-
-
-
- Qt::StrongFocus
-
-
- Lower Case Letters
-
-
- a-z
-
-
- true
-
-
- optionButtons
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 25
-
-
-
- Qt::StrongFocus
-
-
- Numbers
-
-
- 0-9
-
-
- true
-
-
- optionButtons
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 25
-
-
-
- Qt::StrongFocus
-
-
- Special Characters
-
-
- /*_& ...
-
-
- true
-
-
- optionButtons
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Exclude look-alike characters
-
-
- optionButtons
-
-
-
- -
-
-
- Pick characters from every group
-
-
- optionButtons
-
-
-
-
-
-
-
-
- -
-
-
- 15
-
-
- 6
-
-
-
-
-
- &Length:
-
-
- spinBoxLength
-
-
-
- -
-
-
- 1
-
-
- 128
-
-
- 20
-
-
- Qt::Horizontal
-
-
- QSlider::TicksBelow
-
-
- 8
-
-
-
- -
-
-
- 1
-
-
- 999
-
-
- 20
-
-
-
-
-
-
-
-
-
- Diceware
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Wordlist:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
- -
-
-
- 15
-
-
- 6
-
-
-
-
-
- Word Count:
-
-
- spinBoxLength
-
-
-
- -
-
-
- 1
-
-
- 40
-
-
- 6
-
-
- 6
-
-
- Qt::Horizontal
-
-
- QSlider::TicksBelow
-
-
- 8
-
-
-
- -
-
-
- 1
-
-
- 100
-
-
- 6
-
-
-
-
-
- -
-
-
-
-
-
- Word Separator:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- Generate
-
-
-
- -
-
-
- false
-
-
- Accept
-
-
-
-
-
-
-
-
-
- PasswordEdit
- QLineEdit
-
- 1
-
-
-
- editNewPassword
- togglePasswordButton
- sliderLength
- spinBoxLength
- checkBoxUpper
- checkBoxLower
- checkBoxNumbers
- checkBoxSpecialChars
- checkBoxExcludeAlike
- buttonGenerate
-
-
-
-
-
-
- false
-
-
-
-
diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp
index 90f873197..4fd499f85 100644
--- a/tests/gui/TestGui.cpp
+++ b/tests/gui/TestGui.cpp
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -322,7 +323,7 @@ void TestGui::testAddEntry()
QTRY_COMPARE(entryView->model()->rowCount(), 4);
}
-void TestGui::testEntryEntropy()
+void TestGui::testPasswordEntryEntropy()
{
QToolBar* toolBar = m_mainWindow->findChild("toolBar");
@@ -396,6 +397,50 @@ void TestGui::testEntryEntropy()
// We are done
}
+void TestGui::testDicewareEntryEntropy()
+{
+ QToolBar* toolBar = m_mainWindow->findChild("toolBar");
+
+ // Find the new entry action
+ QAction* entryNewAction = m_mainWindow->findChild("actionEntryNew");
+ QVERIFY(entryNewAction->isEnabled());
+
+ // Find the button associated with the new entry action
+ QWidget* entryNewWidget = toolBar->widgetForAction(entryNewAction);
+ QVERIFY(entryNewWidget->isVisible());
+ QVERIFY(entryNewWidget->isEnabled());
+
+ // Click the new entry button and check that we enter edit mode
+ QTest::mouseClick(entryNewWidget, Qt::LeftButton);
+ QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::EditMode);
+
+ // Add entry "test" and confirm added
+ EditEntryWidget* editEntryWidget = m_dbWidget->findChild("editEntryWidget");
+ QLineEdit* titleEdit = editEntryWidget->findChild("titleEdit");
+ QTest::keyClicks(titleEdit, "test");
+
+ // Open the password generator
+ QToolButton* generatorButton = editEntryWidget->findChild("togglePasswordGeneratorButton");
+ QTest::mouseClick(generatorButton, Qt::LeftButton);
+
+ // Select Diceware
+ QTabWidget* tabWidget = editEntryWidget->findChild("tabWidget");
+ QWidget* dicewareWidget = editEntryWidget->findChild("dicewareWidget");
+ tabWidget->setCurrentWidget(dicewareWidget);
+
+ QComboBox* comboBoxWordList = dicewareWidget->findChild("comboBoxWordList");
+ comboBoxWordList->setCurrentText("eff_large.wordlist");
+ QSpinBox* spinBoxWordCount = dicewareWidget->findChild("spinBoxWordCount");
+ spinBoxWordCount->setValue(6);
+
+ // Type in some password
+ QLabel* entropyLabel = editEntryWidget->findChild("entropyLabel");
+ QLabel* strengthLabel = editEntryWidget->findChild("strengthLabel");
+
+ QCOMPARE(entropyLabel->text(), QString("Entropy: 77.55 bit"));
+ QCOMPARE(strengthLabel->text(), QString("Password Quality: Good"));
+}
+
void TestGui::testSearch()
{
// Add canned entries for consistent testing
diff --git a/tests/gui/TestGui.h b/tests/gui/TestGui.h
index d05ab8f58..fce5d69ee 100644
--- a/tests/gui/TestGui.h
+++ b/tests/gui/TestGui.h
@@ -44,7 +44,8 @@ private slots:
void testTabs();
void testEditEntry();
void testAddEntry();
- void testEntryEntropy();
+ void testPasswordEntryEntropy();
+ void testDicewareEntryEntropy();
void testSearch();
void testDeleteEntry();
void testCloneEntry();