File indexing completed on 2024-04-21 04:48:05

0001 /***************************************************************************
0002  *   Copyright (c) 2009 Sven Krohlas <sven@asbest-online.de>               *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  *                                                                         *
0009  *   This program is distributed in the hope that it will be useful,       *
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0012  *   GNU General Public License for more details.                          *
0013  *                                                                         *
0014  *   You should have received a copy of the GNU General Public License     *
0015  *   along with this program; if not, write to the                         *
0016  *   Free Software Foundation, Inc.,                                       *
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0018  ***************************************************************************/
0019 
0020 #include "TestAmarok.h"
0021 #include "core/support/Amarok.h"
0022 #include "config-amarok-test.h"
0023 
0024 #include <QTest>
0025 #include <QDir>
0026 #include <QDateTime>
0027 
0028 
0029 QTEST_MAIN( TestAmarok )
0030 
0031 TestAmarok::TestAmarok()
0032 {}
0033 
0034 QString
0035 TestAmarok::dataPath( const QString &relPath )
0036 {
0037     return QDir::toNativeSeparators( QString( AMAROK_TEST_DIR ) + '/' + relPath );
0038 }
0039 
0040 void TestAmarok::testAsciiPath()
0041 {
0042     QCOMPARE( Amarok::asciiPath( "" ), QString( "" ) );
0043     QCOMPARE( Amarok::asciiPath( "/home/sven" ), QString( "/home/sven" ) );
0044 
0045     QCOMPARE( Amarok::asciiPath( QString::fromUtf8( "/äöü" ) ), QString( "/___" ) );
0046     QCOMPARE( Amarok::asciiPath( QString::fromUtf8( "/äöütest" ) ), QString( "/___test" ) );
0047     QCOMPARE( Amarok::asciiPath( QString::fromUtf8( "/äöü/test" ) ), QString( "/___/test" ) );
0048     QCOMPARE( Amarok::asciiPath( QString::fromUtf8( "/123/" ) ), QString( "/123/" ) );
0049     QCOMPARE( Amarok::asciiPath( QString::fromUtf8( "/.hidden" ) ), QString( "/.hidden" ) );
0050     QCOMPARE( Amarok::asciiPath( QString::fromUtf8( "/here be dragons" ) ), QString( "/here be dragons" ) );
0051     QCOMPARE( Amarok::asciiPath( QString::fromUtf8( "/!important/some%20stuff/what's this?" ) ), QString( "/!important/some%20stuff/what's this?" ) );
0052 
0053     /* 0x7F = 127 = DEL control character, explicitly ok on *nix file systems */
0054     QCOMPARE( Amarok::asciiPath( QString( "/abc" ) + QChar( 0x7F ) + ".1" ), QString( QString( "/abc" ) + QChar( 0x7F ) + ".1" ) );
0055 
0056     /* random control character: ok */
0057     QCOMPARE( Amarok::asciiPath( QString( "/abc" ) + QChar( 0x07 ) + ".1" ), QString( QString( "/abc" ) + QChar( 0x07 ) + ".1" ) );
0058 
0059     /* null byte is not ok */
0060     QCOMPARE( Amarok::asciiPath( QString( "/abc" ) + QChar( 0x00 ) + ".1" ), QString( "/abc_.1" ) );
0061 }
0062 
0063 void TestAmarok::testCleanPath()
0064 {
0065     /* no changes expected here */
0066     QCOMPARE( Amarok::cleanPath( QString( "" ) ), QString( "" ) );
0067     QCOMPARE( Amarok::cleanPath( QString( "abcdefghijklmnopqrstuvwxyz" ) ), QString( "abcdefghijklmnopqrstuvwxyz" ) );
0068     QCOMPARE( Amarok::cleanPath( QString( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) ), QString( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) );
0069     QCOMPARE( Amarok::cleanPath( QString( "/\\.,-+" ) ), QString( "/\\.,-+" ) );
0070 
0071     /* German */
0072     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "äöüß" ) ), QString( "aeoeuess" ) );
0073     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "ÄÖÜß" ) ), QString( "AeOeUess" ) ); // capital ß only exists in theory in the German language, but had been defined some time ago, iirc
0074 
0075     /* French */
0076     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "áàéèêô" ) ), QString( "aaeeeo" ) );
0077     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "ÁÀÉÈÊÔ" ) ), QString( "AAEEEO" ) );
0078     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "æ" ) ), QString( "ae" ) );
0079     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "Æ" ) ), QString( "AE" ) );
0080 
0081     /* Czech and other east European languages */
0082     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "çńǹýỳź" ) ), QString( "cnnyyz" ) );
0083     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "ÇŃǸÝỲŹ" ) ), QString( "CNNYYZ" ) );
0084     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "ěĺľôŕřůž" ) ), QString( "ellorruz" ) );
0085     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "ÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ" ) ), QString( "ACDEEINORSTUUYZ" ) );
0086 
0087     /* Skandinavian languages */
0088     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "åø" ) ), QString( "aoe" ) );
0089     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "ÅØ" ) ), QString( "AOE" ) );
0090 
0091     /* Spanish */
0092     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "ñóÿ" ) ), QString( "noy" ) );
0093     QCOMPARE( Amarok::cleanPath( QString::fromUtf8( "ÑÓŸ" ) ), QString( "NOY" ) );
0094 
0095     /* add missing ones here */
0096 }
0097 
0098 void TestAmarok::testComputeScore()
0099 {
0100      QVERIFY( 50 < Amarok::computeScore( 50, 1,  1 ) ); // greater score if played completely
0101      QVERIFY(  0 < Amarok::computeScore(  0, 1,  1 ) ); // handle 0 score
0102      QVERIFY( 50 > Amarok::computeScore( 50, 1,  0.1 ) ); // lower score if aborted early
0103      QVERIFY( 50 > Amarok::computeScore( 50, 1,  0 ) ); // handle 0% played fraction
0104      QVERIFY( 50 > Amarok::computeScore( 50, 0,  0 ) ); // handle 0 playcount
0105 }
0106 
0107 void TestAmarok::testConciseTimeSince()
0108 {
0109     QCOMPARE( Amarok::conciseTimeSince( 0 ).isEmpty(), false );
0110     QCOMPARE( Amarok::conciseTimeSince( 10 ).isEmpty(), false );
0111     QCOMPARE( Amarok::conciseTimeSince( 100 ).isEmpty(), false );
0112     QCOMPARE( Amarok::conciseTimeSince( 1000 ).isEmpty(), false );
0113     /* any other good ideas what to test here? */
0114 }
0115 
0116 
0117 void TestAmarok::testExtension()
0118 {
0119     QCOMPARE( Amarok::extension( "" ), QString( "" ) );
0120     QCOMPARE( Amarok::extension( "..." ), QString( "" ) );
0121     QCOMPARE( Amarok::extension( "test" ), QString( "" ) );
0122     QCOMPARE( Amarok::extension( "test." ), QString( "" ) );
0123     QCOMPARE( Amarok::extension( "test.mp3" ), QString( "mp3" ) );
0124     QCOMPARE( Amarok::extension( "test.mP3" ), QString( "mp3" ) );
0125     QCOMPARE( Amarok::extension( "test.MP3" ), QString( "mp3" ) );
0126     QCOMPARE( Amarok::extension( "test.longextension" ), QString( "longextension" ) );
0127     QCOMPARE( Amarok::extension( "test.long.extension" ), QString( "extension" ) );
0128     QCOMPARE( Amarok::extension( "test.m" ), QString( "m" ) );
0129     QCOMPARE( Amarok::extension( QString::fromUtf8( "test.äöü" ) ), QString::fromUtf8( "äöü" ) );
0130     QCOMPARE( Amarok::extension( QString::fromUtf8( "test.ÄÖÜ" ) ), QString::fromUtf8( "äöü" ) );
0131     QCOMPARE( Amarok::extension( "..test.mp3" ), QString( "mp3" ) );
0132     QCOMPARE( Amarok::extension( "..te st.mp3" ), QString( "mp3" ) );
0133     QCOMPARE( Amarok::extension( "..te st.m p3" ), QString( "m p3" ) );
0134 }
0135 
0136 void TestAmarok::testManipulateThe()
0137 {
0138     QString teststring;
0139 
0140     Amarok::manipulateThe( teststring = "", true );
0141     QCOMPARE( teststring, QString( "" ) );
0142 
0143     Amarok::manipulateThe( teststring = "", false );
0144     QCOMPARE( teststring, QString( "" ) );
0145 
0146     Amarok::manipulateThe( teststring = 'A', true );
0147     QCOMPARE( teststring, QString( "A" ) );
0148 
0149     Amarok::manipulateThe( teststring = 'A', false );
0150     QCOMPARE( teststring, QString( "A" ) );
0151 
0152     Amarok::manipulateThe( teststring = "ABC", true );
0153     QCOMPARE( teststring, QString( "ABC" ) );
0154 
0155     Amarok::manipulateThe( teststring = "ABC", false );
0156     QCOMPARE( teststring, QString( "ABC" ) );
0157 
0158     Amarok::manipulateThe( teststring = "The Eagles", true );
0159     QCOMPARE( teststring, QString( "Eagles, The" ) );
0160 
0161     Amarok::manipulateThe( teststring = "Eagles, The", false );
0162     QCOMPARE( teststring, QString( "The Eagles" ) );
0163 
0164     Amarok::manipulateThe( teststring = "The The", true );
0165     QCOMPARE( teststring, QString( "The, The" ) );
0166 
0167     Amarok::manipulateThe( teststring = "The, The", false );
0168     QCOMPARE( teststring, QString( "The The" ) );
0169 
0170     Amarok::manipulateThe( teststring = "Something else", true );
0171     QCOMPARE( teststring, QString( "Something else" ) );
0172 
0173     Amarok::manipulateThe( teststring = "The Äöü", true );
0174     QCOMPARE( teststring, QString( "Äöü, The" ) );
0175 
0176     Amarok::manipulateThe( teststring = QString::fromUtf8( "Äöü, The" ), false );
0177     QCOMPARE( teststring, QString::fromUtf8( "The Äöü" ) );
0178 }
0179 
0180 void TestAmarok::testSaveLocation()
0181 {
0182     QString saveLocation = Amarok::saveLocation();
0183     QDir saveLocationDir( saveLocation );
0184 
0185     QCOMPARE( saveLocationDir.exists(), true );
0186     QCOMPARE( QDir::isAbsolutePath( saveLocation ), true );
0187     QCOMPARE( saveLocationDir.isReadable(), true );
0188     /* any other good ideas what to test here? */
0189 }
0190 
0191 void TestAmarok::testVerboseTimeSince()
0192 {
0193     /* There are two overloaded variants of this function */
0194     QCOMPARE( Amarok::verboseTimeSince( 0 ).isEmpty(), false );
0195     QCOMPARE( Amarok::verboseTimeSince( QDateTime::fromSecsSinceEpoch( 0 ) ).isEmpty(), false );
0196 
0197     QCOMPARE( Amarok::verboseTimeSince( 10 ).isEmpty(), false );
0198     QCOMPARE( Amarok::verboseTimeSince( QDateTime::fromSecsSinceEpoch( 10 ) ).isEmpty(), false );
0199 
0200     QCOMPARE( Amarok::verboseTimeSince( 100 ).isEmpty(), false );
0201     QCOMPARE( Amarok::verboseTimeSince( QDateTime::fromSecsSinceEpoch( 100 ) ).isEmpty(), false );
0202 
0203     QCOMPARE( Amarok::verboseTimeSince( 1000 ).isEmpty(), false );
0204     QCOMPARE( Amarok::verboseTimeSince( QDateTime::fromSecsSinceEpoch( 1000 ) ).isEmpty(), false );
0205     /* any other good ideas what to test here? */
0206 }
0207 
0208 void TestAmarok::testVfatPath()
0209 {
0210     QCOMPARE( Amarok::vfatPath( "" ), QString( "" ) );
0211 
0212     /* allowed characters */
0213     QCOMPARE( Amarok::vfatPath( "abcdefghijklmnopqrstuvwxyz" ), QString( "abcdefghijklmnopqrstuvwxyz" ) );
0214     QCOMPARE( Amarok::vfatPath( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ), QString( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) );
0215     QCOMPARE( Amarok::vfatPath( "0123456789" ), QString( "0123456789" ) );
0216     QCOMPARE( Amarok::vfatPath( "! # $ % & ' ( ) - @ ^ _ ` { } ~" ), QString( "! # $ % & ' ( ) - @ ^ _ ` { } ~" ) );
0217 
0218     /* only allowed in long file names */
0219     QCOMPARE( Amarok::vfatPath( "+,.;=[]" ), QString( "+,.;=()" ) );
0220 
0221     /* illegal characters, without / and \ (see later tests) */
0222     QCOMPARE( Amarok::vfatPath( "\"_*_:_<_>_?_|" ), QString( "_____________" ) );
0223 
0224     /* illegal control characters: 0-31, 127 */
0225     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x00 ) + QChar( 0x01 ) + QChar( 0x02 ) + ".1" ), QString( "abc___.1" ) );
0226     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x03 ) + QChar( 0x04 ) + QChar( 0x05 ) + ".1" ), QString( "abc___.1" ) );
0227     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x06 ) + QChar( 0x07 ) + QChar( 0x08 ) + ".1" ), QString( "abc___.1" ) );
0228     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x09 ) + QChar( 0x0A ) + QChar( 0x0B ) + ".1" ), QString( "abc___.1" ) );
0229     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x0C ) + QChar( 0x0D ) + QChar( 0x0E ) + ".1" ), QString( "abc___.1" ) );
0230 
0231     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x0F ) + QChar( 0x10 ) + QChar( 0x11 ) + ".1" ), QString( "abc___.1" ) );
0232     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x12 ) + QChar( 0x13 ) + QChar( 0x14 ) + ".1" ), QString( "abc___.1" ) );
0233     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x15 ) + QChar( 0x16 ) + QChar( 0x17 ) + ".1" ), QString( "abc___.1" ) );
0234     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x18 ) + QChar( 0x19 ) + QChar( 0x1A ) + ".1" ), QString( "abc___.1" ) );
0235     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x1B ) + QChar( 0x1C ) + QChar( 0x1D ) + ".1" ), QString( "abc___.1" ) );
0236     QCOMPARE( Amarok::vfatPath( QString( "abc" ) + QChar( 0x1E ) + QChar( 0x7F ) + ".1" ), QString( "abc__.1" ) ); // 0x7F = 127 = DEL control character
0237 
0238     /* trailing spaces in extension, directory and file names are being ignored (!) */
0239     QCOMPARE( Amarok::vfatPath( "test   " ), QString( "test  _" ) );
0240     QCOMPARE( Amarok::vfatPath( "   test   " ), QString( "   test  _" ) );
0241     QCOMPARE( Amarok::vfatPath( "test.ext   " ), QString( "test.ext  _" ) );
0242     QCOMPARE( Amarok::vfatPath( "test   .ext   " ), QString( "test  _.ext  _" ) );
0243     QCOMPARE( Amarok::vfatPath( "   test   .ext   " ), QString( "   test  _.ext  _" ) ); // yes, really!
0244 
0245     /* trailing dot in directory and file names are unsupported are being ignored (!) */
0246     QCOMPARE( Amarok::vfatPath( "test..." ), QString( "test.._" ) );
0247     QCOMPARE( Amarok::vfatPath( "...test..." ), QString( "...test.._" ) );
0248     QCOMPARE( Amarok::vfatPath( "test.ext..." ), QString( "test.ext.._" ) );
0249     QCOMPARE( Amarok::vfatPath( "test....ext..." ), QString( "test....ext.._" ) );
0250     QCOMPARE( Amarok::vfatPath( "...test....ext..." ), QString( "...test....ext.._" ) );
0251 
0252     /* more tests of trailing spaces and dot in directory names for Windows */
0253     QCOMPARE( Amarok::vfatPath( "\\some\\folder   \\", Amarok::WindowsBehaviour ), QString( "\\some\\folder  _\\" ) );
0254     QCOMPARE( Amarok::vfatPath( "\\some   \\folder   \\", Amarok::WindowsBehaviour ), QString( "\\some  _\\folder  _\\" ) );
0255     QCOMPARE( Amarok::vfatPath( "\\...some   \\ev  il   \\folders...\\", Amarok::WindowsBehaviour ), QString( "\\...some  _\\ev  il  _\\folders.._\\" ) );
0256     QCOMPARE( Amarok::vfatPath( "\\some\\fol/der   \\", Amarok::WindowsBehaviour ), QString( "\\some\\fol_der  _\\" ) );
0257     QCOMPARE( Amarok::vfatPath( "\\some...\\folder...\\", Amarok::WindowsBehaviour ), QString( "\\some.._\\folder.._\\" ) );
0258     QCOMPARE( Amarok::vfatPath( "\\some\\fol/der...\\", Amarok::WindowsBehaviour ), QString( "\\some\\fol_der.._\\" ) );
0259     QCOMPARE( Amarok::vfatPath( "\\so..me.\\folder  .\\", Amarok::WindowsBehaviour ), QString( "\\so..me_\\folder  _\\" ) );
0260     QCOMPARE( Amarok::vfatPath( ".\\any", Amarok::WindowsBehaviour ), QString( ".\\any" ) );
0261     QCOMPARE( Amarok::vfatPath( "..\\any", Amarok::WindowsBehaviour ), QString( "..\\any" ) );
0262     QCOMPARE( Amarok::vfatPath( "...\\any", Amarok::WindowsBehaviour ), QString( ".._\\any" ) );
0263     QCOMPARE( Amarok::vfatPath( "a..\\any", Amarok::WindowsBehaviour ), QString( "a._\\any" ) );
0264     QCOMPARE( Amarok::vfatPath( "any\\.\\any.", Amarok::WindowsBehaviour ), QString( "any\\.\\any_" ) );
0265     QCOMPARE( Amarok::vfatPath( "any\\..\\any ", Amarok::WindowsBehaviour ), QString( "any\\..\\any_" ) );
0266     QCOMPARE( Amarok::vfatPath( "any.\\...\\any", Amarok::WindowsBehaviour ), QString( "any_\\.._\\any" ) );
0267     QCOMPARE( Amarok::vfatPath( "any \\a..\\any", Amarok::WindowsBehaviour ), QString( "any_\\a._\\any" ) );
0268     QCOMPARE( Amarok::vfatPath( "Music\\R.E.M.\\Automatic for the people", Amarok::WindowsBehaviour ), QString( "Music\\R.E.M_\\Automatic for the people" ) );
0269 
0270     /* more tests of trailing spaces and dot in directory names for Unix */
0271     QCOMPARE( Amarok::vfatPath( "/some/folder   /", Amarok::UnixBehaviour ), QString( "/some/folder  _/" ) );
0272     QCOMPARE( Amarok::vfatPath( "/some   /folder   /", Amarok::UnixBehaviour ), QString( "/some  _/folder  _/" ) );
0273     QCOMPARE( Amarok::vfatPath( "/...some   /ev  il   /folders.../", Amarok::UnixBehaviour ), QString( "/...some  _/ev  il  _/folders.._/" ) );
0274     QCOMPARE( Amarok::vfatPath( "/some/fol\\der   /", Amarok::UnixBehaviour ), QString( "/some/fol_der  _/" ) );
0275     QCOMPARE( Amarok::vfatPath( "/some.../folder.../", Amarok::UnixBehaviour ), QString( "/some.._/folder.._/" ) );
0276     QCOMPARE( Amarok::vfatPath( "/some/fol\\der.../", Amarok::UnixBehaviour ), QString( "/some/fol_der.._/" ) );
0277     QCOMPARE( Amarok::vfatPath( "/so..me./folder  ./", Amarok::UnixBehaviour ), QString( "/so..me_/folder  _/" ) );
0278     QCOMPARE( Amarok::vfatPath( "./any", Amarok::UnixBehaviour ), QString( "./any" ) );
0279     QCOMPARE( Amarok::vfatPath( "../any", Amarok::UnixBehaviour ), QString( "../any" ) );
0280     QCOMPARE( Amarok::vfatPath( ".../any", Amarok::UnixBehaviour ), QString( ".._/any" ) );
0281     QCOMPARE( Amarok::vfatPath( "a../any", Amarok::UnixBehaviour ), QString( "a._/any" ) );
0282     QCOMPARE( Amarok::vfatPath( "any/./any.", Amarok::UnixBehaviour ), QString( "any/./any_" ) );
0283     QCOMPARE( Amarok::vfatPath( "any/../any ", Amarok::UnixBehaviour ), QString( "any/../any_" ) );
0284     QCOMPARE( Amarok::vfatPath( "any./.../any", Amarok::UnixBehaviour ), QString( "any_/.._/any" ) );
0285     QCOMPARE( Amarok::vfatPath( "any /a../any", Amarok::UnixBehaviour ), QString( "any_/a._/any" ) );
0286     QCOMPARE( Amarok::vfatPath( "Music/R.E.M./Automatic for the people", Amarok::UnixBehaviour ), QString( "Music/R.E.M_/Automatic for the people" ) );
0287 
0288     /* Stepping deeper into M$ hell: reserved device names
0289      * See http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx */
0290     QCOMPARE( Amarok::vfatPath( "CLOCK$" ), QString( "_CLOCK$" ) );
0291     /* this one IS allowed according to
0292      * http://en.wikipedia.org/w/index.php?title=Filename&oldid=303934888#Comparison_of_file_name_limitations */
0293     QCOMPARE( Amarok::vfatPath( "CLOCK$.ext" ), QString( "CLOCK$.ext" ) );
0294 
0295     QCOMPARE( Amarok::vfatPath( "CON" ), QString( "_CON" ) );
0296     QCOMPARE( Amarok::vfatPath( "CON.ext" ), QString( "_CON.ext" ) );
0297 
0298     QCOMPARE( Amarok::vfatPath( "PRN" ), QString( "_PRN" ) );
0299     QCOMPARE( Amarok::vfatPath( "PRN.ext" ), QString( "_PRN.ext" ) );
0300 
0301     QCOMPARE( Amarok::vfatPath( "AUX" ), QString( "_AUX" ) );
0302     QCOMPARE( Amarok::vfatPath( "AUX.ext" ), QString( "_AUX.ext" ) );
0303 
0304     QCOMPARE( Amarok::vfatPath( "NUL" ), QString( "_NUL" ) );
0305     QCOMPARE( Amarok::vfatPath( "NUL.ext" ), QString( "_NUL.ext" ) );
0306 
0307     QCOMPARE( Amarok::vfatPath( "COM1" ), QString( "_COM1" ) );
0308     QCOMPARE( Amarok::vfatPath( "COM1.ext" ), QString( "_COM1.ext" ) );
0309 
0310     QCOMPARE( Amarok::vfatPath( "COM2" ), QString( "_COM2" ) );
0311     QCOMPARE( Amarok::vfatPath( "COM2.ext" ), QString( "_COM2.ext" ) );
0312 
0313     QCOMPARE( Amarok::vfatPath( "COM3" ), QString( "_COM3" ) );
0314     QCOMPARE( Amarok::vfatPath( "COM3.ext" ), QString( "_COM3.ext" ) );
0315 
0316     QCOMPARE( Amarok::vfatPath( "COM4" ), QString( "_COM4" ) );
0317     QCOMPARE( Amarok::vfatPath( "COM4.ext" ), QString( "_COM4.ext" ) );
0318 
0319     QCOMPARE( Amarok::vfatPath( "COM5" ), QString( "_COM5" ) );
0320     QCOMPARE( Amarok::vfatPath( "COM5.ext" ), QString( "_COM5.ext" ) );
0321 
0322     QCOMPARE( Amarok::vfatPath( "COM6" ), QString( "_COM6" ) );
0323     QCOMPARE( Amarok::vfatPath( "COM6.ext" ), QString( "_COM6.ext" ) );
0324 
0325     QCOMPARE( Amarok::vfatPath( "COM7" ), QString( "_COM7" ) );
0326     QCOMPARE( Amarok::vfatPath( "COM7.ext" ), QString( "_COM7.ext" ) );
0327 
0328     QCOMPARE( Amarok::vfatPath( "COM8" ), QString( "_COM8" ) );
0329     QCOMPARE( Amarok::vfatPath( "COM8.ext" ), QString( "_COM8.ext" ) );
0330 
0331     QCOMPARE( Amarok::vfatPath( "COM9" ), QString( "_COM9" ) );
0332     QCOMPARE( Amarok::vfatPath( "COM9.ext" ), QString( "_COM9.ext" ) );
0333 
0334     QCOMPARE( Amarok::vfatPath( "LPT1" ), QString( "_LPT1" ) );
0335     QCOMPARE( Amarok::vfatPath( "LPT1.ext" ), QString( "_LPT1.ext" ) );
0336 
0337     QCOMPARE( Amarok::vfatPath( "LPT2" ), QString( "_LPT2" ) );
0338     QCOMPARE( Amarok::vfatPath( "LPT2.ext" ), QString( "_LPT2.ext" ) );
0339 
0340     QCOMPARE( Amarok::vfatPath( "LPT3" ), QString( "_LPT3" ) );
0341     QCOMPARE( Amarok::vfatPath( "LPT3.ext" ), QString( "_LPT3.ext" ) );
0342 
0343     QCOMPARE( Amarok::vfatPath( "LPT4" ), QString( "_LPT4" ) );
0344     QCOMPARE( Amarok::vfatPath( "LPT4.ext" ), QString( "_LPT4.ext" ) );
0345 
0346     QCOMPARE( Amarok::vfatPath( "LPT5" ), QString( "_LPT5" ) );
0347     QCOMPARE( Amarok::vfatPath( "LPT5.ext" ), QString( "_LPT5.ext" ) );
0348 
0349     QCOMPARE( Amarok::vfatPath( "LPT6" ), QString( "_LPT6" ) );
0350     QCOMPARE( Amarok::vfatPath( "LPT6.ext" ), QString( "_LPT6.ext" ) );
0351 
0352     QCOMPARE( Amarok::vfatPath( "LPT7" ), QString( "_LPT7" ) );
0353     QCOMPARE( Amarok::vfatPath( "LPT7.ext" ), QString( "_LPT7.ext" ) );
0354 
0355     QCOMPARE( Amarok::vfatPath( "LPT8" ), QString( "_LPT8" ) );
0356     QCOMPARE( Amarok::vfatPath( "LPT8.ext" ), QString( "_LPT8.ext" ) );
0357 
0358     QCOMPARE( Amarok::vfatPath( "LPT9" ), QString( "_LPT9" ) );
0359     QCOMPARE( Amarok::vfatPath( "LPT9.ext" ), QString( "_LPT9.ext" ) );
0360 
0361     /* Device names in different cases: */
0362     QCOMPARE( Amarok::vfatPath( "con" ), QString( "_con" ) );
0363     QCOMPARE( Amarok::vfatPath( "con.ext" ), QString( "_con.ext" ) );
0364 
0365     QCOMPARE( Amarok::vfatPath( "cON" ), QString( "_cON" ) );
0366     QCOMPARE( Amarok::vfatPath( "cON.ext" ), QString( "_cON.ext" ) );
0367 
0368     /* This one is ok :) */
0369     QCOMPARE( Amarok::vfatPath( "CONCERT" ), QString( "CONCERT" ) );
0370     QCOMPARE( Amarok::vfatPath( "CONCERT.ext" ), QString( "CONCERT.ext" ) );
0371 }