~3v1n0/unity/cairobaswindow-better-damage

« back to all changes in this revision

Viewing changes to tests/test_shortcut_controller.cpp

  • Committer: Tarmac
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2013-09-25 17:18:05 UTC
  • mfrom: (3530.1.8 trunk)
  • Revision ID: tarmac-20130925171805-wdfr0yz06uttclna
Unity: Use WindowManager average_color property for getting the desktop color

Having to deal with UBus here was a mess and caused us to re-store the same value
too many times. Using a nux property gives us all the features we need easily
while WindowManager is already enough shared to be used for this task.

Approved by PS Jenkins bot, Brandon Schaefer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "shortcuts/BaseWindowRaiser.h"
25
25
#include "shortcuts/ShortcutController.h"
26
26
#include "unity-shared/UnitySettings.h"
 
27
#include "WindowManager.h"
27
28
#include "UBusMessages.h"
28
29
using namespace unity;
29
30
 
67
68
    MOCK_METHOD1(SetOpacity, void(double));
68
69
    using Controller::GetOffsetPerMonitor;
69
70
    using Controller::ConstructView;
70
 
    using Controller::bg_color_;
71
71
    using Controller::view_;
72
72
 
73
73
    void RealSetOpacity(double value)
153
153
  EXPECT_EQ(controller_.view_->GetModel(), model);
154
154
}
155
155
 
156
 
TEST_F(TestShortcutController, UpdateackgroundColor)
157
 
{
158
 
  UBusManager().SendMessage(UBUS_BACKGROUND_COLOR_CHANGED,
159
 
                            g_variant_new("(dddd)", 11/255.0f, 22/255.0f, 33/255.0f, 1.0f));
160
 
 
161
 
  Utils::WaitUntilMSec([this] { return controller_.bg_color_ == nux::Color(11, 22, 33); });
162
 
}
163
 
 
164
156
TEST_F(TestShortcutController, DisabledOnLauncherKeySwitcherStart)
165
157
{
166
158
  ASSERT_TRUE(controller_.IsEnabled());
187
179
  Utils::WaitUntilMSec([this] { return controller_.Visible(); }, false);
188
180
}
189
181
 
 
182
TEST_F(TestShortcutController, DisconnectWMSignalsOnDestruction)
 
183
{
 
184
  auto& color_property = WindowManager::Default().average_color;
 
185
  size_t before = color_property.changed.size();
 
186
  { Controller dummy(base_window_raiser_, modeller_); }
 
187
  ASSERT_EQ(before, color_property.changed.size());
 
188
  color_property.changed.emit(nux::color::RandomColor());
 
189
}
 
190
 
190
191
}
191
192
}