~3v1n0/unity/light-shortcuts

« back to all changes in this revision

Viewing changes to tests/test_hud_view.cpp

  • Committer: Marco Trevisan (Treviño)
  • Date: 2013-04-26 12:41:09 UTC
  • Revision ID: mail@3v1n0.net-20130426124109-t3b2shjah2omiqa2
Unity: Remove all the views, but the Shortcuts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2012 Canonical Ltd.
3
 
 *
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.
7
 
 *
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.
13
 
 *
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/>
17
 
 *
18
 
 * Authored by: Andrea Azzarone <azzaronea@gmail.com>
19
 
 *
20
 
 */
21
 
 
22
 
#include <list>
23
 
 
24
 
#include <gtest/gtest.h>
25
 
 
26
 
#include <Nux/Nux.h>
27
 
#include <NuxCore/ObjectPtr.h>
28
 
 
29
 
#include "UnityCore/Hud.h"
30
 
 
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;
36
 
 
37
 
namespace
38
 
{
39
 
 
40
 
TEST(TestHudView, TestSetQueries)
41
 
{
42
 
  Settings unity_settings;
43
 
  dash::Style dash_style;
44
 
  panel::Style panel_style;
45
 
  nux::ObjectPtr<hud::View> view(new hud::View());
46
 
 
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);
53
 
 
54
 
  ASSERT_EQ(view->buttons().size(), 4);
55
 
 
56
 
  auto it = view->buttons().begin();
57
 
  EXPECT_EQ((*it)->label, "4");
58
 
  EXPECT_TRUE((*it)->is_rounded);
59
 
  EXPECT_FALSE((*it)->fake_focused);
60
 
 
61
 
  it++;
62
 
  EXPECT_EQ((*it)->label, "3");
63
 
  EXPECT_FALSE((*it)->is_rounded);
64
 
  EXPECT_FALSE((*it)->fake_focused);
65
 
 
66
 
  it++;
67
 
  EXPECT_EQ((*it)->label, "2");
68
 
  EXPECT_FALSE((*it)->is_rounded);
69
 
  EXPECT_FALSE((*it)->fake_focused);
70
 
 
71
 
  it++;
72
 
  EXPECT_EQ((*it)->label, "1");
73
 
  EXPECT_FALSE((*it)->is_rounded);
74
 
  EXPECT_TRUE((*it)->fake_focused);
75
 
}
76
 
 
77
 
}