Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored and nyalldawson committed Feb 6, 2023
1 parent 3043f19 commit c9e83de
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/src/core/testqgsnewsfeedparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <QSignalSpy>
#include "qgsnewsfeedparser.h"
#include "qgsnewsfeedmodel.h"
#include "qgssettings.h"


class TestQgsNewsFeedParser: public QObject
Expand Down Expand Up @@ -73,7 +72,7 @@ void TestQgsNewsFeedParser::testFetch()

const QUrl url( QUrl::fromLocalFile( QStringLiteral( TEST_DATA_DIR ) + "/newsfeed/feed" ) );
const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() );
QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::sTreeNewsFeed->deleteItem( feedKey );

const qint64 beforeTime = QDateTime::currentDateTimeUtc().toSecsSinceEpoch();

Expand Down Expand Up @@ -115,7 +114,7 @@ void TestQgsNewsFeedParser::testFetch()
QVERIFY( after >= beforeTime );

// reset to a standard known last time
QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::sTreeNewsFeed->deleteItem( feedKey );
QgsNewsFeedParser::settingsFeedLastFetchTime->setValue( 1457360008, feedKey );

// refetch, only new items should be fetched
Expand Down Expand Up @@ -200,7 +199,7 @@ void TestQgsNewsFeedParser::testAutoExpiry()
{
const QUrl url( QStringLiteral( "xxx" ) );
const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() );
QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::sTreeNewsFeed->deleteItem( feedKey );

// ensure entries "auto expire" when past their use-by date
QgsNewsFeedParser::Entry testEntry;
Expand Down Expand Up @@ -228,7 +227,7 @@ void TestQgsNewsFeedParser::testLang()

const QUrl url( QUrl::fromLocalFile( QStringLiteral( TEST_DATA_DIR ) + "/newsfeed/feed" ) );
const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() );
QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::sTreeNewsFeed->deleteItem( feedKey );
// force to Spanish language
QgsNewsFeedParser::settingsFeedLanguage->setValue( QStringLiteral( "es" ), feedKey );

Expand All @@ -255,7 +254,7 @@ void TestQgsNewsFeedParser::testGeoFencing()

const QUrl url( QUrl::fromLocalFile( QStringLiteral( TEST_DATA_DIR ) + "/newsfeed/feed" ) );
const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() );
QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::sTreeNewsFeed->deleteItem( feedKey );
QgsNewsFeedParser::settingsFeedLatitude->setValue( 37.2343, feedKey );
QgsNewsFeedParser::settingsFeedLongitude->setValue( -115.8067, feedKey );

Expand All @@ -282,7 +281,7 @@ void TestQgsNewsFeedParser::testModel()
// test news feed model
const QUrl url( QUrl::fromLocalFile( QStringLiteral( TEST_DATA_DIR ) + "/newsfeed/feed" ) );
const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() );
QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::sTreeNewsFeed->deleteItem( feedKey );

QgsNewsFeedParser parser( url );
const QgsNewsFeedModel model( &parser );
Expand Down Expand Up @@ -361,7 +360,7 @@ void TestQgsNewsFeedParser::testProxyModel()
// test news feed proxy model
const QUrl url( QUrl::fromLocalFile( QStringLiteral( TEST_DATA_DIR ) + "/newsfeed/feed" ) );
const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() );
QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::sTreeNewsFeed->deleteItem( feedKey );

QgsNewsFeedParser parser( url );
const QgsNewsFeedProxyModel model( &parser );
Expand Down

0 comments on commit c9e83de

Please sign in to comment.