2026-04-16 18:36:42 -07:00
|
|
|
#include <Mw/Milsko.h>
|
2026-04-26 17:42:27 -07:00
|
|
|
#include <Mw/StringDefs.h>
|
2026-04-16 18:36:42 -07:00
|
|
|
|
2026-04-23 14:02:33 -07:00
|
|
|
#define WIDGET_AMOUNT 16
|
2026-04-16 18:36:42 -07:00
|
|
|
|
2026-04-26 17:42:27 -07:00
|
|
|
#define H(h) {&h, #h}
|
|
|
|
|
|
|
|
|
|
typedef struct cls_pair {
|
|
|
|
|
MwClass* cls;
|
|
|
|
|
const char* name;
|
|
|
|
|
} cls_pair_t;
|
|
|
|
|
|
|
|
|
|
cls_pair_t classes[] = {H(MwBoxClass), H(MwButtonClass), H(MwCheckBoxClass), H(MwComboBoxClass), H(MwEntryClass), H(MwFrameClass), H(MwImageClass), H(MwLabelClass), H(MwListBoxClass), H(MwMenuClass), H(MwNumberEntryClass), H(MwProgressBarClass), H(MwRadioBoxClass), H(MwScrollBarClass), H(MwSeparatorClass), H(MwTreeViewClass), H(MwViewportClass)};
|
2026-04-27 12:45:48 +09:00
|
|
|
char* int_params[] = {/*MwNx, MwNy, MwNwidth, MwNheight,*/ MwNorientation, MwNminValue, MwNmaxValue, MwNvalue, MwNchangedBy, MwNareaShown, MwNchecked, MwNalignment, MwNbold, MwNmain, MwNleftPadding, MwNhasHeading, MwNhasBorder, MwNinverted, MwNmodernLook, MwNwaitMS, MwNhideInput, MwNsingleClickSelectable, MwNflat, MwNshowArrows, MwNpadding, MwNborderWidth, MwNfillArea, MwNratio, MwNfixedSize, MwNmargin, MwNbitmapFont, MwNsevenSegment, MwNlength, MwNforceInverted, MwNisRounded, MwNdarkTheme};
|
2026-04-26 17:42:27 -07:00
|
|
|
unsigned long maxxes[] = {UINT8_MAX, UINT16_MAX, UINT32_MAX, UINT64_MAX};
|
|
|
|
|
|
2026-04-16 18:36:42 -07:00
|
|
|
int main() {
|
2026-04-27 12:45:48 +09:00
|
|
|
int i, j = 0, max = 0;
|
2026-04-26 17:42:27 -07:00
|
|
|
char input;
|
|
|
|
|
MwWidget window, widget;
|
|
|
|
|
unsigned long upper_limit;
|
|
|
|
|
|
2026-04-27 12:45:48 +09:00
|
|
|
printf("How many iteration do you want to do? Type -1 if you wanna run it forever.\n");
|
|
|
|
|
scanf("%d", &max);
|
|
|
|
|
|
2026-04-26 17:42:27 -07:00
|
|
|
printf("What upper limit of int params do you want to test?\n");
|
|
|
|
|
for(i = 0; i < (sizeof(maxxes) / sizeof(unsigned long)); i++) {
|
|
|
|
|
printf("%d) %lu\n", i, maxxes[i]);
|
|
|
|
|
}
|
|
|
|
|
get_input:
|
|
|
|
|
input = getchar();
|
|
|
|
|
switch(input) {
|
|
|
|
|
case '0':
|
|
|
|
|
upper_limit = maxxes[0];
|
|
|
|
|
break;
|
|
|
|
|
case '1':
|
|
|
|
|
upper_limit = maxxes[1];
|
|
|
|
|
break;
|
|
|
|
|
case '2':
|
|
|
|
|
upper_limit = maxxes[2];
|
|
|
|
|
break;
|
|
|
|
|
case '3':
|
|
|
|
|
upper_limit = maxxes[3];
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2026-04-26 18:11:39 -07:00
|
|
|
upper_limit = maxxes[0];
|
|
|
|
|
// printf("Invalid value. Pick 0-3.\n");
|
|
|
|
|
// goto get_input;
|
2026-04-26 17:42:27 -07:00
|
|
|
}
|
2026-04-16 18:36:42 -07:00
|
|
|
|
|
|
|
|
MwLibraryInit();
|
|
|
|
|
|
|
|
|
|
window = MwCreateWidget(MwWindowClass, "window", NULL, 0, 0, 400, 400);
|
|
|
|
|
|
2026-04-27 12:45:48 +09:00
|
|
|
while(MwPending(window) && (max == -1 || j < max)) {
|
2026-04-26 17:42:27 -07:00
|
|
|
int class_num = rand() % (sizeof(classes) / sizeof(cls_pair_t));
|
|
|
|
|
widget = MwCreateWidget(*classes[class_num].cls, classes[class_num].name, window, 0, 0, 100, 100);
|
2026-04-23 14:02:33 -07:00
|
|
|
|
2026-04-26 17:42:27 -07:00
|
|
|
printf("%s\n", classes[class_num].name);
|
|
|
|
|
/* apply int params with random scale */
|
|
|
|
|
for(i = 0; i < (sizeof(int_params) / sizeof(void*)); i++) {
|
2026-04-27 11:44:03 +09:00
|
|
|
unsigned long number = rand() % upper_limit;
|
2026-04-26 17:42:27 -07:00
|
|
|
printf("> %s = %lu\n", int_params[i], number);
|
|
|
|
|
MwVaApply(widget, int_params[i], number, NULL);
|
2026-04-16 18:36:42 -07:00
|
|
|
}
|
2026-04-26 18:11:39 -07:00
|
|
|
MwStep(window);
|
2026-04-16 18:36:42 -07:00
|
|
|
|
2026-04-26 17:42:27 -07:00
|
|
|
MwDestroyWidget(widget);
|
|
|
|
|
|
|
|
|
|
printf("\n");
|
2026-04-27 11:44:03 +09:00
|
|
|
|
|
|
|
|
j++;
|
2026-04-16 18:36:42 -07:00
|
|
|
}
|
2026-04-27 12:45:48 +09:00
|
|
|
|
2026-04-27 11:44:03 +09:00
|
|
|
MwFreeWidget(window);
|
2026-04-16 18:36:42 -07:00
|
|
|
}
|