Multiple macOS fixes and include keepassxc-cli in DMG (#2165)
* Fixes including keepassxc-cli when building KeePassXC dmg on Mac. resolves #1697 * Fix Qt search path and Properties display on macOS * Simplify packaging POST_BUILD fixups * Various fixes to get cli to run on macos * Correct cli tests on macOS * Several macOS related GUI test fixes
This commit is contained in:
@@ -560,26 +560,11 @@ void TestCli::testEstimate()
|
||||
QTextStream out(m_stdoutFile.data());
|
||||
|
||||
in << input << endl;
|
||||
auto inEnd = in.pos();
|
||||
in.seek(0);
|
||||
estimateCmd.execute({"estimate"});
|
||||
auto outEnd = out.pos();
|
||||
estimateCmd.execute({"estimate", "-a"});
|
||||
out.seek(0);
|
||||
auto result = out.readAll();
|
||||
QVERIFY(result.startsWith("Length " + length));
|
||||
QVERIFY(result.contains("Entropy " + entropy));
|
||||
QVERIFY(result.contains("Log10 " + log10));
|
||||
|
||||
// seek to end of stream
|
||||
in.seek(inEnd);
|
||||
out.seek(outEnd);
|
||||
|
||||
in << input << endl;
|
||||
in.seek(inEnd);
|
||||
estimateCmd.execute({"estimate", "-a"});
|
||||
out.seek(outEnd);
|
||||
result = out.readAll();
|
||||
QVERIFY(result.startsWith("Length " + length));
|
||||
QVERIFY(result.contains("Length " + length));
|
||||
QVERIFY(result.contains("Entropy " + entropy));
|
||||
QVERIFY(result.contains("Log10 " + log10));
|
||||
for (const auto& string : asConst(searchStrings)) {
|
||||
|
||||
@@ -344,7 +344,7 @@ void TestGui::testAutoreloadDatabase()
|
||||
QVERIFY(m_dbFile->write(unmodifiedMergeDatabase, static_cast<qint64>(unmodifiedMergeDatabase.size())));
|
||||
m_dbFile->close();
|
||||
|
||||
Tools::wait(800);
|
||||
QTRY_VERIFY(m_db != m_dbWidget->database());
|
||||
m_db = m_dbWidget->database();
|
||||
|
||||
// the General group contains one entry from the new db data
|
||||
@@ -358,16 +358,13 @@ void TestGui::testAutoreloadDatabase()
|
||||
// Test rejecting new file in autoreload
|
||||
MessageBox::setNextAnswer(MessageBox::No);
|
||||
// Overwrite the current temp database with a new file
|
||||
m_dbFile->open();
|
||||
QVERIFY(m_dbFile->open());
|
||||
QVERIFY(m_dbFile->write(unmodifiedMergeDatabase, static_cast<qint64>(unmodifiedMergeDatabase.size())));
|
||||
m_dbFile->close();
|
||||
Tools::wait(800);
|
||||
|
||||
m_db = m_dbWidget->database();
|
||||
|
||||
// Ensure the merge did not take place
|
||||
QCOMPARE(m_db->rootGroup()->findChildByName("General")->entries().size(), 0);
|
||||
QVERIFY(m_tabWidget->tabName(m_tabWidget->currentIndex()).endsWith("*"));
|
||||
QTRY_VERIFY(m_tabWidget->tabName(m_tabWidget->currentIndex()).endsWith("*"));
|
||||
|
||||
// Reset the state
|
||||
cleanup();
|
||||
@@ -380,13 +377,13 @@ void TestGui::testAutoreloadDatabase()
|
||||
testEditEntry();
|
||||
|
||||
// This is saying yes to merging the entries
|
||||
MessageBox::setNextAnswer(MessageBox::Yes);
|
||||
MessageBox::setNextAnswer(MessageBox::Merge);
|
||||
// Overwrite the current database with the temp data
|
||||
QVERIFY(m_dbFile->open());
|
||||
QVERIFY(m_dbFile->write(unmodifiedMergeDatabase, static_cast<qint64>(unmodifiedMergeDatabase.size())));
|
||||
m_dbFile->close();
|
||||
Tools::wait(800);
|
||||
|
||||
QTRY_VERIFY(m_db != m_dbWidget->database());
|
||||
m_db = m_dbWidget->database();
|
||||
|
||||
QCOMPARE(m_db->rootGroup()->findChildByName("General")->entries().size(), 1);
|
||||
@@ -404,6 +401,9 @@ void TestGui::testEditEntry()
|
||||
auto* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar");
|
||||
auto* entryView = m_dbWidget->findChild<EntryView*>("entryView");
|
||||
|
||||
entryView->setFocus();
|
||||
QVERIFY(entryView->hasFocus());
|
||||
|
||||
// Select the first entry in the database
|
||||
QModelIndex entryItem = entryView->model()->index(0, 1);
|
||||
Entry* entry = entryView->entryFromIndex(entryItem);
|
||||
@@ -937,6 +937,7 @@ void TestGui::testDeleteEntry()
|
||||
auto* toolBar = m_mainWindow->findChild<QToolBar*>("toolBar");
|
||||
auto* entryDeleteAction = m_mainWindow->findChild<QAction*>("actionEntryDelete");
|
||||
QWidget* entryDeleteWidget = toolBar->widgetForAction(entryDeleteAction);
|
||||
entryView->setFocus();
|
||||
|
||||
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::Mode::ViewMode);
|
||||
clickIndex(entryView->model()->index(1, 1), entryView, Qt::LeftButton);
|
||||
@@ -996,6 +997,7 @@ void TestGui::testDeleteEntry()
|
||||
void TestGui::testCloneEntry()
|
||||
{
|
||||
auto* entryView = m_dbWidget->findChild<EntryView*>("entryView");
|
||||
entryView->setFocus();
|
||||
|
||||
QCOMPARE(entryView->model()->rowCount(), 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user