diff --git a/upptst/ArrayCtrlSel/ArrayCtrlSel.h b/upptst/ArrayCtrlSel/ArrayCtrlSel.h new file mode 100644 index 000000000..7b992e90d --- /dev/null +++ b/upptst/ArrayCtrlSel/ArrayCtrlSel.h @@ -0,0 +1,19 @@ +#ifndef _ArrayCtrlSel_ArrayCtrlSel_h +#define _ArrayCtrlSel_ArrayCtrlSel_h + +#include + +using namespace Upp; + +#define LAYOUTFILE +#include + +class ArrayCtrlSel : public WithArrayCtrlSelLayout { +public: + int serial = 0; + + typedef ArrayCtrlSel CLASSNAME; + ArrayCtrlSel(); +}; + +#endif diff --git a/upptst/ArrayCtrlSel/ArrayCtrlSel.lay b/upptst/ArrayCtrlSel/ArrayCtrlSel.lay new file mode 100644 index 000000000..2574b1bde --- /dev/null +++ b/upptst/ArrayCtrlSel/ArrayCtrlSel.lay @@ -0,0 +1,9 @@ +LAYOUT(ArrayCtrlSelLayout, 468, 212) + ITEM(ArrayCtrl, list, LeftPosZ(8, 150).TopPosZ(8, 196)) + ITEM(Label, counter, LeftPosZ(164, 296).TopPosZ(8, 19)) + ITEM(Label, dv___2, SetLabel(t_("IsSel")).LeftPosZ(164, 56).TopPosZ(32, 20)) + ITEM(Label, sel, LeftPosZ(224, 236).TopPosZ(32, 19)) + ITEM(Label, dv___4, SetLabel(t_("IsSelected")).LeftPosZ(164, 52).TopPosZ(56, 20)) + ITEM(Label, selected, LeftPosZ(224, 236).TopPosZ(56, 19)) +END_LAYOUT + diff --git a/upptst/ArrayCtrlSel/ArrayCtrlSel.upp b/upptst/ArrayCtrlSel/ArrayCtrlSel.upp new file mode 100644 index 000000000..11caf6bc2 --- /dev/null +++ b/upptst/ArrayCtrlSel/ArrayCtrlSel.upp @@ -0,0 +1,11 @@ +uses + CtrlLib; + +file + ArrayCtrlSel.h, + main.cpp, + ArrayCtrlSel.lay; + +mainconfig + "" = "GUI"; + diff --git a/upptst/ArrayCtrlSel/main.cpp b/upptst/ArrayCtrlSel/main.cpp new file mode 100644 index 000000000..f4a881aec --- /dev/null +++ b/upptst/ArrayCtrlSel/main.cpp @@ -0,0 +1,27 @@ +#include "ArrayCtrlSel.h" + +ArrayCtrlSel::ArrayCtrlSel() +{ + CtrlLayout(*this, "Window title"); + list.MultiSelect(); + list.AddColumn("Column"); + for(int i = 0; i < 10; i++) + list.Add(i); + list.WhenSel = [=] { + counter.SetLabel(AsString(serial++)); + String ssel, sselected; + for(int i = 0; i < list.GetCount(); i++) { + if(list.IsSel(i)) + MergeWith(ssel, ", ", AsString(i)); + if(list.IsSelected(i)) + MergeWith(sselected, ", ", AsString(i)); + } + sel.SetLabel(ssel); + selected.SetLabel(sselected); + }; +} + +GUI_APP_MAIN +{ + ArrayCtrlSel().Run(); +} diff --git a/upptst/TryRealloc/TryRealloc.cpp b/upptst/TryRealloc/TryRealloc.cpp new file mode 100644 index 000000000..f89fef75e --- /dev/null +++ b/upptst/TryRealloc/TryRealloc.cpp @@ -0,0 +1,21 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + for(size_t isz : { 10, 4000, 100000 }) { + RLOG("============================================="); + RDUMP(isz); + void *ptr = MemoryAlloc(isz); + for(size_t sz : { 10, 5000, 10000, 2000, 40000, 70000 }) { + RDUMP(sz); + RDUMP(MemoryTryRealloc(ptr, sz)); + RDUMP(sz); + RLOG("--------"); + } + MemoryFree(ptr); + } +} \ No newline at end of file diff --git a/upptst/TryRealloc/TryRealloc.upp b/upptst/TryRealloc/TryRealloc.upp new file mode 100644 index 000000000..99dba6033 --- /dev/null +++ b/upptst/TryRealloc/TryRealloc.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + TryRealloc.cpp; + +mainconfig + "" = ""; +