mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-25 22:16:01 -05:00
Run code formatter
This commit is contained in:
parent
09181fab13
commit
1e915eef89
@ -516,13 +516,13 @@ QString BrowserAction::getErrorMessage(const int errorCode) const
|
||||
|
||||
QString BrowserAction::getReturnValue(const BrowserService::ReturnValue returnValue) const
|
||||
{
|
||||
switch(returnValue) {
|
||||
case BrowserService::ReturnValue::Success:
|
||||
return QString("success");
|
||||
case BrowserService::ReturnValue::Error:
|
||||
return QString("error");
|
||||
case BrowserService::ReturnValue::Canceled:
|
||||
return QString("canceled");
|
||||
switch (returnValue) {
|
||||
case BrowserService::ReturnValue::Success:
|
||||
return QString("success");
|
||||
case BrowserService::ReturnValue::Error:
|
||||
return QString("error");
|
||||
case BrowserService::ReturnValue::Canceled:
|
||||
return QString("canceled");
|
||||
}
|
||||
return QString("error");
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ void BrowserService::addEntry(const QString& id,
|
||||
|
||||
auto db = selectedDb ? selectedDb : selectedDatabase();
|
||||
if (!db) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
auto* entry = new Entry();
|
||||
@ -489,13 +489,12 @@ void BrowserService::addEntry(const QString& id,
|
||||
config.save(entry);
|
||||
}
|
||||
|
||||
BrowserService::ReturnValue
|
||||
BrowserService::updateEntry(const QString& id,
|
||||
const QString& uuid,
|
||||
const QString& login,
|
||||
const QString& password,
|
||||
const QString& url,
|
||||
const QString& submitUrl)
|
||||
BrowserService::ReturnValue BrowserService::updateEntry(const QString& id,
|
||||
const QString& uuid,
|
||||
const QString& login,
|
||||
const QString& password,
|
||||
const QString& url,
|
||||
const QString& submitUrl)
|
||||
{
|
||||
ReturnValue result = ReturnValue::Error;
|
||||
if (thread() != QThread::currentThread()) {
|
||||
@ -877,8 +876,7 @@ Group* BrowserService::getDefaultEntryGroup(const QSharedPointer<Database>& sele
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const QString groupName =
|
||||
QLatin1String(KEEPASSXCBROWSER_GROUP_NAME);
|
||||
const QString groupName = QLatin1String(KEEPASSXCBROWSER_GROUP_NAME);
|
||||
|
||||
for (auto* g : rootGroup->groupsRecursive(true)) {
|
||||
if (g->name() == groupName && !g->isRecycled()) {
|
||||
|
@ -17,9 +17,9 @@
|
||||
|
||||
#include "TestBrowser.h"
|
||||
#include "TestGlobal.h"
|
||||
#include "browser/BrowserSettings.h"
|
||||
#include "crypto/Crypto.h"
|
||||
#include "sodium/crypto_box.h"
|
||||
#include "browser/BrowserSettings.h"
|
||||
#include <QString>
|
||||
|
||||
QTEST_GUILESS_MAIN(TestBrowser)
|
||||
@ -40,7 +40,6 @@ void TestBrowser::initTestCase()
|
||||
|
||||
void TestBrowser::cleanupTestCase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,7 +86,7 @@ void TestBrowser::testDecryptMessage()
|
||||
void TestBrowser::testGetBase64FromKey()
|
||||
{
|
||||
unsigned char pk[crypto_box_PUBLICKEYBYTES];
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < crypto_box_PUBLICKEYBYTES; ++i) {
|
||||
pk[i] = i;
|
||||
}
|
||||
@ -202,7 +201,7 @@ void TestBrowser::testSearchEntries()
|
||||
}
|
||||
|
||||
browserSettings()->setMatchUrlScheme(false);
|
||||
auto result = m_browserService->searchEntries(db, "github.com", "https://github.com"); // db, hostname, url
|
||||
auto result = m_browserService->searchEntries(db, "github.com", "https://github.com"); // db, hostname, url
|
||||
QCOMPARE(result.length(), 7);
|
||||
QCOMPARE(result[0]->url(), QString("https://github.com/login_page"));
|
||||
QCOMPARE(result[1]->url(), QString("https://github.com/login"));
|
||||
@ -210,11 +209,11 @@ void TestBrowser::testSearchEntries()
|
||||
QCOMPARE(result[3]->url(), QString("http://github.com"));
|
||||
QCOMPARE(result[4]->url(), QString("http://github.com/login"));
|
||||
QCOMPARE(result[5]->url(), QString("github.com"));
|
||||
QCOMPARE(result[6]->url(), QString("github.com")) ;
|
||||
QCOMPARE(result[6]->url(), QString("github.com"));
|
||||
|
||||
// With matching there should be only 5 results
|
||||
browserSettings()->setMatchUrlScheme(true);
|
||||
result = m_browserService->searchEntries(db, "github.com", "https://github.com"); // db, hostname, url
|
||||
result = m_browserService->searchEntries(db, "github.com", "https://github.com"); // db, hostname, url
|
||||
QCOMPARE(result.length(), 5);
|
||||
QCOMPARE(result[0]->url(), QString("https://github.com/login_page"));
|
||||
QCOMPARE(result[1]->url(), QString("https://github.com/login"));
|
||||
@ -241,7 +240,7 @@ void TestBrowser::testSearchEntriesWithPort()
|
||||
entry->endUpdate();
|
||||
}
|
||||
|
||||
auto result = m_browserService->searchEntries(db, "127.0.0.1", "http://127.0.0.1:443"); // db, hostname, url
|
||||
auto result = m_browserService->searchEntries(db, "127.0.0.1", "http://127.0.0.1:443"); // db, hostname, url
|
||||
QCOMPARE(result.length(), 1);
|
||||
QCOMPARE(result[0]->url(), QString("http://127.0.0.1:443"));
|
||||
}
|
||||
@ -275,7 +274,8 @@ void TestBrowser::testSortEntries()
|
||||
}
|
||||
|
||||
browserSettings()->setBestMatchOnly(false);
|
||||
auto result = m_browserService->sortEntries(entries, "github.com", "https://github.com/session"); // entries, host, submitUrl
|
||||
auto result =
|
||||
m_browserService->sortEntries(entries, "github.com", "https://github.com/session"); // entries, host, submitUrl
|
||||
QCOMPARE(result.size(), 10);
|
||||
QCOMPARE(result[0]->username(), QString("User 2"));
|
||||
QCOMPARE(result[0]->url(), QString("https://github.com/"));
|
||||
@ -318,7 +318,7 @@ void TestBrowser::testGetDatabaseGroups()
|
||||
|
||||
auto result = m_browserService->getDatabaseGroups(db);
|
||||
QCOMPARE(result.length(), 1);
|
||||
|
||||
|
||||
auto groups = result["groups"].toArray();
|
||||
auto first = groups.at(0);
|
||||
auto children = first.toObject()["children"].toArray();
|
||||
@ -341,4 +341,4 @@ void TestBrowser::testGetDatabaseGroups()
|
||||
auto lastChildren = firstOfCOS.toObject()["children"].toArray();
|
||||
auto lastChild = lastChildren.at(0);
|
||||
QCOMPARE(lastChild.toObject()["name"].toString(), QString("group2_1_1"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user