diff options
| -rw-r--r-- | lockscreen/KylinLockScreenShield.cpp | 10 | ||||
| -rw-r--r-- | lockscreen/KylinLockScreenShield.h | 2 | ||||
| -rw-r--r-- | lockscreen/KylinUserPromptView.h | 2 | ||||
| -rw-r--r-- | lockscreen/LockScreenAbstractPromptView.h | 2 | ||||
| -rw-r--r-- | lockscreen/LockScreenAbstractShield.h | 6 | ||||
| -rw-r--r-- | lockscreen/LockScreenShield.cpp | 10 | ||||
| -rw-r--r-- | lockscreen/LockScreenShield.h | 2 | ||||
| -rw-r--r-- | tests/test_mock_session_manager.h | 2 | ||||
| -rw-r--r-- | tests/test_text_input.cpp | 20 | ||||
| -rw-r--r-- | tests/test_unity_settings.cpp | 10 |
10 files changed, 26 insertions, 40 deletions
diff --git a/lockscreen/KylinLockScreenShield.cpp b/lockscreen/KylinLockScreenShield.cpp index ee865fee8..8cc544922 100644 --- a/lockscreen/KylinLockScreenShield.cpp +++ b/lockscreen/KylinLockScreenShield.cpp @@ -89,11 +89,6 @@ KylinShield::KylinShield(session::Manager::Ptr const& session_manager, }); } -void KylinShield::UpdateScale() -{ - scale = unity::Settings::Instance().em(monitor)->DPIScale(); -} - void KylinShield::UpdateBackgroundTexture() { auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor); @@ -210,11 +205,6 @@ nux::Area* KylinShield::FindKeyFocusArea(unsigned etype, unsigned long keysym, u return nullptr; } -bool KylinShield::AcceptKeyNavFocus() -{ - return false; -} - nux::Area* KylinShield::FindAreaUnderMouse(nux::Point const& mouse, nux::NuxEventType event_type) { nux::Area* area = BaseWindow::FindAreaUnderMouse(mouse, event_type); diff --git a/lockscreen/KylinLockScreenShield.h b/lockscreen/KylinLockScreenShield.h index e896c0583..3bf828801 100644 --- a/lockscreen/KylinLockScreenShield.h +++ b/lockscreen/KylinLockScreenShield.h @@ -45,7 +45,6 @@ public: bool HasGrab() const override; protected: - bool AcceptKeyNavFocus() override; nux::Area* FindKeyFocusArea(unsigned int, unsigned long, unsigned long) override; nux::Area* FindAreaUnderMouse(nux::Point const&, nux::NuxEventType) override; @@ -54,7 +53,6 @@ private: void GrabScreen(bool cancel_on_failure); void ShowPrimaryView(); void ShowSecondaryView(); - void UpdateScale(); std::shared_ptr<BackgroundSettings> bg_settings_; std::unique_ptr<nux::AbstractPaintLayer> background_layer_; diff --git a/lockscreen/KylinUserPromptView.h b/lockscreen/KylinUserPromptView.h index a6938e409..b19733395 100644 --- a/lockscreen/KylinUserPromptView.h +++ b/lockscreen/KylinUserPromptView.h @@ -1,6 +1,6 @@ // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* -* Copyright (C) 2014 Canonical Ltd +* Copyright (C) 2015 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as diff --git a/lockscreen/LockScreenAbstractPromptView.h b/lockscreen/LockScreenAbstractPromptView.h index 3a5d5284f..11811d92d 100644 --- a/lockscreen/LockScreenAbstractPromptView.h +++ b/lockscreen/LockScreenAbstractPromptView.h @@ -1,6 +1,6 @@ // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* - * Copyright (C) 2014 Canonical Ltd + * Copyright (C) 2015 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as diff --git a/lockscreen/LockScreenAbstractShield.h b/lockscreen/LockScreenAbstractShield.h index 603e0294a..394b73689 100644 --- a/lockscreen/LockScreenAbstractShield.h +++ b/lockscreen/LockScreenAbstractShield.h @@ -25,6 +25,7 @@ #include <UnityCore/Indicators.h> #include "unity-shared/MockableBaseWindow.h" +#include "unity-shared/UnitySettings.h" #include "LockScreenAccelerators.h" namespace unity @@ -60,6 +61,11 @@ public: virtual bool HasGrab() const = 0; virtual bool IsIndicatorOpen() const { return false; } virtual void ActivatePanel() {} + virtual bool AcceptKeyNavFocus() { return false; } + virtual void UpdateScale() + { + scale = Settings::Instance().em(monitor)->DPIScale(); + } sigc::signal<void> grabbed; sigc::signal<void> grab_failed; diff --git a/lockscreen/LockScreenShield.cpp b/lockscreen/LockScreenShield.cpp index d936b12f2..f0719b765 100644 --- a/lockscreen/LockScreenShield.cpp +++ b/lockscreen/LockScreenShield.cpp @@ -96,11 +96,6 @@ Shield::Shield(session::Manager::Ptr const& session_manager, }); } -void Shield::UpdateScale() -{ - scale = unity::Settings::Instance().em(monitor)->DPIScale(); -} - void Shield::UpdateBackgroundTexture() { auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor); @@ -259,11 +254,6 @@ nux::Area* Shield::FindKeyFocusArea(unsigned etype, unsigned long keysym, unsign return nullptr; } -bool Shield::AcceptKeyNavFocus() -{ - return false; -} - nux::Area* Shield::FindAreaUnderMouse(nux::Point const& mouse, nux::NuxEventType event_type) { nux::Area* area = BaseWindow::FindAreaUnderMouse(mouse, event_type); diff --git a/lockscreen/LockScreenShield.h b/lockscreen/LockScreenShield.h index 7c2e31380..b6000f62b 100644 --- a/lockscreen/LockScreenShield.h +++ b/lockscreen/LockScreenShield.h @@ -49,7 +49,6 @@ public: void ActivatePanel() override; protected: - bool AcceptKeyNavFocus() override; nux::Area* FindKeyFocusArea(unsigned int, unsigned long, unsigned long) override; nux::Area* FindAreaUnderMouse(nux::Point const&, nux::NuxEventType) override; @@ -58,7 +57,6 @@ private: void GrabScreen(bool cancel_on_failure); void ShowPrimaryView(); void ShowSecondaryView(); - void UpdateScale(); Panel* CreatePanel(); std::shared_ptr<BackgroundSettings> bg_settings_; diff --git a/tests/test_mock_session_manager.h b/tests/test_mock_session_manager.h index 317fd1147..5b9963820 100644 --- a/tests/test_mock_session_manager.h +++ b/tests/test_mock_session_manager.h @@ -55,4 +55,4 @@ struct MockManager : Manager }; } // session -} // unity +} // unity \ No newline at end of file diff --git a/tests/test_text_input.cpp b/tests/test_text_input.cpp index ff40aaf36..6eedb0896 100644 --- a/tests/test_text_input.cpp +++ b/tests/test_text_input.cpp @@ -25,6 +25,7 @@ #include "unity-shared/DashStyle.h" #include "unity-shared/StaticCairoText.h" #include "unity-shared/TextInput.h" +#include "unity-shared/UnitySettings.h" #include "test_utils.h" using namespace nux; @@ -63,19 +64,12 @@ class TestTextInput : public ::testing::Test TEST_F(TestTextInput, HintCorrectInit) { -// nux::Color color = hint->GetTextColor(); -// if (Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN) -// { -// EXPECT_EQ(color.red, 0.0f); -// EXPECT_EQ(color.green, 0.0f); -// EXPECT_EQ(color.blue, 0.0f); -// EXPECT_EQ(color.alpha, 0.5f); -// } else { -// EXPECT_EQ(color.red, 1.0f); -// EXPECT_EQ(color.green, 1.0f); -// EXPECT_EQ(color.blue, 1.0f); -// EXPECT_EQ(color.alpha, 0.5f); -// } + nux::Color color = hint->GetTextColor(); + + EXPECT_EQ(color.red, 1.0f); + EXPECT_EQ(color.green, 1.0f); + EXPECT_EQ(color.blue, 1.0f); + EXPECT_EQ(color.alpha, 0.5f); } TEST_F(TestTextInput, InputStringCorrectSetter) diff --git a/tests/test_unity_settings.cpp b/tests/test_unity_settings.cpp index 0bf07858f..f64c9c594 100644 --- a/tests/test_unity_settings.cpp +++ b/tests/test_unity_settings.cpp @@ -53,12 +53,14 @@ struct TestUnitySettings : testing::Test , sig_receiver(unity_settings) { g_settings_set_enum(gsettings, "form-factor", static_cast<int>(unity::FormFactor::DESKTOP)); + g_settings_set_enum(gsettings, "desktop-type", static_cast<int>(unity::DesktopType::UBUNTU)); } ~TestUnitySettings() { sig_receiver.notify_callbacks(); g_settings_reset(gsettings, "form-factor"); + g_settings_reset(gsettings, "desktop-type"); } }; @@ -78,6 +80,14 @@ TEST_F(TestUnitySettings, GetFormFactor) EXPECT_EQ(unity_settings->form_factor(), unity::FormFactor::NETBOOK); } +TEST_F(TestUnitySettings, GetDesktopType) +{ + ASSERT_NE(unity_settings->desktop_type(), unity::DesktopType::UBUNTUKYLIN); + + g_settings_set_enum(gsettings, "desktop-type", static_cast<int>(unity::DesktopType::UBUNTUKYLIN)); + EXPECT_EQ(unity_settings->desktop_type(), unity::DesktopType::UBUNTUKYLIN); +} + TEST_F(TestUnitySettings, FormFactorChangedSignal_Extern) { EXPECT_CALL(sig_receiver, FormFactorChanged(unity::FormFactor::NETBOOK)); |
