summaryrefslogtreecommitdiffstats
path: root/xbmc/test/TestTextureUtils.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/test/TestTextureUtils.cpp
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/test/TestTextureUtils.cpp')
-rw-r--r--xbmc/test/TestTextureUtils.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/xbmc/test/TestTextureUtils.cpp b/xbmc/test/TestTextureUtils.cpp
new file mode 100644
index 0000000..a925e38
--- /dev/null
+++ b/xbmc/test/TestTextureUtils.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2012-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "TextureDatabase.h"
+#include "URL.h"
+
+#include <gtest/gtest.h>
+
+using ::testing::ValuesIn;
+
+namespace
+{
+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" }};
+
+
+class TestTextureUtils :
+ public ::testing::TestWithParam<TestFiles>
+{
+};
+
+TEST_P(TestTextureUtils, GetWrappedImageURL)
+{
+ const TestFiles &testFiles(GetParam());
+
+ std::string expected = testFiles.out;
+ std::string out = CTextureUtils::GetWrappedImageURL(testFiles.in,
+ testFiles.type,
+ testFiles.options);
+ EXPECT_EQ(expected, out);
+}
+
+INSTANTIATE_TEST_SUITE_P(SampleFiles, TestTextureUtils, ValuesIn(test_files));
+}