Skip to content

Commit fe602bf

Browse files
committed
remove wchar support
closes issue #217
1 parent 8679206 commit fe602bf

10 files changed

+260
-258
lines changed

codepoint_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ using namespace litehtml;
4444

4545
TEST(CodepointTest, URLReserved)
4646
{
47-
std::vector<std::pair<tchar_t, bool>> testcases = {
47+
std::vector<std::pair<char, bool>> testcases = {
4848
{ '!', true },
4949
{ '"', false },
5050
{ '#', true },
@@ -97,7 +97,7 @@ TEST(CodepointTest, URLReserved)
9797

9898
TEST(CodepointTest, URLScheme)
9999
{
100-
std::vector<std::pair<tchar_t, bool>> testcases = {
100+
std::vector<std::pair<char, bool>> testcases = {
101101
{ '!', false },
102102
{ '"', false },
103103
{ '#', false },

contextTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ const char* master_css =
1212
TEST(ContextTest, LoadMasterStylesheet)
1313
{
1414
context ctx;
15-
ctx.load_master_stylesheet(litehtml_from_utf8(master_css));
15+
ctx.load_master_stylesheet(master_css);
1616
}

cssTest.cpp

Lines changed: 116 additions & 115 deletions
Large diffs are not rendered by default.

documentTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "test/container_test.h"
55

66
using namespace litehtml;
7+
#define _t(x) x
78

89
TEST(DocumentTest, AddFont) {
910
container_test container;

layoutGlobalTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ using namespace litehtml;
88
TEST(LayoutGlobal, Smoke) {
99
context ctx;
1010
container_test container;
11-
litehtml::document::ptr doc = document::createFromString(_t("<html>Body</html>"), &container, &ctx);
11+
litehtml::document::ptr doc = document::createFromString("<html>Body</html>", &container, &ctx);
1212
doc->render(50, render_all);
1313
}

mediaQueryTest.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@ TEST(MediaQueryTest, Parse) {
246246
container_test container;
247247
litehtml::document::ptr doc = std::make_shared<litehtml::document>(&container, nullptr);
248248
media_query::ptr q;
249-
q = media_query::create_from_string(_t(""), doc);
250-
q = media_query::create_from_string(_t("not"), doc);
251-
q = media_query::create_from_string(_t("(width)"), doc);
252-
q = media_query::create_from_string(_t("(orientation: portrait)"), doc);
253-
q = media_query::create_from_string(_t("(width: 1 / 2)"), doc);
254-
q = media_query::create_from_string(_t("(width: 300px)"), doc);
255-
q = media_query::create_from_string(_t("print"), doc);
256-
q = media_query::create_from_string(_t("only screen and (max-width: 600px)"), doc);
249+
q = media_query::create_from_string("", doc);
250+
q = media_query::create_from_string("not", doc);
251+
q = media_query::create_from_string("(width)", doc);
252+
q = media_query::create_from_string("(orientation: portrait)", doc);
253+
q = media_query::create_from_string("(width: 1 / 2)", doc);
254+
q = media_query::create_from_string("(width: 300px)", doc);
255+
q = media_query::create_from_string("print", doc);
256+
q = media_query::create_from_string("only screen and (max-width: 600px)", doc);
257257
}

tstring_view_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ TEST(TStringViewTest, Constructor)
4949
constexpr size_t offset = 5;
5050
constexpr size_t length = 10;
5151

52-
tstring string = _t("the quick brown fox jumps over the lazy dog");
52+
string string = "the quick brown fox jumps over the lazy dog";
5353
tstring_view view(string.data() + offset, length);
5454

5555
EXPECT_EQ(string.data() + offset, view.data());
@@ -66,7 +66,7 @@ TEST(TStringViewTest, RangeForLoop)
6666
constexpr size_t offset = 5;
6767
constexpr size_t length = 10;
6868

69-
tstring string = _t("the quick brown fox jumps over the lazy dog");
69+
string string = "the quick brown fox jumps over the lazy dog";
7070
tstring_view view(string.data() + offset, length);
7171

7272
for (auto c : view) {

url_path_test.cpp

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,31 @@ using namespace litehtml;
4040
namespace {
4141

4242
struct url_path_testcase {
43-
tstring base;
44-
tstring path;
45-
tstring expected;
43+
string base;
44+
string path;
45+
string expected;
4646
};
4747

4848
} // namespace
4949

5050
TEST(URLPathTest, Absolute)
5151
{
52-
std::vector<std::pair<tstring, bool>> testcases = {
53-
{ _t(""), false },
54-
{ _t("a"), false },
55-
{ _t("a/"), false },
56-
{ _t("a/b"), false },
57-
{ _t("a/b/"), false },
58-
{ _t("a/b/c"), false },
59-
{ _t("a/b/c/"), false },
60-
61-
{ _t("/"), true },
62-
{ _t("/a"), true },
63-
{ _t("/a/"), true },
64-
{ _t("/a/b"), true },
65-
{ _t("/a/b/"), true },
66-
{ _t("/a/b/c"), true },
67-
{ _t("/a/b/c/"), true },
52+
std::vector<std::pair<string, bool>> testcases = {
53+
{ "", false },
54+
{ "a", false },
55+
{ "a/", false },
56+
{ "a/b", false },
57+
{ "a/b/", false },
58+
{ "a/b/c", false },
59+
{ "a/b/c/", false },
60+
61+
{ "/", true },
62+
{ "/a", true },
63+
{ "/a/", true },
64+
{ "/a/b", true },
65+
{ "/a/b/", true },
66+
{ "/a/b/c", true },
67+
{ "/a/b/c/", true },
6868
};
6969

7070
for (auto& testcase : testcases) {
@@ -74,22 +74,22 @@ TEST(URLPathTest, Absolute)
7474

7575
TEST(URLPathTest, DirectoryName)
7676
{
77-
std::vector<std::pair<tstring, tstring>> testcases = {
78-
{ _t(""), _t(".") },
79-
{ _t("a"), _t(".") },
80-
{ _t("a/"), _t("a/") },
81-
{ _t("a/b"), _t("a/") },
82-
{ _t("a/b/"), _t("a/b/") },
83-
{ _t("a/b/c"), _t("a/b/") },
84-
{ _t("a/b/c/"), _t("a/b/c/") },
85-
86-
{ _t("/"), _t("/") },
87-
{ _t("/a"), _t("/") },
88-
{ _t("/a/"), _t("/a/") },
89-
{ _t("/a/b"), _t("/a/") },
90-
{ _t("/a/b/"), _t("/a/b/") },
91-
{ _t("/a/b/c"), _t("/a/b/") },
92-
{ _t("/a/b/c/"), _t("/a/b/c/") },
77+
std::vector<std::pair<string, string>> testcases = {
78+
{ "", "." },
79+
{ "a", "." },
80+
{ "a/", "a/" },
81+
{ "a/b", "a/" },
82+
{ "a/b/", "a/b/" },
83+
{ "a/b/c", "a/b/" },
84+
{ "a/b/c/", "a/b/c/" },
85+
86+
{ "/", "/" },
87+
{ "/a", "/" },
88+
{ "/a/", "/a/" },
89+
{ "/a/b", "/a/" },
90+
{ "/a/b/", "/a/b/" },
91+
{ "/a/b/c", "/a/b/" },
92+
{ "/a/b/c/", "/a/b/c/" },
9393
};
9494

9595
for (auto& testcase : testcases) {
@@ -99,22 +99,22 @@ TEST(URLPathTest, DirectoryName)
9999

100100
TEST(URLPathTest, BaseName)
101101
{
102-
std::vector<std::pair<tstring, tstring>> testcases = {
103-
{ _t(""), _t("") },
104-
{ _t("a"), _t("a") },
105-
{ _t("a/"), _t("") },
106-
{ _t("a/b"), _t("b") },
107-
{ _t("a/b/"), _t("") },
108-
{ _t("a/b/c"), _t("c") },
109-
{ _t("a/b/c/"), _t("") },
110-
111-
{ _t("/"), _t("") },
112-
{ _t("/a"), _t("a") },
113-
{ _t("/a/"), _t("") },
114-
{ _t("/a/b"), _t("b") },
115-
{ _t("/a/b/"), _t("") },
116-
{ _t("/a/b/c"), _t("c") },
117-
{ _t("/a/b/c/"), _t("") },
102+
std::vector<std::pair<string, string>> testcases = {
103+
{ "", "" },
104+
{ "a", "a" },
105+
{ "a/", "" },
106+
{ "a/b", "b" },
107+
{ "a/b/", "" },
108+
{ "a/b/c", "c" },
109+
{ "a/b/c/", "" },
110+
111+
{ "/", "" },
112+
{ "/a", "a" },
113+
{ "/a/", "" },
114+
{ "/a/b", "b" },
115+
{ "/a/b/", "" },
116+
{ "/a/b/c", "c" },
117+
{ "/a/b/c/", "" },
118118
};
119119

120120
for (auto& testcase : testcases) {
@@ -125,10 +125,10 @@ TEST(URLPathTest, BaseName)
125125
TEST(URLPathTest, Append)
126126
{
127127
std::vector<url_path_testcase> testcases = {
128-
{ _t(""), _t("a"), _t("a") },
129-
{ _t("/"), _t("a"), _t("/a") },
130-
{ _t("/a"), _t(""), _t("/a") },
131-
{ _t("/a"), _t("b"), _t("/a/b") },
128+
{ "", "a", "a" },
129+
{ "/", "a", "/a" },
130+
{ "/a", "", "/a" },
131+
{ "/a", "b", "/a/b" },
132132
};
133133

134134
for (auto& testcase : testcases) {
@@ -139,9 +139,9 @@ TEST(URLPathTest, Append)
139139
TEST(URLPathTest, Resolve)
140140
{
141141
std::vector<url_path_testcase> testcases = {
142-
{ _t("/"), _t("a"), _t("/a") },
143-
{ _t("/a"), _t("b"), _t("/b") },
144-
{ _t("/a"), _t("/b"), _t("/b") },
142+
{ "/", "a", "/a" },
143+
{ "/a", "b", "/b" },
144+
{ "/a", "/b", "/b" },
145145
};
146146

147147
for (auto& testcase : testcases) {

0 commit comments

Comments
 (0)