diff --git a/upptst/Ctrl_GetAscendant/Ctrl_GetAscendant.upp b/upptst/Ctrl_GetAscendant/Ctrl_GetAscendant.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/upptst/Ctrl_GetAscendant/Ctrl_GetAscendant.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/Ctrl_GetAscendant/main.cpp b/upptst/Ctrl_GetAscendant/main.cpp new file mode 100644 index 000000000..7c9f87ef6 --- /dev/null +++ b/upptst/Ctrl_GetAscendant/main.cpp @@ -0,0 +1,19 @@ +#include + +using namespace Upp; + +struct TestCtrl : Ctrl { + virtual void LeftDown(Point p, dword keyflags) { + TopWindow *w = GetAscendant(); + if(w) + w->Title(AsString(p)); + } +}; + +GUI_APP_MAIN +{ + TopWindow win; + TestCtrl h; + win << h.SizePos(); + win.Run(); +} diff --git a/upptst/Panic/Panic.cpp b/upptst/Panic/Panic.cpp new file mode 100644 index 000000000..9d6e87103 --- /dev/null +++ b/upptst/Panic/Panic.cpp @@ -0,0 +1,8 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + ASSERT(0); +} diff --git a/upptst/Panic/Panic.upp b/upptst/Panic/Panic.upp new file mode 100644 index 000000000..5a1f1d4b1 --- /dev/null +++ b/upptst/Panic/Panic.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + Panic.cpp; + +mainconfig + "" = ""; + diff --git a/upptst/PanicGUI/PanicGUI.upp b/upptst/PanicGUI/PanicGUI.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/upptst/PanicGUI/PanicGUI.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/PanicGUI/main.cpp b/upptst/PanicGUI/main.cpp new file mode 100644 index 000000000..c807abf22 --- /dev/null +++ b/upptst/PanicGUI/main.cpp @@ -0,0 +1,8 @@ +#include + +using namespace Upp; + +GUI_APP_MAIN +{ + ASSERT(0); +} diff --git a/upptst/PdbTests/PdbTests.upp b/upptst/PdbTests/PdbTests.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/upptst/PdbTests/PdbTests.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/upptst/PdbTests/main.cpp b/upptst/PdbTests/main.cpp new file mode 100644 index 000000000..040056263 --- /dev/null +++ b/upptst/PdbTests/main.cpp @@ -0,0 +1,370 @@ +#include +#include +#include + +using namespace Upp; + +typedef uint64 adr_t; + +struct TypeInfo : Moveable { + int type = 0; + int ref = 0; // this is pointer or reference + bool reference = false; // this is reference +}; + +typedef TypeInfo Context; + +struct Val : Moveable { + bool array = false; + bool rvalue = false; // data is loaded from debugee (if false, data pointed to by address) + byte bitpos = 0; + byte bitcnt = 0; + int reported_size = 0; // size of symbol, can be 0 - unknown, useful for C fixed size arrays + union { + adr_t address; + int64 ival; + double fval; + }; + Context *context = NULL; // needed to retrieve register variables + + Val At(int i) const; + +#ifdef _DEBUG + String ToString() const; +#endif + + Val() { address = 0; } +}; + +Val DeRef(Val val_v) +{ + DDUMP(&val_v); + val_v.ref--; + val_v.rvalue = false; + return val_v; +} + +Val DeRef2(Val& ref_v) +{ + DDUMP(&ref_v); + return ref_v; +} + +Val DeRef3(Val *ptr_v) +{ + DDUMP(ptr_v); + return *ptr_v; +} + +void Test(String val_s) +{ + DUMP(val_s); +} + +void Test2(const String& ref_s) +{ + DUMP(ref_s); +} + +void Test3(String *ptr_s) +{ + DDUMP(ptr_s); + DUMP(*ptr_s); +} + +GUI_APP_MAIN +{ + { + Value a = Rectf(1, 1, 1, 1); + Value b = Rectf(1, 2, 3, 4); + + bool h = a == b; + DDUMP(h); + } + + { // memory / reference test + int a = 0x12345678; + int& b = a; + DDUMP(a); + } + + { + Test("Hello world!"); + Test2("Just a test"); + String h = "OK"; + Test3(&h); + } + + { + Val v; + v.ref = 123; + v.address = 321; + v.type = 500; + + DDUMP(1); + + DeRef(v); + DeRef2(v); + DeRef3(&v); + } + + + Value v; + + v = 123; + DDUMP(v); + + v = "Hello"; + DDUMP(v); + + v = 123.3; + DDUMP(v); + + v = GetSysDate(); + DUMP(v); + + v = "??"; + + v = GetSysTime(); + DDUMP(v); + + WString w = "wstring"; + v = w; + DDUMP(w); + + v = true; + DDUMP(v); + + v = (int64)1; + DDUMP(v); + + ValueArray va; + va << 1 << 2 << 3; + + v = va; + DDUMP(v); + + ValueMap m; + m.Add(1, "one"); + m.Add("two", 2); + v = m; + DDUMP(v); + + + Value& ref = v; + Value *ptr = &v; + + LOG(ref); + + { + Point p(123, 321); + Value v = p; + LOG(v); + } + { + Point64 p(123, 321); + Value v = p; + LOG(v); + } + { + Pointf p(123, 321); + Value v = p; + LOG(v); + } + { + Size p(123, 321); + Value v = p; + LOG(v); + } + { + Size64 p(123, 321); + Value v = p; + LOG(v); + } + { + Sizef p(123, 321); + Value v = p; + LOG(v); + } + { + Rect r(12, 23, 34, 56); + Value v = r; + LOG(r); + } + { + Rect64 r(12, 23, 34, 56); + Value v = r; + LOG(r); + } + { + Rectf r(12, 23, 34, 56); + Value v = r; + LOG(r); + } + { + Font fnt = Arial(10); + Value v = fnt; + LOG(fnt); + LOG(v); + } + { + Complex x(1, 2); + Value v = x; + LOG(x); + } + { + Color c; + c = Null; + c = Red; + Color d = Yellow; + + RGBA rc = c; + + LOG(c); + + Value x = Magenta(); + LOG(x); + } + { + VectorMap m; + for(int i = 0; i < 100000; i++) + m.Add(AsString(i), i); + } + { + VectorMap m; + m("one", 1)("two", 2); + + DDUMP(m); + } + + { + std::vector sv; + sv.push_back(1); + sv.push_back(2); + sv.push_back(3); + + int i = 1; + } + + { + BiVector x; + x.AddTail(123); + x.AddTail(124); + x.AddHead(1); + } + + { + BiArray x; + x.AddTail(123); + x.AddTail(124); + x.AddHead(1); + } + + { + std::string x = "test"; + for(int i = 0; i < 10; i++) + x.append("test"); + } + + { + WString h = "test"; + std::wstring x = h.ToStd(); + for(int i = 0; i < 10; i++) + x.append(~h); + } + + { + Value v1 = GetSysDate(); + ValueMap m { { 1, "one" }, { 2, "two" }}; + Value v2 = m; + } +} + +void Foo() { + int ii = 123; + + auto t = GetSysTime(); + + Date d = GetSysDate(); + + int a[] = { 321, 'h', 'e', 'l', 'l', 'l', 1, 2, 3 }; + + int i = 123; + int *pi = &i; + int **ppi = π + + int *ai = a; + + const char *s = "Hello!"; + const char **ps = &s; + String h = s; + + DDUMP(h); + + h = "X1293409123407983785238745982730498572039487508809808909"; + + DDUMP(h); + + WString ws = "WString works!"; + + DDUMP(ws); + + ws = h.ToWString(); + + DDUMP(ws); + + Vector v; + v << "1" << "2" << "3"; + + DDUMP(v); + + Vector pv; + pv << &h; + DDUMP(pv); + + { + Vector charv; + charv << (byte *)"1" << (byte *)"2"; + DDUMP(charv); + } + + Array av; + av << 1 << 2 << 3; + DDUMP(av); + + Array av2; + av2 << 1 << 2 << 3; + DDUMP(av2); + + Array av64; + av64 << 1 << 2 << 3; + DDUMP(av64); + + Array avu64; + avu64 << 1 << 2 << 3; + DDUMP(avu64); + + { + Array av3; + av3 << 1 << 50; + DDUMP(av3); + } + { + Array av3; + av3 << 1 << 50; + DDUMP(av3); + } + + { + Index x; + x << "1"; + DDUMP(x); + } + + { + ArrayMap m; + m("one", 1)("two", 2); + + DDUMP(m); + } +} diff --git a/upptst/TestChStyle/TestChStyle.h b/upptst/TestChStyle/TestChStyle.h index cc511fc42..be439e3dd 100644 --- a/upptst/TestChStyle/TestChStyle.h +++ b/upptst/TestChStyle/TestChStyle.h @@ -11,6 +11,10 @@ using namespace Upp; class TestChStyle : public WithTestChStyleLayout { public: typedef TestChStyle CLASSNAME; + + ToolBar bar; + MenuBar menu; + TestChStyle(); }; diff --git a/upptst/TestChStyle/main.cpp b/upptst/TestChStyle/main.cpp index 9fee602b2..6251971dc 100644 --- a/upptst/TestChStyle/main.cpp +++ b/upptst/TestChStyle/main.cpp @@ -42,6 +42,9 @@ TestChStyle::TestChStyle() for(int i = 0; i < 100; i++) tab.Add("Tab " + AsString(i)); + + AddFrame(bar); + bar.Set([](Bar& bar) { bar.Add(CtrlImg::Diskette(), [] {}).Tip("This is test"); }); } GUI_APP_MAIN