mirror of
https://github.com/brl/mutter.git
synced 2025-01-07 18:22:14 +00:00
1adbb686bc
This mocks gsd-colord to enable night ligth at a given temperature. The test then verifies that the result exactly matches that of the gamma ramps gsd-color generated for the same temperature and ICC profile. There are two types of profiles tested; ones with VCGT, i.e. calibrated profiles, and ones without. These are tested as the VCGT affects how the gamma curve looks, while the non-VCGT profiles all only rely on the blackbody temperature to generate a gamma ramp. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2165>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
'''gsd-color proxy mock template
|
|
'''
|
|
|
|
# This program is free software; you can redistribute it and/or modify it under
|
|
# the terms of the GNU Lesser General Public License as published by the Free
|
|
# Software Foundation; either version 3 of the License, or (at your option) any
|
|
# later version. See http://www.gnu.org/copyleft/lgpl.html for the full text
|
|
# of the license.
|
|
|
|
__author__ = 'Jonas Ådahl'
|
|
__copyright__ = '(c) 2021 Red Hat Inc.'
|
|
|
|
import dbus
|
|
import os
|
|
from dbusmock import MOCK_IFACE
|
|
|
|
|
|
BUS_NAME = 'org.gnome.SettingsDaemon.Color'
|
|
MAIN_OBJ = '/org/gnome/SettingsDaemon/Color'
|
|
MAIN_IFACE = BUS_NAME
|
|
SYSTEM_BUS = False
|
|
|
|
|
|
def load(mock, parameters=None):
|
|
mock.night_light_active = False
|
|
mock.temperature = 6500
|
|
|
|
mock.AddProperty(MAIN_IFACE, 'NightLightActive', dbus.Boolean())
|
|
mock.AddProperty(MAIN_IFACE, 'Temperature', dbus.UInt32())
|
|
mock.Set(MAIN_IFACE, 'NightLightActive', mock.night_light_active)
|
|
mock.Set(MAIN_IFACE, 'Temperature', dbus.UInt32(mock.temperature))
|
|
|
|
|
|
@dbus.service.method(MOCK_IFACE, in_signature='b')
|
|
def SetNightLightActive(self, active):
|
|
self.UpdateProperties(MAIN_IFACE, {'NightLightActive': active})
|
|
|
|
@dbus.service.method(MOCK_IFACE, in_signature='u')
|
|
def SetTemperature(self, temperature):
|
|
self.UpdateProperties(MAIN_IFACE, {'Temperature': temperature})
|