[WASAPI] fix stream types and frequencies enumeration
[xbmc.git] / xbmc / video / test / TestStacks.cpp
blob12639a1a5f5694b8618a03abf6924d3a441dcde8
1 /*
2 * Copyright (C) 2022 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "FileItem.h"
10 #include "FileItemList.h"
11 #include "filesystem/Directory.h"
12 #include "test/TestUtils.h"
14 #include <string>
16 #include <gtest/gtest.h>
18 using namespace XFILE;
20 namespace
22 const std::string VIDEO_EXTENSIONS = ".mpg|.mpeg|.mp4|.mkv|.mk3d|.iso";
25 class TestStacks : public ::testing::Test
27 protected:
28 TestStacks() = default;
29 ~TestStacks() override = default;
32 TEST_F(TestStacks, TestMovieFilesStackFilesAB)
34 const std::string movieFolder =
35 XBMC_REF_FILE_PATH("xbmc/video/test/testdata/moviestack_ab/Movie-(2001)");
36 CFileItemList items;
37 CDirectory::GetDirectory(movieFolder, items, VIDEO_EXTENSIONS, DIR_FLAG_DEFAULTS);
38 // make sure items has 2 items (the two movie parts)
39 EXPECT_EQ(items.Size(), 2);
40 // stack the items and make sure we end up with a single movie
41 items.Stack();
42 EXPECT_EQ(items.Size(), 1);
43 // check the single item in the stack is a stack://
44 EXPECT_EQ(items.Get(0)->IsStack(), true);
47 TEST_F(TestStacks, TestMovieFilesStackFilesPart)
49 const std::string movieFolder =
50 XBMC_REF_FILE_PATH("xbmc/video/test/testdata/moviestack_part/Movie_(2001)");
51 CFileItemList items;
52 CDirectory::GetDirectory(movieFolder, items, VIDEO_EXTENSIONS, DIR_FLAG_DEFAULTS);
53 // make sure items has 3 items (the three movie parts)
54 EXPECT_EQ(items.Size(), 3);
55 // stack the items and make sure we end up with a single movie
56 items.Stack();
57 EXPECT_EQ(items.Size(), 1);
58 // check the single item in the stack is a stack://
59 EXPECT_EQ(items.Get(0)->IsStack(), true);
62 TEST_F(TestStacks, TestMovieFilesStackDvdIso)
64 const std::string movieFolder =
65 XBMC_REF_FILE_PATH("xbmc/video/test/testdata/moviestack_dvdiso/Movie_(2001)");
66 CFileItemList items;
67 CDirectory::GetDirectory(movieFolder, items, VIDEO_EXTENSIONS, DIR_FLAG_DEFAULTS);
68 // make sure items has 2 items (the two dvd isos)
69 EXPECT_EQ(items.Size(), 2);
70 // stack the items and make sure we end up with a single movie
71 items.Stack();
72 EXPECT_EQ(items.Size(), 1);
73 // check the single item in the stack is a stack://
74 EXPECT_EQ(items.Get(0)->IsStack(), true);