upowertest

package
v0.3.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package upowertest serves a scriptable UPower on a test bus: the DisplayDevice and enumerated devices, each change announced with the signal the real daemon sends, and every GetAll counted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Battery

func Battery(percentage float64, state upower.DeviceState, warning upower.WarningLevel) map[string]dbus.Variant

Battery is a DisplayDevice's properties.

func Peripheral

func Peripheral(kind upower.DeviceKind, model string, percentage float64, warning upower.WarningLevel) map[string]dbus.Variant

Peripheral is an enumerated device's properties.

Types

type Fake

type Fake struct {
	// contains filtered or unexported fields
}

Fake is UPower as the test scripts it.

func Serve

func Serve(t testing.TB, conn *dbus.Conn, display map[string]dbus.Variant) *Fake

Serve claims UPower's name on conn with a DisplayDevice holding display and no other device.

func (*Fake) Add

func (f *Fake) Add(path dbus.ObjectPath, props map[string]dbus.Variant)

Add exports a device and emits DeviceAdded.

func (*Fake) Change

func (f *Fake) Change(path dbus.ObjectPath, props map[string]dbus.Variant)

Change replaces an existing device's properties and emits its PropertiesChanged.

func (*Fake) Reads

func (f *Fake) Reads(path dbus.ObjectPath) int

Reads is how many GetAll calls path has answered.

func (*Fake) Remove

func (f *Fake) Remove(path dbus.ObjectPath)

Remove withdraws a device and emits DeviceRemoved.

func (*Fake) SetDisplay

func (f *Fake) SetDisplay(props map[string]dbus.Variant)

SetDisplay replaces the DisplayDevice's properties and announces the change.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL