Skip to content

Commit 8151e5b

Browse files
committed
Add test case for uiSliderHasTooltip and uiSliderSetHasTooltip.
1 parent 39a9985 commit 8151e5b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/page4.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
static uiSpinbox *spinbox;
55
static uiSlider *slider;
66
static uiProgressBar *pbar;
7+
static uiCheckbox *checkbox;
78

89
#define CHANGED(what) \
910
static void on ## what ## Changed(ui ## what *this, void *data) \
@@ -75,6 +76,18 @@ static void selectNone(uiButton *b, void *data)
7576
uiRadioButtonsSetSelected(rb, -1);
7677
}
7778

79+
static void sliderEnableTooltip(uiButton *b, void *data)
80+
{
81+
uiSliderSetHasTooltip(uiSlider(data), 1);
82+
uiCheckboxSetChecked(checkbox, uiSliderHasTooltip(uiSlider(data)));
83+
}
84+
85+
static void sliderDisableTooltip(uiButton *b, void *data)
86+
{
87+
uiSliderSetHasTooltip(uiSlider(data), 0);
88+
uiCheckboxSetChecked(checkbox, uiSliderHasTooltip(uiSlider(data)));
89+
}
90+
7891
uiBox *makePage4(void)
7992
{
8093
uiBox *page4;
@@ -93,6 +106,21 @@ uiBox *makePage4(void)
93106
uiSliderOnChanged(slider, onSliderChanged, NULL);
94107
uiBoxAppend(page4, uiControl(slider), 0);
95108

109+
hbox = newHorizontalBox();
110+
slider = uiNewSlider(0, 100);
111+
uiBoxAppend(hbox, uiControl(slider), 1);
112+
b = uiNewButton("Enable Tooltip");
113+
uiButtonOnClicked(b, sliderEnableTooltip, slider);
114+
uiBoxAppend(hbox, uiControl(b), 0);
115+
b = uiNewButton("Disable Tooltip");
116+
uiButtonOnClicked(b, sliderDisableTooltip, slider);
117+
uiBoxAppend(hbox, uiControl(b), 0);
118+
checkbox = uiNewCheckbox("Has Tooltip");
119+
uiControlDisable(uiControl(checkbox));
120+
uiCheckboxSetChecked(checkbox, uiSliderHasTooltip(slider));
121+
uiBoxAppend(hbox, uiControl(checkbox), 0);
122+
uiBoxAppend(page4, uiControl(hbox), 0);
123+
96124
pbar = uiNewProgressBar();
97125
uiBoxAppend(page4, uiControl(pbar), 0);
98126

0 commit comments

Comments
 (0)