Commit 1a494848d09fe389145d12ffeaba3bb26aa85df4
- Diff rendering mode:
- inline
- side by side
src/App.cpp
(2 / 0)
|   | |||
| 93 | 93 | #include "TestDirectoryLoader.h" | |
| 94 | 94 | #include "TestExpression.h" | |
| 95 | 95 | #include "TestPlaylistManager.h" | |
| 96 | #include "TestQStringx.h" | ||
| 96 | 97 | #include "TestSmartPointerList.h" | |
| 97 | 98 | #endif // DEBUG | |
| 98 | 99 | ||
| … | … | ||
| 591 | 591 | TestDirectoryLoader testDirectoryLoader ( testArgumentList ); | |
| 592 | 592 | TestExpression testExpression ( testArgumentList ); | |
| 593 | 593 | TestPlaylistManager testPlaylistManager ( testArgumentList ); | |
| 594 | TestQStringx testQStringx( testArgumentList ); | ||
| 594 | 595 | TestSmartPointerList testSmartPointerList( testArgumentList ); | |
| 595 | 596 | ||
| 596 | 597 | /* add more test classes here ^^ */ |
src/CMakeLists.txt
(1 / 0)
|   | |||
| 575 | 575 | ../tests/TestCaseConverter.cpp | |
| 576 | 576 | ../tests/TestDirectoryLoader.cpp | |
| 577 | 577 | ../tests/TestExpression.cpp | |
| 578 | ../tests/TestQStringx.cpp | ||
| 578 | 579 | ../tests/TestSmartPointerList.cpp | |
| 579 | 580 | ) | |
| 580 | 581 | endif(CMAKE_BUILD_TYPE MATCHES debugfull) |
src/QStringx.h
(2 / 2)
|   | |||
| 49 | 49 | QList<QString>::ConstIterator endArgs = args.constEnd(); | |
| 50 | 50 | QString merged = (*itrText); | |
| 51 | 51 | ++itrText; | |
| 52 | while ( itrText != endText && itrArgs != endArgs ) | ||
| 52 | while( itrText != endText && itrArgs != endArgs ) | ||
| 53 | 53 | { | |
| 54 | 54 | merged += (*itrArgs) + (*itrText); | |
| 55 | 55 | ++itrText; | |
| 56 | 56 | ++itrArgs; | |
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | Q_ASSERT( itrText == text.end() && itrArgs == args.end() ); | ||
| 59 | Q_ASSERT( itrText == text.end() || itrArgs == args.end() ); | ||
| 60 | 60 | ||
| 61 | 61 | return merged; | |
| 62 | 62 | } |
tests/CMakeLists.txt
(7 / 5)
|   | |||
| 6 | 6 | ../src/playlistmanager/ | |
| 7 | 7 | ) | |
| 8 | 8 | ||
| 9 | QT4_AUTOMOC( TestAmarok.cpp ) | ||
| 10 | QT4_AUTOMOC( TestCaseConverter.cpp ) | ||
| 11 | QT4_AUTOMOC( TestDirectoryLoader.cpp ) | ||
| 12 | QT4_AUTOMOC( TestExpression.cpp ) | ||
| 13 | QT4_AUTOMOC( TestSmartPointerList.cpp ) | ||
| 9 | QT4_AUTOMOC( TestAmarok.cpp | ||
| 10 | TestCaseConverter.cpp | ||
| 11 | TestDirectoryLoader.cpp | ||
| 12 | TestExpression.cpp | ||
| 13 | TestQStringx.cpp | ||
| 14 | TestSmartPointerList.cpp | ||
| 15 | ) | ||
| 14 | 16 | ||
| 15 | 17 | add_subdirectory( data ) | |
| 16 | 18 | add_subdirectory( playlistmanager ) |
tests/TestQStringx.cpp
(67 / 0)
|   | |||
| 1 | /*************************************************************************** | ||
| 2 | * Copyright (c) 2009 Sven Krohlas <sven@getamarok.com> * | ||
| 3 | * * | ||
| 4 | * This program is free software; you can redistribute it and/or modify * | ||
| 5 | * it under the terms of the GNU General Public License as published by * | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or * | ||
| 7 | * (at your option) any later version. * | ||
| 8 | * * | ||
| 9 | * This program is distributed in the hope that it will be useful, * | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
| 12 | * GNU General Public License for more details. * | ||
| 13 | * * | ||
| 14 | * You should have received a copy of the GNU General Public License * | ||
| 15 | * along with this program; if not, write to the * | ||
| 16 | * Free Software Foundation, Inc., * | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
| 18 | ***************************************************************************/ | ||
| 19 | |||
| 20 | #include "TestQStringx.h" | ||
| 21 | |||
| 22 | TestQStringx::TestQStringx( QStringList testArgumentList ) | ||
| 23 | { | ||
| 24 | testArgumentList.replace( 2, testArgumentList.at( 2 ) + "QStringx.log" ); | ||
| 25 | QTest::qExec( this, testArgumentList ); | ||
| 26 | } | ||
| 27 | |||
| 28 | void TestQStringx::testArgs() | ||
| 29 | { | ||
| 30 | QStringList testArgs; | ||
| 31 | |||
| 32 | m_testString = ""; | ||
| 33 | QCOMPARE( m_testString.args( testArgs ) , QString( "" ) ); | ||
| 34 | |||
| 35 | m_testString = "test"; | ||
| 36 | QCOMPARE( m_testString.args( testArgs ), QString( "test" ) ); | ||
| 37 | |||
| 38 | m_testString = ""; | ||
| 39 | testArgs.append( "test" ); | ||
| 40 | QCOMPARE( m_testString.args( testArgs ), QString( "" ) ); | ||
| 41 | |||
| 42 | m_testString = "test%12abc"; | ||
| 43 | QCOMPARE( m_testString.args( testArgs ) , QString( "testtestabc" ) ); | ||
| 44 | |||
| 45 | m_testString = "%12test abc"; | ||
| 46 | QCOMPARE( m_testString.args( testArgs ) , QString( "testtest abc" ) ); | ||
| 47 | |||
| 48 | m_testString = "te%st%12abc"; | ||
| 49 | QCOMPARE( m_testString.args( testArgs ) , QString( "te%sttestabc" ) ); | ||
| 50 | |||
| 51 | testArgs.clear(); | ||
| 52 | testArgs.append( "test" ); | ||
| 53 | testArgs.append( "abc" ); | ||
| 54 | m_testString = "test%12abc%2xyz"; | ||
| 55 | QCOMPARE( m_testString.args( testArgs ) , QString( "testtestabcabcxyz" ) ); | ||
| 56 | |||
| 57 | m_testString = "%12test%23abc"; | ||
| 58 | QCOMPARE( m_testString.args( testArgs ) , QString( "testtestabcabc" ) ); | ||
| 59 | } | ||
| 60 | |||
| 61 | void TestQStringx::testNamedArgs() | ||
| 62 | { | ||
| 63 | } | ||
| 64 | |||
| 65 | void TestQStringx::testNamedOptArgs() | ||
| 66 | { | ||
| 67 | } |
tests/TestQStringx.h
(43 / 0)
|   | |||
| 1 | /*************************************************************************** | ||
| 2 | * Copyright (c) 2009 Sven Krohlas <sven@getamarok.com> * | ||
| 3 | * * | ||
| 4 | * This program is free software; you can redistribute it and/or modify * | ||
| 5 | * it under the terms of the GNU General Public License as published by * | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or * | ||
| 7 | * (at your option) any later version. * | ||
| 8 | * * | ||
| 9 | * This program is distributed in the hope that it will be useful, * | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
| 12 | * GNU General Public License for more details. * | ||
| 13 | * * | ||
| 14 | * You should have received a copy of the GNU General Public License * | ||
| 15 | * along with this program; if not, write to the * | ||
| 16 | * Free Software Foundation, Inc., * | ||
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
| 18 | ***************************************************************************/ | ||
| 19 | |||
| 20 | #ifndef TESTQSTRINGX_H | ||
| 21 | #define TESTQSTRINGX_H | ||
| 22 | |||
| 23 | #include "QStringx.h" | ||
| 24 | |||
| 25 | #include <QtTest> | ||
| 26 | |||
| 27 | class TestQStringx : public QObject | ||
| 28 | { | ||
| 29 | Q_OBJECT | ||
| 30 | |||
| 31 | public: | ||
| 32 | TestQStringx( QStringList testArgumentList ); | ||
| 33 | |||
| 34 | private slots: | ||
| 35 | void testArgs(); | ||
| 36 | void testNamedArgs(); | ||
| 37 | void testNamedOptArgs(); | ||
| 38 | |||
| 39 | private: | ||
| 40 | Amarok::QStringx m_testString; | ||
| 41 | }; | ||
| 42 | |||
| 43 | #endif // TESTQSTRINGX_H |

