2
* Copyright 2012 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3, as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the applicable version of the GNU Lesser General Public
12
* License for more details.
14
* You should have received a copy of both the GNU Lesser General Public
15
* License version 3 along with this program. If not, see
16
* <http://www.gnu.org/licenses/>
18
* Authored by: Andrea Azzarone <azzaronea@gmail.com>
24
#include <gtest/gtest.h>
27
#include <NuxCore/ObjectPtr.h>
29
#include "UnityCore/Hud.h"
31
#include "hud/HudView.h"
32
#include "unity-shared/DashStyle.h"
33
#include "unity-shared/PanelStyle.h"
34
#include "unity-shared/UnitySettings.h"
35
using namespace unity;
40
TEST(TestHudView, TestSetQueries)
42
Settings unity_settings;
43
dash::Style dash_style;
44
panel::Style panel_style;
45
nux::ObjectPtr<hud::View> view(new hud::View());
47
hud::Hud::Queries queries;
48
queries.push_back(hud::Query::Ptr(new hud::Query("1", "","", "", "", NULL)));
49
queries.push_back(hud::Query::Ptr(new hud::Query("2", "","", "", "", NULL)));
50
queries.push_back(hud::Query::Ptr(new hud::Query("3", "","", "", "", NULL)));
51
queries.push_back(hud::Query::Ptr(new hud::Query("4", "","", "", "", NULL)));
52
view->SetQueries(queries);
54
ASSERT_EQ(view->buttons().size(), 4);
56
auto it = view->buttons().begin();
57
EXPECT_EQ((*it)->label, "4");
58
EXPECT_TRUE((*it)->is_rounded);
59
EXPECT_FALSE((*it)->fake_focused);
62
EXPECT_EQ((*it)->label, "3");
63
EXPECT_FALSE((*it)->is_rounded);
64
EXPECT_FALSE((*it)->fake_focused);
67
EXPECT_EQ((*it)->label, "2");
68
EXPECT_FALSE((*it)->is_rounded);
69
EXPECT_FALSE((*it)->fake_focused);
72
EXPECT_EQ((*it)->label, "1");
73
EXPECT_FALSE((*it)->is_rounded);
74
EXPECT_TRUE((*it)->fake_focused);