mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.autotest
This commit is contained in:
parent
2ae9a6f100
commit
1b9382800a
2 changed files with 62 additions and 0 deletions
9
autotest/CtrlFrame/CtrlFrame.upp
Normal file
9
autotest/CtrlFrame/CtrlFrame.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
53
autotest/CtrlFrame/main.cpp
Normal file
53
autotest/CtrlFrame/main.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
NullFrameClass fr[50];
|
||||
for(int q = 0; q < 10000; q++) {
|
||||
DLOG("==========");
|
||||
Ctrl h;
|
||||
Vector<CtrlFrame *> h1;
|
||||
int N = Random(40) + 1;
|
||||
h1.Add(&NullFrame());
|
||||
for(int i = 0; i < N; i++) {
|
||||
int pos = Random(h.GetFrameCount() + 1);
|
||||
CtrlFrame& val = fr[Random(50)];
|
||||
h.InsertFrame(pos, val);
|
||||
h1.Insert(pos, &val);
|
||||
DDUMP(h.GetFrameCount());
|
||||
DDUMP(h1.GetCount());
|
||||
ASSERT(h1.GetCount() == h.GetFrameCount());
|
||||
for(int i = 0; i < h.GetFrameCount(); i++)
|
||||
ASSERT(&h.GetFrame(i) == h1[i]);
|
||||
#if 0
|
||||
DLOG("===========");
|
||||
DDUMP(pos);
|
||||
DDUMP(val);
|
||||
DDUMP(h.GetFrameCount());
|
||||
for(int i = 0; i < h.GetFrameCount(); i++)
|
||||
DLOG(i << " " << h.GetFrame(i));
|
||||
#endif
|
||||
}
|
||||
while(h.GetFrameCount() > 1) {
|
||||
int pos = Random(h.GetFrameCount());
|
||||
h.RemoveFrame(pos);
|
||||
h1.Remove(pos);
|
||||
DDUMP(h.GetFrameCount());
|
||||
DDUMP(h1.GetCount());
|
||||
ASSERT(h1.GetCount() == h.GetFrameCount());
|
||||
for(int i = 0; i < h.GetFrameCount(); i++)
|
||||
ASSERT(&h.GetFrame(i) == h1[i]);
|
||||
#if 0
|
||||
DLOG("===========");
|
||||
DDUMP(pos);
|
||||
DDUMP(h.GetFrameCount());
|
||||
for(int i = 0; i < h.GetFrameCount(); i++)
|
||||
DLOG(i << " " << h.GetFrame(i));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
DLOG("================ OK");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue