mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 10:16:34 +01:00
AdBlockTest: Add ignoreEmptyLinesInSubscriptionTest
This commit is contained in:
parent
a3409d2e8f
commit
99eb9c8089
@ -1,6 +1,6 @@
|
||||
/* ============================================================
|
||||
* Falkon - Qt web browser
|
||||
* Copyright (C) 2013 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2013-2018 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -17,6 +17,7 @@
|
||||
* ============================================================ */
|
||||
#include "adblocktest.h"
|
||||
#include "adblockrule.h"
|
||||
#include "adblocksubscription.h"
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
@ -108,4 +109,16 @@ void AdBlockTest::parseRegExpFilterTest()
|
||||
QCOMPARE(rule_test.parseRegExpFilter(parsedFilter), result);
|
||||
}
|
||||
|
||||
void AdBlockTest::ignoreEmptyLinesInSubscriptionTest()
|
||||
{
|
||||
AdBlockSubscription subscription("test-subscription");
|
||||
subscription.setFilePath(":autotests/data/adblock_empty_lines.txt");
|
||||
subscription.loadSubscription({});
|
||||
|
||||
QCOMPARE(subscription.allRules().count(), 3);
|
||||
QCOMPARE(subscription.allRules().at(0)->filter(), QString("filter.com"));
|
||||
QCOMPARE(subscription.allRules().at(1)->filter(), QString("test"));
|
||||
QCOMPARE(subscription.allRules().at(2)->isComment(), true);
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(AdBlockTest)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ============================================================
|
||||
* Falkon - Qt web browser
|
||||
* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2013-2018 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -27,10 +27,10 @@ class AdBlockTest : public QObject
|
||||
private slots:
|
||||
void isMatchingCookieTest_data();
|
||||
void isMatchingCookieTest();
|
||||
|
||||
void parseRegExpFilterTest_data();
|
||||
void parseRegExpFilterTest();
|
||||
|
||||
void ignoreEmptyLinesInSubscriptionTest();
|
||||
};
|
||||
|
||||
#endif // ADBLOCKTEST_H
|
||||
|
@ -2,5 +2,6 @@
|
||||
<qresource prefix="/autotests">
|
||||
<file>data/basic_page.html</file>
|
||||
<file>data/basic_page2.html</file>
|
||||
<file>data/adblock_empty_lines.txt</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
8
autotests/data/adblock_empty_lines.txt
Normal file
8
autotests/data/adblock_empty_lines.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Title: Empty Lines List
|
||||
Url: https://kde.org
|
||||
[Adblock Plus 2.0]
|
||||
|
||||
filter.com
|
||||
test
|
||||
|
||||
! Comment
|
Loading…
Reference in New Issue
Block a user