diff options
Diffstat (limited to 'xbmc/utils/test/TestHTMLUtil.cpp')
| -rw-r--r-- | xbmc/utils/test/TestHTMLUtil.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/xbmc/utils/test/TestHTMLUtil.cpp b/xbmc/utils/test/TestHTMLUtil.cpp new file mode 100644 index 0000000..7d0e515 --- /dev/null +++ b/xbmc/utils/test/TestHTMLUtil.cpp | |||
| @@ -0,0 +1,36 @@ | |||
| 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 "utils/HTMLUtil.h" | ||
| 10 | |||
| 11 | #include <gtest/gtest.h> | ||
| 12 | |||
| 13 | TEST(TestHTMLUtil, RemoveTags) | ||
| 14 | { | ||
| 15 | std::string str; | ||
| 16 | str = "<!DOCTYPE html>\n" | ||
| 17 | "<html>\n" | ||
| 18 | " <head class=\"someclass\">\n" | ||
| 19 | " <body>\n" | ||
| 20 | " <p>blah blah blah</p>\n" | ||
| 21 | " </body>\n" | ||
| 22 | " </head>\n" | ||
| 23 | "</html>\n"; | ||
| 24 | HTML::CHTMLUtil::RemoveTags(str); | ||
| 25 | EXPECT_STREQ("\n\n \n \n blah blah blah\n \n \n\n", | ||
| 26 | str.c_str()); | ||
| 27 | } | ||
| 28 | |||
| 29 | TEST(TestHTMLUtil, ConvertHTMLToW) | ||
| 30 | { | ||
| 31 | std::wstring inw, refstrw, varstrw; | ||
| 32 | inw = L"å&€"; | ||
| 33 | refstrw = L"\u00e5&\u20ac"; | ||
| 34 | HTML::CHTMLUtil::ConvertHTMLToW(inw, varstrw); | ||
| 35 | EXPECT_STREQ(refstrw.c_str(), varstrw.c_str()); | ||
| 36 | } | ||
