summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/test/TestHTMLUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/utils/test/TestHTMLUtil.cpp')
-rw-r--r--xbmc/utils/test/TestHTMLUtil.cpp36
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 @@
+/*
+ * Copyright (C) 2005-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 "utils/HTMLUtil.h"
+
+#include <gtest/gtest.h>
+
+TEST(TestHTMLUtil, RemoveTags)
+{
+ std::string str;
+ str = "<!DOCTYPE html>\n"
+ "<html>\n"
+ " <head class=\"someclass\">\n"
+ " <body>\n"
+ " <p>blah blah blah</p>\n"
+ " </body>\n"
+ " </head>\n"
+ "</html>\n";
+ HTML::CHTMLUtil::RemoveTags(str);
+ EXPECT_STREQ("\n\n \n \n blah blah blah\n \n \n\n",
+ str.c_str());
+}
+
+TEST(TestHTMLUtil, ConvertHTMLToW)
+{
+ std::wstring inw, refstrw, varstrw;
+ inw = L"&aring;&amp;&euro;";
+ refstrw = L"\u00e5&\u20ac";
+ HTML::CHTMLUtil::ConvertHTMLToW(inw, varstrw);
+ EXPECT_STREQ(refstrw.c_str(), varstrw.c_str());
+}