Back to index

nux  3.0.0
gtest-nux-statictext.cpp
Go to the documentation of this file.
00001 #include <string>
00002 #include <fstream>
00003 
00004 #include <iostream>
00005 #include <gmock/gmock.h>
00006 #include <boost/filesystem.hpp>
00007 #include <glib.h>
00008 
00009 #include "Nux/Nux.h"
00010 #include "Nux/StaticText.h"
00011 
00012 
00013 using namespace testing;
00014 
00015 namespace {
00016 
00017 TEST(TestStaticText, TestCreate)
00018 {
00019   nux::NuxInitialize(0);
00020   nux::WindowThread *wnd_thread = nux::CreateNuxWindow("Nux Window", 300, 200,
00021     nux::WINDOWSTYLE_NORMAL, NULL, false, NULL, NULL);
00022 
00023   nux::StaticText *statictext = new nux::StaticText("");
00024   
00025   EXPECT_EQ(statictext->GetText(), std::string(""));
00026 
00027   // Test the default color. Should be white.
00028   EXPECT_EQ(statictext->GetTextColor(), nux::color::White);
00029 
00030   // Test random color.
00031   nux::Color random_color = nux::color::RandomColor();
00032   statictext->SetTextColor(random_color);
00033   EXPECT_EQ(statictext->GetTextColor(), random_color);
00034 
00035   // Test default font. Should be "Ubuntu".
00036   EXPECT_EQ(statictext->GetFontName(), std::string("Ubuntu"));
00037 
00038   // Test random font.
00039   statictext->SetFontName("Courrier");
00040   EXPECT_EQ(statictext->GetFontName(), std::string("Courrier"));
00041 
00042   // Test default font point size;
00043   EXPECT_EQ(statictext->GetTextPointSize(), 10);
00044 
00045   statictext->SetTextPointSize(20);
00046   EXPECT_EQ(statictext->GetTextPointSize(), 20);
00047 
00048   statictext->UnReference();
00049   delete wnd_thread;
00050 }
00051 
00052 }