mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-12 22:03:43 -06:00
upptst: CharMetrics test
git-svn-id: svn://ultimatepp.org/upp/trunk@2352 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
81df9ab18e
commit
bc04ccb372
4 changed files with 84 additions and 0 deletions
11
upptst/CharMetrics/CharMetrics.upp
Normal file
11
upptst/CharMetrics/CharMetrics.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Testing corectness of character metrics\377";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
45
upptst/CharMetrics/main.cpp
Normal file
45
upptst/CharMetrics/main.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct MyApp : TopWindow {
|
||||
DropList fontlist;
|
||||
|
||||
void Paint(Draw& w) {
|
||||
w.DrawRect(GetSize(), White);
|
||||
int y = 50;
|
||||
for(int p = 32; p < 8192; p += 64) {
|
||||
Font fnt(~fontlist, 30);
|
||||
FontInfo fi = fnt.Info();
|
||||
int x = 0;
|
||||
for(int ch = p; ch < p + 64; ch++) {
|
||||
int width = fi[ch];
|
||||
w.DrawRect(x, y, width - 1, fi.GetAscent(), Color(255, 255, 200));
|
||||
w.DrawRect(x, y + fi.GetAscent(), width - 1, fi.GetDescent(), Color(255, 200, 255));
|
||||
w.DrawRect(x + width - 1, y, 1, fi.GetHeight(), Black());
|
||||
w.DrawText(x, y, WString(ch, 1), fnt);
|
||||
x += width;
|
||||
}
|
||||
y += fi.GetHeight() + 20;
|
||||
}
|
||||
}
|
||||
|
||||
void NewFont() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
typedef MyApp CLASSNAME;
|
||||
|
||||
MyApp() {
|
||||
for(int i = 0; i < Font::GetFaceCount(); i++)
|
||||
fontlist.Add(i, Font::GetFaceName(i));
|
||||
Add(fontlist.TopPos(0, MINSIZE).LeftPosZ(0, 200));
|
||||
fontlist <<= 0;
|
||||
fontlist <<= THISBACK(NewFont);
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
MyApp().Sizeable().Run();
|
||||
}
|
||||
9
upptst/Clipboard/Clipboard.upp
Normal file
9
upptst/Clipboard/Clipboard.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
19
upptst/Clipboard/main.cpp
Normal file
19
upptst/Clipboard/main.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
Progress pi("%d");
|
||||
for(;;) {
|
||||
if(pi.StepCanceled())
|
||||
break;
|
||||
WString txt = AsString(Random()).ToWString();
|
||||
ClearClipboard();
|
||||
AppendClipboardText(txt.ToString());
|
||||
WriteClipboardUnicodeText(txt);
|
||||
WString txt2 = ReadClipboardUnicodeText();
|
||||
DDUMP(txt2);
|
||||
ASSERT(txt == txt2);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue