Commit b5f41649beb278013df86e18c7bd20f378b1f6d3
- Diff rendering mode:
- inline
- side by side
src/Amarok.h
(2 / 8)
|   | |||
| 127 | 127 | ||
| 128 | 128 | // New in Amarok2 -> recursiveUrlExpand has been replaced | |
| 129 | 129 | // existing code depending on this port need to be changed (max urls is removed) | |
| 130 | AMAROK_EXPORT KUrl::List recursiveUrlExpand( const KUrl &url ); // defined in PlaylistHandler.cpp | ||
| 131 | AMAROK_EXPORT KUrl::List recursiveUrlExpand( const KUrl::List &urls ); // defined in PlaylistHandler.cpp | ||
| 130 | AMAROK_EXPORT KUrl::List recursiveUrlExpand( const KUrl &url ); // defined in PlaylistManager.cpp | ||
| 131 | AMAROK_EXPORT KUrl::List recursiveUrlExpand( const KUrl::List &urls ); // defined in PlaylistManager.cpp | ||
| 132 | 132 | ||
| 133 | 133 | AMAROK_EXPORT QString verboseTimeSince( const QDateTime &datetime ); // defined in App.cpp | |
| 134 | 134 | ||
| 135 | 135 | AMAROK_EXPORT QString verboseTimeSince( uint time_t ); // defined in App.cpp | |
| 136 | 136 | ||
| 137 | 137 | AMAROK_EXPORT QString conciseTimeSince( uint time_t ); // defined in App.cpp | |
| 138 | |||
| 139 | /** | ||
| 140 | * Function that must be used when separating contextBrowser escaped urls | ||
| 141 | */ | ||
| 142 | // defined in App.cpp | ||
| 143 | void albumArtistTrackFromUrl( QString url, QString &artist, QString &album, QString &detail ); | ||
| 144 | 138 | ||
| 145 | 139 | /** | |
| 146 | 140 | * @return the LOWERCASE file extension without the preceding '.', or "" if there is none |
src/App.cpp
(0 / 23)
|   | |||
| 772 | 772 | replace( "%27", "'" ).replace( "%25", "%" ); | |
| 773 | 773 | } | |
| 774 | 774 | ||
| 775 | /** | ||
| 776 | * Function that must be used when separating contextBrowser escaped urls | ||
| 777 | * detail can contain track/discnumber | ||
| 778 | */ | ||
| 779 | void albumArtistTrackFromUrl( QString url, QString &artist, QString &album, QString &detail ) | ||
| 780 | { | ||
| 781 | if ( !url.contains("@@@") ) return; | ||
| 782 | //KHTML removes the trailing space! | ||
| 783 | if ( url.endsWith( " @@@" ) ) | ||
| 784 | url += ' '; | ||
| 785 | |||
| 786 | const QStringList list = url.split( " @@@ ", QString::KeepEmptyParts ); | ||
| 787 | |||
| 788 | int size = list.count(); | ||
| 789 | |||
| 790 | if( size<=0 ) | ||
| 791 | error() << "size<=0"; | ||
| 792 | |||
| 793 | artist = size > 0 ? unescapeHTMLAttr( list[0] ) : ""; | ||
| 794 | album = size > 1 ? unescapeHTMLAttr( list[1] ) : ""; | ||
| 795 | detail = size > 2 ? unescapeHTMLAttr( list[2] ) : ""; | ||
| 796 | } | ||
| 797 | |||
| 798 | 775 | QString verboseTimeSince( const QDateTime &datetime ) | |
| 799 | 776 | { | |
| 800 | 777 | const QDateTime now = QDateTime::currentDateTime(); |
tests/TestAmarok.cpp
(29 / 0)
|   | |||
| 23 | 23 | #include <QDir> | |
| 24 | 24 | #include <QString> | |
| 25 | 25 | ||
| 26 | #include <KStandardDirs> | ||
| 27 | |||
| 26 | 28 | TestAmarok::TestAmarok( QStringList testArgumentList ) | |
| 27 | 29 | { | |
| 28 | 30 | testArgumentList.replace( 2, testArgumentList.at( 2 ) + "Amarok.log" ); | |
| … | … | ||
| 188 | 188 | ||
| 189 | 189 | Amarok::manipulateThe( teststring = "Äöü, The", false ); | |
| 190 | 190 | QCOMPARE( teststring, QString( "The Äöü" ) ); | |
| 191 | } | ||
| 192 | |||
| 193 | void TestAmarok::testRecursiveUrlExpand() | ||
| 194 | { | ||
| 195 | /* There are two overloaded variants of this function */ | ||
| 196 | KUrl url( "" ); | ||
| 197 | KUrl::List urlList, resultList; | ||
| 198 | |||
| 199 | resultList = Amarok::recursiveUrlExpand( url ); | ||
| 200 | QCOMPARE( resultList.isEmpty(), true ); | ||
| 201 | |||
| 202 | resultList = Amarok::recursiveUrlExpand( urlList ); | ||
| 203 | QCOMPARE( resultList.isEmpty(), true ); | ||
| 204 | |||
| 205 | urlList.append( url ); | ||
| 206 | resultList = Amarok::recursiveUrlExpand( urlList ); | ||
| 207 | QCOMPARE( resultList.isEmpty(), true ); | ||
| 208 | |||
| 209 | url = KStandardDirs::installPath( "data" ) + "amarok/testdata/playlists/"; | ||
| 210 | resultList = Amarok::recursiveUrlExpand( url ); | ||
| 211 | QCOMPARE( resultList.size(), 1 ); | ||
| 212 | QCOMPARE( resultList.at( 0 ).pathOrUrl(), url.pathOrUrl() + QString( "no-playlist.png" ) ); // only non-playlist file in that dir | ||
| 213 | |||
| 214 | url = KStandardDirs::installPath( "data" ) + "amarok/testdata/"; | ||
| 215 | resultList = Amarok::recursiveUrlExpand( url ); | ||
| 216 | QCOMPARE( resultList.size(), 1 ); | ||
| 217 | QCOMPARE( resultList.at( 0 ).pathOrUrl(), url.pathOrUrl() + QString( "playlists/no-playlist.png" ) ); | ||
| 191 | 218 | } | |
| 192 | 219 | ||
| 193 | 220 | void TestAmarok::testSaveLocation() |
tests/TestAmarok.h
(1 / 4)
|   | |||
| 38 | 38 | void testEscapeHTMLAttr(); | |
| 39 | 39 | void testExtension(); | |
| 40 | 40 | void testManipulateThe(); | |
| 41 | void testRecursiveUrlExpand(); | ||
| 41 | 42 | void testSaveLocation(); | |
| 42 | 43 | void testUnescapeHTMLAttr(); | |
| 43 | 44 | void testVerboseTimeSince(); | |
| 44 | 45 | void testVfatPath(); | |
| 45 | /*KUrl::List testRecursiveUrlExpand( const KUrl &url ); //defined in PlaylistHandler.cpp | ||
| 46 | KUrl::List testRecursiveUrlExpand( const KUrl::List &urls ); //defined in PlaylistHandler.cpp */ | ||
| 47 | /* void testAlbumArtistTrackFromUrl( QString url, QString &artist, QString &album, QString &detail ); // TODO: needs testdata | ||
| 48 | */ | ||
| 49 | 46 | //KUrl testMostLocalURL( const KUrl &url ); | |
| 50 | 47 | ||
| 51 | 48 | /* |
|   | |||
| 32 | 32 | ||
| 33 | 33 | void TestPlaylistManager::initTestCase() | |
| 34 | 34 | { | |
| 35 | m_testPlaylistPath = KStandardDirs::installPath( "data" ) + "/amarok/testdata/playlists/"; | ||
| 35 | m_testPlaylistPath = KStandardDirs::installPath( "data" ) + "amarok/testdata/playlists/"; | ||
| 36 | 36 | } | |
| 37 | 37 | ||
| 38 | 38 | void TestPlaylistManager::testGetFormat() |

