[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kget
From: Matthias Fuchs <mat69 () gmx ! net>
Date: 2011-04-09 9:29:55
Message-ID: 20110409092955.09A3FAC8D3 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1227473 by mfuchs:
Adds unittests
Metalinker: Urls ending with ".torrent", ".metalink" and ".meta4" are valid now, \
since it could be that they are actually the file that should be downloaded.
M +18 -0 tests/CMakeLists.txt
A tests/metalinktest.cpp [License: GPL (v2+)]
A tests/metalinktest.h [License: GPL (v2+)]
M +2 -12 ui/metalinkcreator/metalinker.cpp
M +7 -8 ui/metalinkcreator/metalinker.h
--- trunk/KDE/kdenetwork/kget/tests/CMakeLists.txt #1227472:1227473
@@ -30,3 +30,21 @@
)
target_link_libraries(verifiertest ${QT_QTTEST_LIBRARY} kgetcore)
+
+
+#===========Metalinker===========
+set(metalinktest_SRCS
+ metalinktest.cpp
+ ../ui/metalinkcreator/metalinker.cpp
+)
+
+kde4_add_unit_test( metalinktest
+ TESTNAME kget-metalinktest
+ ${metalinktest_SRCS}
+)
+
+target_link_libraries(metalinktest ${KDE4_KDECORE_LIBS} ${KDE4_KIO_LIBS} \
${QT_QTTEST_LIBRARY}) +
+if (HAVE_NEPOMUK)
+ target_link_libraries(metalinktest ${SOPRANO_LIBRARIES} ${NEPOMUK_LIBRARIES})
+endif (HAVE_NEPOMUK)
--- trunk/KDE/kdenetwork/kget/ui/metalinkcreator/metalinker.cpp #1227472:1227473
@@ -303,7 +303,7 @@
bool KGetMetalink::Metaurl::isValid()
{
- return url.isValid() && !type.isEmpty();
+ return url.isValid() && url.hasHost() && !url.protocol().isEmpty() && \
!type.isEmpty(); }
void KGetMetalink::Metaurl::clear()
@@ -358,19 +358,9 @@
bool KGetMetalink::Url::isValid()
{
- bool valid = url.isValid();
- if (url.fileName().endsWith(QLatin1String(".torrent")))
- {
- valid = false;
+ return url.isValid() && url.hasHost() && !url.protocol().isEmpty();
}
- else if (url.fileName().endsWith(QLatin1String(".metalink")) || \
url.fileName().endsWith(QLatin1String(".meta4")))
- {
- valid = false;
- }
- return valid;
-}
-
void KGetMetalink::Url::clear()
{
priority = 0;
--- trunk/KDE/kdenetwork/kget/ui/metalinkcreator/metalinker.h #1227472:1227473
@@ -247,6 +247,13 @@
bool isValid() const;
+ /**
+ * Controlls if the name attribute is valid, i.e. it is not empty and
+ * does not contain any directory traversal directives or information,
+ * as described in the Metalink 4.0 specification 4.1.2.1.
+ */
+ bool isValidNameAttribute() const;
+
#ifdef HAVE_NEPOMUK
/**
* Return Nepomuk-properties that can be extracted of file, only including \
data @@ -259,14 +266,6 @@
KIO::filesize_t size;
CommonData data;
Resources resources;
-
- private:
- /**
- * Controlls if the name attribute is valid, i.e. it is not empty and
- * does not contain any directory traversal directives or information,
- * as described in the Metalink 4.0 specification 4.1.2.1.
- */
- bool isValidNameAttribute() const;
};
class Files
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic