diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 50cfcdf1e..015c63703 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,5 @@ -include_directories(${CMAKE_CURRENT_LIST_DIR}/../src) +include_directories(${CMAKE_CURRENT_LIST_DIR}/../src ${CMAKE_CURRENT_LIST_DIR}/../src/libtomahawk) include(tomahawk_add_test.cmake) -tomahawk_add_test(Foo) +tomahawk_add_test(Result) +tomahawk_add_test(Query) diff --git a/tests/TestFoo.h b/tests/TestQuery.h similarity index 70% rename from tests/TestFoo.h rename to tests/TestQuery.h index fe44a10a6..c21d8d87d 100644 --- a/tests/TestFoo.h +++ b/tests/TestQuery.h @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2013, Dominik Schmidt + * Copyright 2013, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,21 +16,24 @@ * along with Tomahawk. If not, see . */ - -#ifndef TOMAHAWK_TESTFOO_H -#define TOMAHAWK_TESTFOO_H +#ifndef TOMAHAWK_TESTQUERY_H +#define TOMAHAWK_TESTQUERY_H #include -class TestFoo : public QObject +#include "libtomahawk/Query.h" +#include "libtomahawk/Source.h" + +class TestQuery : public QObject { Q_OBJECT private slots: - void testBar() + void testGet() { - QVERIFY( true ); + Tomahawk::query_ptr q = Tomahawk::Query::get( "", "", "" ); + QVERIFY( !q ); } }; -#endif \ No newline at end of file +#endif diff --git a/tests/TestResult.h b/tests/TestResult.h new file mode 100644 index 000000000..b09876020 --- /dev/null +++ b/tests/TestResult.h @@ -0,0 +1,52 @@ +/* === This file is part of Tomahawk Player - === + * + * Copyright 2013, Christian Muehlhaeuser + * + * Tomahawk is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Tomahawk is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Tomahawk. If not, see . + */ + +#ifndef TOMAHAWK_TESTRESULT_H +#define TOMAHAWK_TESTRESULT_H + +#include + +#include "libtomahawk/Result.h" +#include "libtomahawk/Source.h" + +class TestResult : public QObject +{ + Q_OBJECT + +private slots: + void testIsValid() + { + Tomahawk::result_ptr r = Tomahawk::Result::get( "/tmp/test.mp3" ); + QVERIFY( !r->isValid() ); + + Tomahawk::track_ptr t = Tomahawk::Track::get( "Artist", "Track" ); + r->setTrack( t ); + QVERIFY( r->isValid() ); + } + + void testGet() + { + Tomahawk::result_ptr r = Tomahawk::Result::get( "" ); + QVERIFY( !r ); + + Tomahawk::result_ptr vr = Tomahawk::Result::get( "/tmp/test.mp3" ); + QVERIFY( vr ); + } +}; + +#endif