Skip to content

Commit 1e0415a

Browse files
committed
fix unit tests
1 parent 245ce42 commit 1e0415a

1 file changed

Lines changed: 24 additions & 26 deletions

File tree

tests/unit/src/style.cpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,18 @@ const tst::set set("style", [](tst::suite& suite){
3838
3939
color_highlight{0xffad9869}
4040
41-
length_tree_view_item_indent{17pp}
41+
dim_tree_view_item_indent{17pp}
4242
}
4343
user{}
4444
)qwertyuiop"s);
4545

4646
ruis::style_sheet ss(std::move(desc));
4747

48-
auto color_bg = ss.get("color_background"sv);
49-
tst::check(color_bg, SL);
50-
tst::check_eq(tml::to_string(*color_bg), "0xff353535"s, SL);
48+
auto& color_bg = ss.get(ruis::style::color_background);
49+
tst::check_eq(tml::to_string(color_bg), "0xff353535"s);
5150

52-
auto length_tv_indent = ss.get("length_tree_view_item_indent"sv);
53-
tst::check(length_tv_indent, SL);
54-
tst::check_eq(tml::to_string(*length_tv_indent), "17pp"s, SL);
51+
auto& length_tv_indent = ss.get(ruis::style::dim_tree_view_item_indent);
52+
tst::check_eq(tml::to_string(length_tv_indent), "17pp"s, SL);
5553

5654
auto non_existent = ss.get("non_existent_id"sv);
5755
tst::check(!non_existent, SL);
@@ -70,11 +68,11 @@ const tst::set set("style", [](tst::suite& suite){
7068
7169
color_highlight{0xffad9869}
7270
73-
length_tree_view_item_indent{17pp}
74-
71+
dim_tree_view_item_indent{17pp}
72+
}
73+
user{
7574
real_style_value{13}
7675
}
77-
user{}
7876
)qwertyuiop"s);
7977

8078
auto ss = utki::make_shared<ruis::style_sheet>(std::move(desc));
@@ -84,18 +82,18 @@ const tst::set set("style", [](tst::suite& suite){
8482

8583
s.set(std::move(ss));
8684

87-
auto color_bg = s.get<ruis::color>("color_background"sv);
85+
auto color_bg = s.get_color_background();
8886
tst::check_eq(color_bg.get(), ruis::color(0xff353535), SL);
8987

90-
auto length_ident = s.get<ruis::length>("length_tree_view_item_indent"sv);
91-
tst::check_eq(length_ident.get(), ruis::length::make_pp(17), SL);
88+
auto length_ident = s.get_dim_indent_tree_view_item();
89+
tst::check_eq(length_ident.get(), ruis::layout::dimension(ruis::length::make_pp(17)), SL);
9290
});
9391

9492
// test that ruis::real values can be obtained from style
9593
suite.add("style__basic__real", [](){
9694
auto ss_desc = tml::read(R"qwertyuiop(
9795
version{1}
98-
ruis{
96+
user{
9997
real_style_value{13}
10098
}
10199
)qwertyuiop"s);
@@ -117,7 +115,7 @@ const tst::set set("style", [](tst::suite& suite){
117115
suite.add("style__basic__align", [](){
118116
auto ss_desc = tml::read(R"qwertyuiop(
119117
version{1}
120-
ruis{
118+
user{
121119
align_value{back}
122120
}
123121
)qwertyuiop"s);
@@ -142,27 +140,27 @@ const tst::set set("style", [](tst::suite& suite){
142140
version{1}
143141
ruis{
144142
color_background{0xff353535}
145-
length_tree_view_item_indent{17pp}
143+
dim_tree_view_item_indent{17pp}
146144
}
147145
)qwertyuiop"s
148146
)
149147
);
150148

151149
s.set(ss1);
152150

153-
auto color_bg = s.get<ruis::color>("color_background"sv);
151+
auto color_bg = s.get_color_background();
154152
tst::check_eq(color_bg.get(), ruis::color(0xff353535), SL);
155153

156-
auto length_ident = s.get<ruis::length>("length_tree_view_item_indent"sv);
157-
tst::check_eq(length_ident.get(), ruis::length::make_pp(17), SL);
154+
auto length_ident = s.get_dim_indent_tree_view_item();
155+
tst::check_eq(length_ident.get(), ruis::layout::dimension(ruis::length::make_pp(17)));
158156

159157
auto ss2 = utki::make_shared<ruis::style_sheet>(
160158
tml::read(
161159
R"qwertyuiop(
162160
version{1}
163161
ruis{
164162
color_background{0xff00ff00}
165-
length_tree_view_item_indent{13pp}
163+
dim_tree_view_item_indent{13pp}
166164
}
167165
)qwertyuiop"s
168166
)
@@ -171,16 +169,16 @@ const tst::set set("style", [](tst::suite& suite){
171169
s.set(ss2);
172170

173171
tst::check_eq(color_bg.get(), ruis::color(0xff00ff00), SL);
174-
tst::check_eq(length_ident.get(), ruis::length::make_pp(13), SL);
172+
tst::check_eq(length_ident.get(), ruis::layout::dimension(ruis::length::make_pp(13)));
175173

176174
{
177-
auto color_bg = s.get<ruis::color>("color_background"sv);
175+
auto color_bg = s.get_color_background();
178176
tst::check_eq(color_bg.get(), ruis::color(0xff00ff00), SL);
179177
}
180178

181179
{
182-
auto length_ident = s.get<ruis::length>("length_tree_view_item_indent"sv);
183-
tst::check_eq(length_ident.get(), ruis::length::make_pp(13), SL);
180+
auto length_ident = s.get_dim_indent_tree_view_item();
181+
tst::check_eq(length_ident.get(), ruis::layout::dimension(ruis::length::make_pp(13)));
184182
}
185183
});
186184

@@ -203,7 +201,7 @@ const tst::set set("style", [](tst::suite& suite){
203201
tml::read(
204202
R"qwertyuiop(
205203
version{1}
206-
ruis{
204+
user{
207205
tml_style_value{tml_resource1}
208206
}
209207
)qwertyuiop"s
@@ -220,7 +218,7 @@ const tst::set set("style", [](tst::suite& suite){
220218
tml::read(
221219
R"qwertyuiop(
222220
version{1}
223-
ruis{
221+
user{
224222
tml_style_value{tml_resource2}
225223
}
226224
)qwertyuiop"s

0 commit comments

Comments
 (0)