1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

core: mock wayland context for tests & add i18n guidance to CONTRIBUTING

This commit is contained in:
bbedward
2025-12-11 14:50:02 -05:00
parent 9cac93b724
commit 6d66f93565
25 changed files with 1145 additions and 130 deletions

View File

@@ -9,7 +9,7 @@ import (
wlclient "github.com/AvengeMedia/DankMaterialShell/core/pkg/go-wayland/wayland/client"
)
func NewManager(display *wlclient.Display) (*Manager, error) {
func NewManager(display wlclient.WaylandDisplay) (*Manager, error) {
m := &Manager{
display: display,
ctx: display.Context(),

View File

@@ -1,11 +1,14 @@
package wlroutput
import (
"errors"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
mocks_wlclient "github.com/AvengeMedia/DankMaterialShell/core/internal/mocks/wlclient"
)
func TestStateChanged_BothNil(t *testing.T) {
@@ -398,3 +401,14 @@ func TestStateChanged_IndexOutOfBounds(t *testing.T) {
b := &State{Serial: 1, Outputs: []Output{{Name: "eDP-1"}, {Name: "HDMI-A-1"}}}
assert.True(t, stateChanged(a, b))
}
func TestNewManager_GetRegistryError(t *testing.T) {
mockDisplay := mocks_wlclient.NewMockWaylandDisplay(t)
mockDisplay.EXPECT().Context().Return(nil)
mockDisplay.EXPECT().GetRegistry().Return(nil, errors.New("failed to get registry"))
_, err := NewManager(mockDisplay)
assert.Error(t, err)
assert.Contains(t, err.Error(), "failed to get registry")
}

View File

@@ -45,7 +45,7 @@ type cmd struct {
}
type Manager struct {
display *wlclient.Display
display wlclient.WaylandDisplay
ctx *wlclient.Context
registry *wlclient.Registry
manager *wlr_output_management.ZwlrOutputManagerV1