From c8ecec60df94faa66e41acedb75dce7fd8ddbecd Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 7 Mar 2017 10:35:30 +0000 Subject: [PATCH] .autotest git-svn-id: svn://ultimatepp.org/upp/trunk@10910 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- autotest/RichRawSvoValue/RichRawSvoValue.cpp | 51 ++++++++++++++++++++ autotest/RichRawSvoValue/RichRawSvoValue.upp | 9 ++++ autotest/SvoValue/SvoValue.cpp | 5 +- 3 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 autotest/RichRawSvoValue/RichRawSvoValue.cpp create mode 100644 autotest/RichRawSvoValue/RichRawSvoValue.upp diff --git a/autotest/RichRawSvoValue/RichRawSvoValue.cpp b/autotest/RichRawSvoValue/RichRawSvoValue.cpp new file mode 100644 index 000000000..8aea8b2eb --- /dev/null +++ b/autotest/RichRawSvoValue/RichRawSvoValue.cpp @@ -0,0 +1,51 @@ +#include + +using namespace Upp; + +template +void Test(T c) +{ + T h = c; + + { + Value v = h; + ASSERT(~v == AsString(c)); + ASSERT(v.Is()); + ASSERT(v.To() == h); + T h1 = v; + ASSERT(h == h1); + } + { + Value v = RawToValue(h); + ASSERT(v.Is()); + ASSERT(v.To() == h); + T h1 = v.To(); + 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 h1 = v.To(); + 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()); + ASSERT(v.To().x == 123); + } + + Test(1234); + Test("1234"); + Test("1234"); + + LOG("=== Everything OK"); +} diff --git a/autotest/RichRawSvoValue/RichRawSvoValue.upp b/autotest/RichRawSvoValue/RichRawSvoValue.upp new file mode 100644 index 000000000..3a4f5fdc6 --- /dev/null +++ b/autotest/RichRawSvoValue/RichRawSvoValue.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + RichRawSvoValue.cpp; + +mainconfig + "" = ""; + diff --git a/autotest/SvoValue/SvoValue.cpp b/autotest/SvoValue/SvoValue.cpp index e73d79a07..b77bdfedf 100644 --- a/autotest/SvoValue/SvoValue.cpp +++ b/autotest/SvoValue/SvoValue.cpp @@ -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)); }