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.
10 #include "FileItemList.h"
11 #include "filesystem/Directory.h"
12 #include "test/TestUtils.h"
16 #include <gtest/gtest.h>
18 using namespace XFILE
;
22 const std::string VIDEO_EXTENSIONS
= ".mpg|.mpeg|.mp4|.mkv|.mk3d|.iso";
25 class TestStacks
: public ::testing::Test
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)");
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
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)");
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
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)");
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
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);