diff options
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj | 6 | ||||
-rw-r--r-- | project/VS2010Express/XBMC.vcxproj.filters | 3 | ||||
-rw-r--r-- | xbmc/test/Makefile | 1 | ||||
-rw-r--r-- | xbmc/test/TestTextureCache.cpp | 49 |
4 files changed, 59 insertions, 0 deletions
diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index c0a8a3516f..f0fd8c9f35 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -972,6 +972,12 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">true</ExcludedFromBuild> </ClCompile> + <ClCompile Include="..\..\xbmc\test\TestTextureCache.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug (OpenGL)|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release (DirectX)|Win32'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release (OpenGL)|Win32'">true</ExcludedFromBuild> + </ClCompile> <ClCompile Include="..\..\xbmc\test\TestUtils.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug (OpenGL)|Win32'">true</ExcludedFromBuild> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index cf1711ecbc..8923bfe3d7 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -2933,6 +2933,9 @@ <ClCompile Include="..\..\xbmc\test\TestFileItem.cpp"> <Filter>test</Filter> </ClCompile> + <ClCompile Include="..\..\xbmc\test\TestTextureCache.cpp"> + <Filter>test</Filter> + </ClCompile> <ClCompile Include="..\..\xbmc\interfaces\json-rpc\PVROperations.cpp"> <Filter>interfaces\json-rpc</Filter> </ClCompile> diff --git a/xbmc/test/Makefile b/xbmc/test/Makefile index 7b485f68dc..66ae360a10 100644 --- a/xbmc/test/Makefile +++ b/xbmc/test/Makefile @@ -1,6 +1,7 @@ SRCS= \ TestBasicEnvironment.cpp \ TestFileItem.cpp \ + TestTextureCache.cpp \ TestUtils.cpp \ xbmc-test.cpp diff --git a/xbmc/test/TestTextureCache.cpp b/xbmc/test/TestTextureCache.cpp new file mode 100644 index 0000000000..083595a920 --- /dev/null +++ b/xbmc/test/TestTextureCache.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 Team XBMC + * http://www.xbmc.org + * + * This Program 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 2, or (at your option) + * any later version. + * + * This Program 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 XBMC; see the file COPYING. If not, see + * <http://www.gnu.org/licenses/>. + * + */ + +#include "URL.h" +#include "TextureCache.h" + +#include "gtest/gtest.h" + +TEST(TestTextureCache, GetWrappedImageURL) +{ + typedef struct + { + const char *in; + const char *type; + const char *options; + const char *out; + } testfiles; + + const testfiles test_files[] = {{ "/path/to/image/file.jpg", "", "", "image://%2fpath%2fto%2fimage%2ffile.jpg/" }, + { "/path/to/image/file.jpg", "", "size=thumb", "image://%2fpath%2fto%2fimage%2ffile.jpg/transform?size=thumb" }, + { "/path/to/video/file.mkv", "video", "", "image://video@%2fpath%2fto%2fvideo%2ffile.mkv/" }, + { "/path/to/music/file.mp3", "music", "", "image://music@%2fpath%2fto%2fmusic%2ffile.mp3/" }, + { "image://%2fpath%2fto%2fimage%2ffile.jpg/", "", "", "image://%2fpath%2fto%2fimage%2ffile.jpg/" }, + { "image://%2fpath%2fto%2fimage%2ffile.jpg/transform?size=thumb", "", "size=thumb", "image://%2fpath%2fto%2fimage%2ffile.jpg/transform?size=thumb" }}; + + for (unsigned int i = 0; i < sizeof(test_files) / sizeof(testfiles); i++) + { + std::string expected = test_files[i].out; + std::string out = CTextureCache::GetWrappedImageURL(test_files[i].in, test_files[i].type, test_files[i].options); + EXPECT_EQ(out, expected); + } +} |