Skip to content

Commit 7b7d9b4

Browse files
committed
Fix code generator for unsigned return types
Generate code according to previous commit and add a testcase.
1 parent de21a26 commit 7b7d9b4

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

lib/wx/api_gen/wx_gen_nif.erl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,13 @@ return_res1(#type{name="wxCharBuffer", base={binary,_},single=true,by_val=true})
977977
{"char * Result = ", ".data()"};
978978
return_res1(#type{name=Type,single=array,ref=reference}) ->
979979
{Type ++ " Result = ", ""};
980-
return_res1(#type{name=Type,single=true,by_val=true}) ->
981-
{Type ++ " Result = ", ""}.
980+
return_res1(#type{name=Type,single=true,by_val=true, mod=Mods}) ->
981+
case lists:member(unsigned, Mods) of
982+
true ->
983+
{io_lib:format("unsigned ~s Result = ", [Type]), ""};
984+
false ->
985+
{Type ++ " Result = ", ""}
986+
end.
982987

983988
filter(Ps) ->
984989
lists:filter(fun filter_arg/1, Ps).

lib/wx/test/wx_class_SUITE.erl

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
init_per_testcase/2, end_per_testcase/2]).
3333

3434
-export([calendarCtrl/1, treeCtrl/1, notebook/1, staticBoxSizer/1,
35-
clipboard/1, helpFrame/1, htmlWindow/1, listCtrlSort/1, listCtrlVirtual/1,
35+
clipboard/1, helpFrame/1, htmlWindow/1, image/1, listCtrlSort/1, listCtrlVirtual/1,
3636
radioBox/1, systemSettings/1, taskBarIcon/1, toolbar/1, popup/1, modal/1,
3737
textCtrl/1, locale/1]).
3838

@@ -54,8 +54,8 @@ end_per_testcase(Func,Config) ->
5454
suite() -> [{ct_hooks,[ts_install_cth]}, {timetrap,{minutes,2}}].
5555

5656
all() ->
57-
[calendarCtrl, treeCtrl, notebook, staticBoxSizer,
58-
clipboard, helpFrame, htmlWindow, listCtrlSort, listCtrlVirtual,
57+
[calendarCtrl, treeCtrl, notebook, staticBoxSizer, clipboard,
58+
helpFrame, htmlWindow, image, listCtrlSort, listCtrlVirtual,
5959
radioBox, systemSettings, taskBarIcon, toolbar, popup, modal,
6060
textCtrl, locale].
6161

@@ -623,6 +623,19 @@ locale(_Config) ->
623623
io:format("initiated ~p~n",[R0]),
624624
lang_env(),
625625
ok.
626+
627+
image(_Config) when is_list(_Config) ->
628+
wx:new(),
629+
Bin = << <<220:8, Row:8, Col:8>> ||
630+
Row <- lists:seq(0, 127),
631+
Col <- lists:seq(0, 127) >>,
632+
Image = wxImage:new(128, 128, Bin),
633+
220 = wxImage:getRed(Image, 42, 13),
634+
42 = wxImage:getBlue(Image, 42, 13),
635+
13 = wxImage:getGreen(Image, 42, 13),
636+
ok.
637+
638+
626639
%% wx_test_lib:wx_destroy(Frame,Config).
627640

628641
lang_env() ->

0 commit comments

Comments
 (0)