diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/test/TestFileUtils.cpp | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/utils/test/TestFileUtils.cpp')
| -rw-r--r-- | xbmc/utils/test/TestFileUtils.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/xbmc/utils/test/TestFileUtils.cpp b/xbmc/utils/test/TestFileUtils.cpp new file mode 100644 index 0000000..720e82d --- /dev/null +++ b/xbmc/utils/test/TestFileUtils.cpp | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2018 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include "filesystem/File.h" | ||
| 10 | #include "test/TestUtils.h" | ||
| 11 | #include "utils/FileUtils.h" | ||
| 12 | |||
| 13 | #include <gtest/gtest.h> | ||
| 14 | |||
| 15 | TEST(TestFileUtils, DeleteItem_CFileItemPtr) | ||
| 16 | { | ||
| 17 | XFILE::CFile *tmpfile; | ||
| 18 | std::string tmpfilepath; | ||
| 19 | |||
| 20 | ASSERT_NE(nullptr, (tmpfile = XBMC_CREATETEMPFILE(""))); | ||
| 21 | tmpfilepath = XBMC_TEMPFILEPATH(tmpfile); | ||
| 22 | |||
| 23 | CFileItemPtr item(new CFileItem(tmpfilepath)); | ||
| 24 | item->SetPath(tmpfilepath); | ||
| 25 | item->m_bIsFolder = false; | ||
| 26 | item->Select(true); | ||
| 27 | tmpfile->Close(); //Close tmpfile before we try to delete it | ||
| 28 | EXPECT_TRUE(CFileUtils::DeleteItem(item)); | ||
| 29 | } | ||
| 30 | |||
| 31 | TEST(TestFileUtils, DeleteItemString) | ||
| 32 | { | ||
| 33 | XFILE::CFile *tmpfile; | ||
| 34 | |||
| 35 | ASSERT_NE(nullptr, (tmpfile = XBMC_CREATETEMPFILE(""))); | ||
| 36 | tmpfile->Close(); //Close tmpfile before we try to delete it | ||
| 37 | EXPECT_TRUE(CFileUtils::DeleteItem(XBMC_TEMPFILEPATH(tmpfile))); | ||
| 38 | } | ||
| 39 | |||
| 40 | /* Executing RenameFile() requires input from the user */ | ||
| 41 | // static bool RenameFile(const std::string &strFile); | ||
