[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kio
From: David Faure <faure () kde ! org>
Date: 2009-03-13 0:09:29
Message-ID: 1236902969.793021.26782.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 938787 by dfaure:
Fix bug noticed by SadEagle and Dario Andres: storedPut didn't emit percent, for lack \
of calling the (relatively new) setTotalSize. With unittest.
M +1 -0 kio/job.cpp
M +22 -1 tests/jobtest.cpp
M +2 -1 tests/jobtest.h
--- trunk/KDE/kdelibs/kio/kio/job.cpp #938786:938787
@@ -1487,6 +1487,7 @@
Q_ASSERT( d->m_data.isNull() ); // check that we're only called once
Q_ASSERT( d->m_uploadOffset == 0 ); // no upload started yet
d->m_data = arr;
+ setTotalSize( d->m_data.size() );
}
QByteArray StoredTransferJob::data() const
--- trunk/KDE/kdelibs/kio/tests/jobtest.cpp #938786:938787
@@ -145,7 +145,7 @@
eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
}
-void JobTest::get()
+void JobTest::storedGet()
{
kDebug() ;
const QString filePath = homeTmpDir() + "fileFromHome";
@@ -220,6 +220,27 @@
emit exitLoop();
}
+void JobTest::storedPut()
+{
+ const QString filePath = homeTmpDir() + "fileFromHome";
+ KUrl u(filePath);
+ QByteArray putData = "This is the put data";
+ KIO::TransferJob* job = KIO::storedPut( putData, u, 0600, KIO::Overwrite | \
KIO::HideProgressInfo ); + QSignalSpy spyPercent(job, SIGNAL(percent(KJob*, \
unsigned long))); + QVERIFY(spyPercent.isValid());
+ QDateTime mtime = QDateTime::currentDateTime().addSecs( -30 ); // 30 seconds ago
+ mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds
+ job->setModificationTime(mtime);
+ job->setUiDelegate( 0 );
+ QVERIFY(job->exec());
+ QFileInfo fileInfo(filePath);
+ QVERIFY(fileInfo.exists());
+ QCOMPARE(fileInfo.size(), (long long)putData.size());
+ QCOMPARE((int)fileInfo.permissions(), (int)(QFile::ReadOwner | QFile::WriteOwner \
| QFile::ReadUser | QFile::WriteUser )); + QCOMPARE(fileInfo.lastModified(), \
mtime); + QVERIFY(!spyPercent.isEmpty());
+}
+
////
void JobTest::copyLocalFile( const QString& src, const QString& dest )
--- trunk/KDE/kdelibs/kio/tests/jobtest.h #938786:938787
@@ -36,8 +36,9 @@
void cleanupTestCase();
// Local tests (kio_file only)
- void get();
+ void storedGet();
void put();
+ void storedPut();
void copyFileToSamePartition();
void copyDirectoryToSamePartition();
void copyDirectoryToExistingDirectory();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic