Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvarjolintu <sami.vanttinen@protonmail.com>2019-11-22 14:54:28 +0300
committerJonathan White <support@dmapps.us>2019-12-21 17:22:16 +0300
commitc0f29cc790dc64b574229e9506d1d581cfbdb511 (patch)
tree301ce470087bf01486ffb213cf98961f5de9f4de /tests
parent663393d9946be6b3328a6f001e91e9532307dbf2 (diff)
Show UI warning for invalid URLs
Diffstat (limited to 'tests')
-rw-r--r--tests/TestBrowser.cpp22
-rw-r--r--tests/TestBrowser.h1
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/TestBrowser.cpp b/tests/TestBrowser.cpp
index 938a7e4e5..a3611399e 100644
--- a/tests/TestBrowser.cpp
+++ b/tests/TestBrowser.cpp
@@ -18,6 +18,7 @@
#include "TestBrowser.h"
#include "TestGlobal.h"
#include "browser/BrowserSettings.h"
+#include "core/Tools.h"
#include "crypto/Crypto.h"
#include "sodium/crypto_box.h"
#include <QString>
@@ -461,4 +462,23 @@ QList<Entry*> TestBrowser::createEntries(QStringList& urls, Group* root) const
}
return entries;
-} \ No newline at end of file
+}
+void TestBrowser::testValidURLs()
+{
+ QHash<QString, bool> urls;
+ urls["https://github.com/login"] = true;
+ urls["https:///github.com/"] = false;
+ urls["http://github.com/**//*"] = false;
+ urls["http://*.github.com/login"] = false;
+ urls["//github.com"] = true;
+ urls["github.com/{}<>"] = false;
+ urls["http:/example.com"] = false;
+ urls["cmd://C:/Toolchains/msys2/usr/bin/mintty \"ssh jon@192.168.0.1:22\""] = true;
+ urls["file:///Users/testUser/Code/test.html"] = true;
+
+ QHashIterator<QString, bool> i(urls);
+ while (i.hasNext()) {
+ i.next();
+ QCOMPARE(Tools::checkUrlValid(i.key()), i.value());
+ }
+}
diff --git a/tests/TestBrowser.h b/tests/TestBrowser.h
index 8b2dc3e3c..69ba69309 100644
--- a/tests/TestBrowser.h
+++ b/tests/TestBrowser.h
@@ -47,6 +47,7 @@ private slots:
void testSubdomainsAndPaths();
void testSortEntries();
void testGetDatabaseGroups();
+ void testValidURLs();
private:
QList<Entry*> createEntries(QStringList& urls, Group* root) const;