mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-12 06:12:46 -06:00
upptst: MtDraw
git-svn-id: svn://ultimatepp.org/upp/trunk@5552 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ec99680986
commit
b2baae474d
6 changed files with 125 additions and 0 deletions
11
upptst/MtDraw/MtDraw.upp
Normal file
11
upptst/MtDraw/MtDraw.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
uses
|
||||
CtrlLib,
|
||||
PdfDraw;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI SSE2 MT",
|
||||
"" = "GUI SSE2";
|
||||
|
||||
5
upptst/MtDraw/init
Normal file
5
upptst/MtDraw/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _MtDraw_icpp_init_stub
|
||||
#define _MtDraw_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "PdfDraw/init"
|
||||
#endif
|
||||
59
upptst/MtDraw/main.cpp
Normal file
59
upptst/MtDraw/main.cpp
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <PdfDraw/PdfDraw.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct MyApp : TopWindow {
|
||||
RichTextCtrl ctrl;
|
||||
TopWindow win;
|
||||
|
||||
void Do(int i);
|
||||
|
||||
void Perform();
|
||||
|
||||
typedef MyApp CLASSNAME;
|
||||
|
||||
MyApp();
|
||||
};
|
||||
|
||||
void MyApp::Do(int i)
|
||||
{
|
||||
String qtf;
|
||||
qtf << "Here goes Image "
|
||||
<< "@@iml:" << Random(100) * 10 + 100 << "*" << Random(150) * 10 + 100 << "`CtrlImg:exclamation` !!!"
|
||||
<< "&This was pass: " << i;
|
||||
if(i & 1) {
|
||||
RLOG("About to lock, main: " << Thread::IsMain());
|
||||
GuiLock __;
|
||||
ctrl <<= qtf;
|
||||
}
|
||||
else {
|
||||
PdfDraw w;
|
||||
ParseQTF(qtf).Paint(w, 0, 0, 3000);
|
||||
SaveFile(GetHomeDirFile(AsString(i % 100)), w.Finish());
|
||||
}
|
||||
}
|
||||
|
||||
void MyApp::Perform()
|
||||
{
|
||||
Open();
|
||||
int i = 0;
|
||||
CoWork co;
|
||||
while(IsOpen()) {
|
||||
co & THISBACK1(Do, i++);
|
||||
Ctrl::ProcessEvents();
|
||||
}
|
||||
RLOG("EXITING!!!!!!!!!!!!!!");
|
||||
while(!co.IsFinished())
|
||||
Ctrl::ProcessEvents();
|
||||
}
|
||||
|
||||
MyApp::MyApp()
|
||||
{
|
||||
Add(ctrl.SizePos());
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
MyApp().Perform();
|
||||
}
|
||||
37
upptst/StringUtil/StringUtil.cpp
Normal file
37
upptst/StringUtil/StringUtil.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
void TestTrimLeft(String what, String s, String r)
|
||||
{
|
||||
for(int i = 0; i < 3; i++) {
|
||||
ASSERT(TrimLeft(what, s) == r);
|
||||
ASSERT(TrimLeft(~what, s) == r);
|
||||
ASSERT(TrimLeft(~what, what.GetLength(), s) == r);
|
||||
r = s;
|
||||
what = i == 1 ? "<notfound\1>" : "";
|
||||
}
|
||||
}
|
||||
|
||||
void TestTrimRight(String what, String s, String r)
|
||||
{
|
||||
for(int i = 0; i < 3; i++) {
|
||||
ASSERT(TrimRight(what, s) == r);
|
||||
ASSERT(TrimRight(~what, s) == r);
|
||||
ASSERT(TrimRight(~what, what.GetLength(), s) == r);
|
||||
r = s;
|
||||
what = i == 1 ? "<notfound\1>" : "";
|
||||
}
|
||||
}
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
String h = "http://www.website.org";
|
||||
DDUMP(TrimLeft("test", h));
|
||||
DDUMP(TrimLeft("http://", h));
|
||||
DDUMP(TrimRight("test", h));
|
||||
DDUMP(TrimRight(".org", h));
|
||||
|
||||
TestTrimLeft("http://", "http://www.website.org", "www.website.org");
|
||||
TestTrimRight(".org", "www.website.org", "www.website");
|
||||
}
|
||||
9
upptst/StringUtil/StringUtil.upp
Normal file
9
upptst/StringUtil/StringUtil.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
StringUtil.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "SSE2";
|
||||
|
||||
4
upptst/StringUtil/init
Normal file
4
upptst/StringUtil/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _StringUtil_icpp_init_stub
|
||||
#define _StringUtil_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue