Skip to content

Commit

Permalink
fixed umlaut rendering in news; updated testcase;
Browse files Browse the repository at this point in the history
  • Loading branch information
andywuest committed Apr 11, 2024
1 parent 8c4b96e commit 6243fe1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions rpm/harbour-watchlist.changes.in
Expand Up @@ -5,6 +5,10 @@
# * date Author's Name <author's email> version-release
# - Summary of changes

* xx.xx.2024 Andreas Wüst <andreas.wuest.freelancer@gmail.com> 0.13.5-1

- fixed special character rendering in news (e.g. Johnson & Johnson)

* 04.04.2024 Andreas Wüst <andreas.wuest.freelancer@gmail.com> 0.13.4-1

- hide dividends payed in the past (for current month)
Expand Down
1 change: 1 addition & 0 deletions src/newsdata/ingdibanews.cpp
Expand Up @@ -112,6 +112,7 @@ QString IngDibaNews::filterContent(QString &content) {
QRegExp whiteSpaces("[\\s\\n]+");
content.replace(allTagsRegExp, " ");
content.replace(whiteSpaces, " ");
content.replace("&amp;", "&");
return content;
}

Expand Down
21 changes: 14 additions & 7 deletions test/cpp/watchlisttests.cpp
Expand Up @@ -76,14 +76,22 @@ void WatchlistTests::testIngDibaNewsProcessSearchResult() {
}

void WatchlistTests::testIngDibaNewsFilterContent() {
QString content = "<p>\n FRANKFURT (Dow Jones)--In der deutschen </p>\n<p>\n Die Vereinigten Staaten .. Lage "
"wünschenswert. </p>\n<p>\n Kontakt zum Autor: unternehmen.de@dowjones.com </p>\n<p>\n DJG/sha "
"</p>\n<p>\n (END) <a href=\"/DE/Showpage.aspx?pageID=45&ISIN=US2605661048&\" title=\"Übersicht "
"Dow Jones\">Dow Jones</a> Newswires</p>\n<p>\n July 04, 2021 11:10 ET (15:10 GMT)</p>";
const QString expectedContent
// given
QString content1
= "<p>\n FRANKFURT (Dow Jones)--In der deutschen </p>\n<p>\n Die Vereinigten Staaten .. Lage "
"wünschenswert. </p>\n<p>\n Kontakt zum Autor: unternehmen.de@dowjones.com </p>\n<p>\n DJG/sha "
"</p>\n<p>\n (END) <a href=\"/DE/Showpage.aspx?pageID=45&ISIN=US2605661048&\" title=\"Übersicht "
"Dow Jones\">Dow Jones</a> Newswires</p>\n<p>\n July 04, 2021 11:10 ET (15:10 GMT)</p>";
const QString expectedContent1
= " FRANKFURT (Dow Jones)--In der deutschen Die Vereinigten Staaten .. Lage wünschenswert. Kontakt zum Autor: "
"unternehmen.de@dowjones.com DJG/sha (END) Dow Jones Newswires July 04, 2021 11:10 ET (15:10 GMT) ";
QCOMPARE(ingDibaNews->filterContent(content), expectedContent);
QString content2 = "<a href=\"/DE/Showpage.aspx?pageID=23&ISIN=US4781601046&\" title=\"Übersicht Johnson & "
"Johnson\">Johnson &amp; Johnson</a> steigerte";
const QString expectedContent2 = " Johnson & Johnson steigerte";

// when - then
QCOMPARE(ingDibaNews->filterContent(content1), expectedContent1);
QCOMPARE(ingDibaNews->filterContent(content2), expectedContent2);
}

void WatchlistTests::testDividendDataUpdateWorkerCalculateConvertedAmount() {
Expand All @@ -104,7 +112,6 @@ void WatchlistTests::testDividendDataUpdateWorkerCalculateConvertedAmount() {
QByteArray WatchlistTests::readFileData(const QString &fileName) {
QFile f("testdata/" + fileName);
if (!f.open(QFile::ReadOnly | QFile::Text)) {
QString msg = "Testfile " + fileName + " not found!";
return QByteArray();
}

Expand Down

0 comments on commit 6243fe1

Please sign in to comment.