diff --git a/autotests/atom/bug-414086.xml b/autotests/atom/bug-414086.xml
new file mode 100644
index 0000000..fae8fa6
--- /dev/null
+++ b/autotests/atom/bug-414086.xml
@@ -0,0 +1,24 @@
+
+
+
+
+Neues von nasauber.de
+Tobias Leupolds Meinung zum Weltgeschehen ;-)
+
+
+http://nasauber.de/bilder/favsonne.png
+2019-08-25T20:44:44+01:00
+Tobias Leupold
+Copyright (c) 2019 by Tobias Leupold
+http://nasauber.de/blog/weblog.xml
+
+
+Calculating the difference between two QDates
+2019-08-25T20:42:41+01:00
+2019-08-25T20:44:44+01:00
+http://nasauber.de/blog/text.php?text=168
+
+ I wanted to calculate the difference between two QDates. Not only the days, but also the years, months, and weeks (for use in KPhotoAlbum). I ended up using the following algorithm: struct …
+
+
+
diff --git a/autotests/atom/bug-414086.xml.expected b/autotests/atom/bug-414086.xml.expected
new file mode 100644
index 0000000..efe9cd0
--- /dev/null
+++ b/autotests/atom/bug-414086.xml.expected
@@ -0,0 +1,20 @@
+# Feed begin ######################
+title: #Neues von nasauber.de#
+link: #http://nasauber.de/#
+description: #Tobias Leupolds Meinung zum Weltgeschehen ;-)#
+copyright: #Copyright (c) 2019 by Tobias Leupold#
+# Person begin ####################
+name: #Tobias Leupold#
+# Person end ######################
+# Item begin ######################
+id: #http://nasauber.de/blog/text.php?text=168#
+title: #Calculating the difference between two QDates#
+link: #http://nasauber.de/blog/text.php?text=168#
+content: #I wanted to calculate the difference between two QDates. Not only the days, but also the years, months, and weeks (for use in KPhotoAlbum). I ended up using the following algorithm: struct …#
+datePublished: #Sun Aug 25 19:42:41 2019#
+dateUpdated: #Sun Aug 25 19:44:44 2019#
+# Person begin ####################
+name: #Tobias Leupold#
+# Person end ######################
+# Item end ########################
+# Feed end ########################
\ No newline at end of file
diff --git a/autotests/testlibsyndication.cpp b/autotests/testlibsyndication.cpp
index 7a2311a..95cfb9b 100644
--- a/autotests/testlibsyndication.cpp
+++ b/autotests/testlibsyndication.cpp
@@ -1,123 +1,129 @@
/*
This file is part of LibSyndication.
Copyright (C) 2006 Frank Osterfeld
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include "specificdocument.h"
#include "documentsource.h"
#include "feed.h"
#include "parsercollection.h"
#include
#include
#include
#include
#include
using namespace Syndication;
void printUsage(const QString &error)
{
std::cerr << "testlibsyndication - (C) Frank Osterfeld 2006" << std::endl;
std::cerr << std::endl;
if (!error.isNull()) {
std::cerr << error.toUtf8().data() << std::endl;
std::cerr << std::endl;
} else {
std::cerr << "Prints the parsed content of a feed file to standard output." << std::endl;
std::cerr << std::endl;
}
std::cerr << "Usage: testlibsyndication [--specific-format] [--compare ]" << std::endl;
std::cerr << std::endl;
std::cerr << "--specific-format: If set, the debug output for the specific" << std::endl;
std::cerr << "feed format is printed to stdout, otherwise the debug output" << std::endl;
std::cerr << "for the abstraction" << std::endl;
}
int main(int argc, char **argv)
{
qputenv("LC_ALL", "C");
int pcompare = 2;
if (argc < 2) {
printUsage(QStringLiteral("filename expected"));
return 1;
}
QString filename(QFile::decodeName(argv[1]));
bool specificformat = false;
if (filename == QLatin1String("--specific-format")) {
if (argc < 3) {
printUsage(QStringLiteral("filename expected"));
return 1;
}
filename = QFile::decodeName(argv[2]);
specificformat = true;
pcompare += 1;
}
QString expfname;
if (argc >= pcompare + 1 && QString::fromLatin1(argv[pcompare]) == QLatin1String("--compare")) {
expfname = QString::fromLatin1(argv[pcompare + 1]);
}
QFile f(filename);
if (!f.open(QIODevice::ReadOnly|QIODevice::Text)) {
printUsage(QStringLiteral("Couldn't open file"));
return 1;
}
DocumentSource src(f.readAll(), QStringLiteral("http://libsyndicationtest"));
f.close();
FeedPtr ptr(Syndication::parse(src));
if (ptr == nullptr) {
printUsage(QStringLiteral("Couldn't parse file: (%1)").arg(Syndication::parserCollection()->lastError()));
return 1;
}
QString res = specificformat ? ptr->specificDocument()->debugInfo() : ptr->debugInfo();
-
+#if 0
+ QFile headerFile(QStringLiteral("/tmp/bb.txt"));
+ headerFile.open(QIODevice::WriteOnly | QIODevice::Text);
+ QTextStream outHeaderStream(&headerFile);
+ outHeaderStream << res.toLatin1().trimmed();
+ headerFile.close();
+#endif
if (expfname.isNull()) {
std::cout << res.toUtf8().data() << std::endl;
return 0;
} else {
QFile expFile(expfname);
expFile.open(QIODevice::ReadOnly|QIODevice::Text);
QByteArray expected = expFile.readAll();
expFile.close();
if (expected.trimmed() != res.toUtf8().trimmed()) {
qDebug() << "Obtained:\n" << res.toUtf8().trimmed();
qDebug() << "Expected:\n" << expected.trimmed();
return 1;
}
return 0;
}
return 0;
}