~3v1n0/unity/light-shortcuts

« back to all changes in this revision

Viewing changes to tests/test_panel_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 2013 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU General Public License version 3, as published
6
 
 * 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 GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * version 3 along with this program.  If not, see
15
 
 * <http://www.gnu.org/licenses/>
16
 
 *
17
 
 * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
18
 
 *
19
 
 */
20
 
 
21
 
#include <gtest/gtest.h>
22
 
 
23
 
#include "PanelView.h"
24
 
#include "unity-shared/PanelStyle.h"
25
 
#include "unity-shared/UBusMessages.h"
26
 
#include "unity-shared/UBusWrapper.h"
27
 
#include "unity-shared/UnitySettings.h"
28
 
#include "test_utils.h"
29
 
 
30
 
namespace
31
 
{
32
 
 
33
 
class TestPanelView : public testing::Test
34
 
{
35
 
public:
36
 
  unity::Settings unity_settings_;
37
 
  unity::panel::Style panel_style_;
38
 
  unity::UBusManager ubus_manager_;
39
 
  nux::ObjectPtr<unity::PanelView> panel_view_;
40
 
 
41
 
  TestPanelView()
42
 
    : panel_view_(new unity::PanelView(std::make_shared<unity::indicator::DBusIndicators>()))
43
 
  {}
44
 
 
45
 
};
46
 
 
47
 
TEST_F(TestPanelView, StoredDashWidth)
48
 
{
49
 
  auto check_function = [this] (int value) {
50
 
    return panel_view_->GetStoredDashWidth() == value;
51
 
  };
52
 
 
53
 
  int width = 500;
54
 
  int height =  600;
55
 
 
56
 
  GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, 0, width,  height);
57
 
  ubus_manager_.SendMessage(UBUS_OVERLAY_SHOWN, info);
58
 
  Utils::WaitUntil(std::bind(check_function, width));
59
 
 
60
 
  width =  150;
61
 
 
62
 
  ubus_manager_.SendMessage(UBUS_DASH_SIZE_CHANGED, g_variant_new("(ii)", width, height));
63
 
  Utils::WaitUntil(std::bind(check_function, width));
64
 
}
65
 
 
66
 
}