diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/firefox-bookmarks-json-parser/main.cpp | 28 | ||||
-rw-r--r-- | test/firefox-bookmarks-json-parser/meson.build | 13 |
2 files changed, 41 insertions, 0 deletions
diff --git a/test/firefox-bookmarks-json-parser/main.cpp b/test/firefox-bookmarks-json-parser/main.cpp new file mode 100644 index 0000000..48093ec --- /dev/null +++ b/test/firefox-bookmarks-json-parser/main.cpp @@ -0,0 +1,28 @@ +#include <QFile> +#include "bookmarkformat.h" +#include <QTreeView> +#include <QApplication> + +int main(int argc, char** argv) +{ + QApplication app(argc, argv); + + QFile f(qgetenv("FILE")); + + auto *model = new BookmarkModel; + + if(f.open(QIODevice::ReadOnly)) { + BookmarkFormat<FirefoxJsonFormat>(&f) >> model; + f.close(); + } else + return -1; + + auto *view = new QTreeView; + view->setModel(model); + + if(qgetenv("NOGUI") == "1") + return 0; + + view->show(); + return app.exec(); +} diff --git a/test/firefox-bookmarks-json-parser/meson.build b/test/firefox-bookmarks-json-parser/meson.build new file mode 100644 index 0000000..1432e68 --- /dev/null +++ b/test/firefox-bookmarks-json-parser/meson.build @@ -0,0 +1,13 @@ +e = executable('bookmarks-json-parser', + sources: [ 'main.cpp' ], + dependencies: [ dep_qt5, dep_bookmarks ] +) + +env = environment({ + 'NOGUI' : '1', + 'FILE' : 'bookmarks.json' +}) +test('Firefox bookmarks.json parser', e, + env: env, + workdir: meson.build_root() +) |