mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-30 22:03:46 -06:00
.autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@10910 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
6bc412e167
commit
c8ecec60df
3 changed files with 62 additions and 3 deletions
51
autotest/RichRawSvoValue/RichRawSvoValue.cpp
Normal file
51
autotest/RichRawSvoValue/RichRawSvoValue.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
template <class T>
|
||||
void Test(T c)
|
||||
{
|
||||
T h = c;
|
||||
|
||||
{
|
||||
Value v = h;
|
||||
ASSERT(~v == AsString(c));
|
||||
ASSERT(v.Is<T>());
|
||||
ASSERT(v.To<T>() == h);
|
||||
T h1 = v;
|
||||
ASSERT(h == h1);
|
||||
}
|
||||
{
|
||||
Value v = RawToValue(h);
|
||||
ASSERT(v.Is<T>());
|
||||
ASSERT(v.To<T>() == h);
|
||||
T h1 = v.To<T>();
|
||||
ASSERT(h == h1);
|
||||
}
|
||||
{ // this is not supported by Value definition (RichToValue should only be used in client type)
|
||||
Value v = RichToValue(h);
|
||||
ASSERT(~v == AsString(c));
|
||||
ASSERT(v.Is<T>());
|
||||
T h1 = v.To<T>();
|
||||
ASSERT(h == h1);
|
||||
}
|
||||
}
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
{
|
||||
struct Foo { int x; } x;
|
||||
x.x = 123;
|
||||
Value v = RawToValue(x);
|
||||
ASSERT(v.Is<Foo>());
|
||||
ASSERT(v.To<Foo>().x == 123);
|
||||
}
|
||||
|
||||
Test<int>(1234);
|
||||
Test<String>("1234");
|
||||
Test<WString>("1234");
|
||||
|
||||
LOG("=== Everything OK");
|
||||
}
|
||||
9
autotest/RichRawSvoValue/RichRawSvoValue.upp
Normal file
9
autotest/RichRawSvoValue/RichRawSvoValue.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
RichRawSvoValue.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
|
|
@ -55,14 +55,13 @@ CONSOLE_APP_MAIN
|
|||
uuid.c = 1111;
|
||||
uuid.d = 19999;
|
||||
CheckType(uuid, true);
|
||||
|
||||
CheckType(Arial(50).Bold().Strikeout(), true);
|
||||
|
||||
{
|
||||
DrawingDraw g(100, 100);
|
||||
g.DrawText(0, 0, "Hello world");
|
||||
Drawing x = g.GetResult();
|
||||
CheckType(x);
|
||||
CheckType(x);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -71,7 +70,7 @@ CONSOLE_APP_MAIN
|
|||
Painting x = g.GetResult();
|
||||
CheckType(x);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
CheckType(CreateImage(Size(20, 20), Blue));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue