summaryrefslogtreecommitdiff
path: root/src/bookmarks/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks/test')
-rw-r--r--src/bookmarks/test/bookmarkmanager.cpp21
-rw-r--r--src/bookmarks/test/bookmarks.xbel69
-rw-r--r--src/bookmarks/test/xbel.cpp2
3 files changed, 91 insertions, 1 deletions
diff --git a/src/bookmarks/test/bookmarkmanager.cpp b/src/bookmarks/test/bookmarkmanager.cpp
new file mode 100644
index 00000000..5bfaf649
--- /dev/null
+++ b/src/bookmarks/test/bookmarkmanager.cpp
@@ -0,0 +1,21 @@
+#include "../bookmarkmanager.hpp"
+#include <QStandardPaths>
+#include <gtest/gtest.h>
+
+// clazy:excludeall=non-pod-global-static
+
+namespace {
+TEST(BookmarkManager, QStandardPaths)
+{
+ const auto file = QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QString::fromLatin1("bookmarks.xbel"));
+ EXPECT_TRUE(file.isEmpty()) << qUtf8Printable(file);
+}
+
+TEST(BookmarkManager, Manager)
+{
+ BookmarkManager manager("bookmarks.xbel");
+
+ const auto load_errors = manager.errors();
+ EXPECT_EQ(load_errors.length(), 0) << qUtf8Printable(load_errors.join('\n'));
+}
+} // namespace \ No newline at end of file
diff --git a/src/bookmarks/test/bookmarks.xbel b/src/bookmarks/test/bookmarks.xbel
new file mode 100644
index 00000000..2501c118
--- /dev/null
+++ b/src/bookmarks/test/bookmarks.xbel
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE xbel>
+<xbel version="1.0">
+ <folder folded="no">
+ <title>Qt Resources</title>
+ <bookmark href="http://qt.io/">
+ <title>Qt home page</title>
+ </bookmark>
+ <bookmark href="https://www.qt.io/partners/">
+ <title>Qt Partners</title>
+ </bookmark>
+ <bookmark href="https://www.qt.io/qt-training/">
+ <title>Training</title>
+ </bookmark>
+ <bookmark href="http://doc.qt.io/">
+ <title>Qt 5 documentation</title>
+ </bookmark>
+ <bookmark href="http://qt-project.org/faq/">
+ <title>Frequently Asked Questions</title>
+ </bookmark>
+ <folder folded="yes">
+ <title>Community Resources</title>
+ <bookmark href="http://www.qtcentre.org/content/">
+ <title>Qt Centre</title>
+ </bookmark>
+ <bookmark href="http://www.qtforum.org/">
+ <title>QtForum.org</title>
+ </bookmark>
+ <bookmark href="http://digitalfanatics.org/projects/qt_tutorial/">
+ <title>The Independent Qt Tutorial</title>
+ </bookmark>
+ <bookmark href="http://www.qtforum.de/">
+ <title>German Qt Forum</title>
+ </bookmark>
+ <bookmark href="http://www.korone.net/">
+ <title>Korean Qt Community Site</title>
+ </bookmark>
+ <bookmark href="http://prog.org.ru/">
+ <title>Russian Qt Forum</title>
+ </bookmark>
+ </folder>
+ </folder>
+ <folder folded="no">
+ <title>Online Dictionaries</title>
+ <bookmark href="http://www.dictionary.com/">
+ <title>Dictionary.com</title>
+ </bookmark>
+ <bookmark href="http://www.m-w.com/">
+ <title>Merriam-Webster Online</title>
+ </bookmark>
+ <bookmark href="http://dictionary.cambridge.org/">
+ <title>Cambridge Dictionaries Online</title>
+ </bookmark>
+ <bookmark href="http://www.onelook.com/">
+ <title>OneLook Dictionary Search</title>
+ </bookmark>
+ <separator/>
+ <bookmark href="http://dict.tu-chemnitz.de/">
+ <title>TU Chemnitz German-English Dictionary</title>
+ </bookmark>
+ <separator/>
+ <bookmark href="http://atilf.atilf.fr/tlf.htm">
+ <title>Trésor de la Langue Française informatisé</title>
+ </bookmark>
+ <bookmark href="http://dictionnaires.atilf.fr/dictionnaires/ACADEMIE/">
+ <title>Dictionnaire de l'Académie Française</title>
+ </bookmark>
+ </folder>
+</xbel>
diff --git a/src/bookmarks/test/xbel.cpp b/src/bookmarks/test/xbel.cpp
index a836dd9a..03bd061a 100644
--- a/src/bookmarks/test/xbel.cpp
+++ b/src/bookmarks/test/xbel.cpp
@@ -55,7 +55,7 @@ bool operator==(const BookmarksTreeItem &lhs, const BookmarksTreeItem &rhs)
{
QBuffer buffer(&data);
if (!buffer.open(QIODevice::ReadOnly | QIODevice::Text)) return false;
- return xbel::read(&buffer, root);
+ return xbel::read(&buffer, root).isEmpty();
}
namespace {