Back to index

unity  6.0.0
test_hud_view.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2012 Canonical Ltd.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License version 3, as
00006  * published by the  Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00012  * License for more details.
00013  *
00014  * You should have received a copy of both the GNU Lesser General Public
00015  * License version 3 along with this program.  If not, see
00016  * <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Andrea Azzarone <azzaronea@gmail.com>
00019  *
00020  */
00021 
00022 #include <list>
00023 
00024 #include <gtest/gtest.h>
00025 
00026 #include <Nux/Nux.h>
00027 #include <NuxCore/ObjectPtr.h>
00028 
00029 #include "UnityCore/Hud.h"
00030 
00031 #include "hud/HudView.h"
00032 #include "unity-shared/DashStyle.h"
00033 #include "unity-shared/UnitySettings.h"
00034 using namespace unity;
00035 
00036 namespace
00037 {
00038 
00039 TEST(TestHudView, TestSetQueries)
00040 {
00041   Settings unity_settings;
00042   dash::Style dash_style;
00043   nux::ObjectPtr<hud::View> view(new hud::View());
00044 
00045   hud::Hud::Queries queries;
00046   queries.push_back(hud::Query::Ptr(new hud::Query("1", "","", "", "", NULL)));
00047   queries.push_back(hud::Query::Ptr(new hud::Query("2", "","", "", "", NULL)));
00048   queries.push_back(hud::Query::Ptr(new hud::Query("3", "","", "", "", NULL)));
00049   queries.push_back(hud::Query::Ptr(new hud::Query("4", "","", "", "", NULL)));
00050   view->SetQueries(queries);
00051 
00052   ASSERT_EQ(view->buttons().size(), 4);
00053 
00054   auto it = view->buttons().begin();
00055   EXPECT_EQ((*it)->label, "4");
00056   EXPECT_TRUE((*it)->is_rounded);
00057   EXPECT_FALSE((*it)->fake_focused);
00058 
00059   it++;
00060   EXPECT_EQ((*it)->label, "3");
00061   EXPECT_FALSE((*it)->is_rounded);
00062   EXPECT_FALSE((*it)->fake_focused);
00063 
00064   it++;
00065   EXPECT_EQ((*it)->label, "2");
00066   EXPECT_FALSE((*it)->is_rounded);
00067   EXPECT_FALSE((*it)->fake_focused);
00068 
00069   it++;
00070   EXPECT_EQ((*it)->label, "1");
00071   EXPECT_FALSE((*it)->is_rounded);
00072   EXPECT_TRUE((*it)->fake_focused);
00073 }
00074 
00075 }