[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kget/tests
From: Matthias Fuchs <mat69 () gmx ! net>
Date: 2011-09-10 9:22:53
Message-ID: 20110910092253.6AF90AC882 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1252497 by mfuchs:
Test existing network connection.
Tests:
* Getting network connection
* Losing network connection
M +62 -0 schedulertest.cpp
M +14 -0 schedulertest.h
--- trunk/KDE/kdenetwork/kget/tests/schedulertest.cpp #1252496:1252497
@@ -444,6 +444,68 @@
QTest::newRow("queue stopped, job::stop, notsolveable, aborted") << false << \
Job::Stop << Job::NotSolveable << Job::Aborted; }
+void SchedulerTest::testGettingNetworkConnection()
+{
+ QFETCH(Job::Policy, policy);
+ QFETCH(Job::Status, finalStatus);
+
+ SettingsHelper helper(NO_LIMIT);
+
+ Scheduler scheduler;
+ TestQueue *queue = new TestQueue(&scheduler);
+ scheduler.addQueue(queue);
+ scheduler.setHasNetworkConnection(false);
+
+ TestJob *job = new TestJob(&scheduler, queue);
+ job->setPolicy(policy);
+ queue->appendPub(job);
+
+ scheduler.setHasNetworkConnection(true);
+
+ QCOMPARE(job->policy(), policy);//the policy should remain unchanged
+ QCOMPARE(job->status(), finalStatus);
+}
+
+void SchedulerTest::testGettingNetworkConnection_data()
+{
+ QTest::addColumn<Job::Policy>("policy");
+ QTest::addColumn<Job::Status>("finalStatus");
+
+ QTest::newRow("Start, Running") << Job::Start << Job::Running;
+ QTest::newRow("Stop, Stopped") << Job::Stop << Job::Stopped;
+ QTest::newRow("None, Running") << Job::None << Job::Running;
+}
+
+void SchedulerTest::testLosingNetworkConnection()
+{
+ QFETCH(Job::Policy, policy);
+
+ SettingsHelper helper(NO_LIMIT);
+
+ Scheduler scheduler;
+ TestQueue *queue = new TestQueue(&scheduler);
+ scheduler.addQueue(queue);
+ scheduler.setHasNetworkConnection(true);
+
+ TestJob *job = new TestJob(&scheduler, queue);
+ job->setPolicy(policy);
+ queue->appendPub(job);
+
+ scheduler.setHasNetworkConnection(false);
+
+ QCOMPARE(job->policy(), policy);//the policy should remain unchanged
+ QCOMPARE(job->status(), Job::Stopped);
+}
+
+void SchedulerTest::testLosingNetworkConnection_data()
+{
+ QTest::addColumn<Job::Policy>("policy");
+
+ QTest::newRow("Start") << Job::Start;
+ QTest::newRow("Stop") << Job::Stop;
+ QTest::newRow("None") << Job::None;
+}
+
QTEST_MAIN(SchedulerTest)
#include "schedulertest.moc"
--- trunk/KDE/kdenetwork/kget/tests/schedulertest.h #1252496:1252497
@@ -127,6 +127,20 @@
void testJobErrorType();
void testJobErrorType_data();
+ /**
+ * There is no connection and transfers are added.
+ * Then connection is retrieved.
+ */
+ void testGettingNetworkConnection();
+ void testGettingNetworkConnection_data();
+
+ /**
+ * There is a connection and transfers are added.
+ * Then connection is lost.
+ */
+ void testLosingNetworkConnection();
+ void testLosingNetworkConnection_data();
+
private:
static const int NO_LIMIT;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic