Fix keymap.
[vuplus_xbmc] / xbmc / test / TestTextureUtils.cpp
1 /*
2  *      Copyright (C) 2012-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #include "URL.h"
22 #include "TextureDatabase.h"
23
24 #include "gtest/gtest.h"
25
26 using ::testing::ValuesIn;
27
28 namespace
29 {
30 typedef struct
31 {
32   const char *in;
33   const char *type;
34   const char *options;
35   const char *out;
36 } TestFiles;
37
38 const TestFiles test_files[] = {{ "/path/to/image/file.jpg", "", "", "image://%2fpath%2fto%2fimage%2ffile.jpg/" },
39                                 { "/path/to/image/file.jpg", "", "size=thumb", "image://%2fpath%2fto%2fimage%2ffile.jpg/transform?size=thumb" },
40                                 { "/path/to/video/file.mkv", "video", "", "image://video@%2fpath%2fto%2fvideo%2ffile.mkv/" },
41                                 { "/path/to/music/file.mp3", "music", "", "image://music@%2fpath%2fto%2fmusic%2ffile.mp3/" },
42                                 { "image://%2fpath%2fto%2fimage%2ffile.jpg/", "", "", "image://%2fpath%2fto%2fimage%2ffile.jpg/" },
43                                 { "image://%2fpath%2fto%2fimage%2ffile.jpg/transform?size=thumb", "", "size=thumb", "image://%2fpath%2fto%2fimage%2ffile.jpg/transform?size=thumb" }};
44
45
46 class TestTextureUtils :
47   public ::testing::TestWithParam<TestFiles>
48 {
49 };
50
51 TEST_P(TestTextureUtils, GetWrappedImageURL)
52 {
53   const TestFiles &testFiles(GetParam());
54
55   std::string expected = testFiles.out;
56   std::string out = CTextureUtils::GetWrappedImageURL(testFiles.in,
57                                                       testFiles.type,
58                                                       testFiles.options);
59   EXPECT_EQ(expected, out);
60 }
61
62 INSTANTIATE_TEST_CASE_P(SampleFiles, TestTextureUtils,
63                         ValuesIn(test_files));
64 }