mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-18 06:05:32 -06:00
Bazaar: Added GoogleTestUIExample.
git-svn-id: svn://ultimatepp.org/upp/trunk@14989 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e0fe0030f8
commit
3cf2896c61
6 changed files with 131 additions and 0 deletions
54
bazaar/GoogleTestUIExample/TestAppWindow.cpp
Normal file
54
bazaar/GoogleTestUIExample/TestAppWindow.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#ifdef flagTESTING_TEST
|
||||
|
||||
#include "AppWindow.h"
|
||||
|
||||
#include <plugin/gtest/gtest.h>
|
||||
#include <memory>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
class AppWindowTest : public testing::Test
|
||||
{
|
||||
public:
|
||||
AppWindowTest()
|
||||
: windowRect(0, 0, 200, 200)
|
||||
{}
|
||||
|
||||
virtual void SetUp() override
|
||||
{
|
||||
window = MakeOne<AppWindow>();
|
||||
}
|
||||
|
||||
public:
|
||||
One<AppWindow> window;
|
||||
const Rect windowRect;
|
||||
};
|
||||
|
||||
TEST_F(AppWindowTest, Initialization)
|
||||
{
|
||||
EXPECT_STREQ(L"App Window", window->GetTitle().ToStd().c_str());
|
||||
EXPECT_FALSE(window->IsMaximized());
|
||||
EXPECT_FALSE(window->IsMinimized());
|
||||
|
||||
EXPECT_EQ(windowRect, window->GetRect());
|
||||
}
|
||||
|
||||
TEST_F(AppWindowTest, ApperanceTest)
|
||||
{
|
||||
const String fileName = "MyAppWindow.png";
|
||||
|
||||
ImageDraw id(window->GetRect().Size());
|
||||
window->DrawCtrl(id);
|
||||
|
||||
PNGEncoder encoder;
|
||||
if (!FileExists(fileName)) {
|
||||
encoder.SaveFile(fileName, id);
|
||||
Cout() << "Non referal window image. Creating and failing test..\n";
|
||||
EXPECT_TRUE(false);
|
||||
} else {
|
||||
auto img = StreamRaster::LoadFileAny(fileName);
|
||||
EXPECT_EQ(img, id);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue