Add Gio app shells and platform stubs (T-003)

This commit is contained in:
ila
2026-07-16 15:43:03 +08:00
parent 0e20dd76b2
commit 6f920eb457
23 changed files with 668 additions and 15 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
// Package windows contains Win7-compatible Windows platform adapters.
// Package windows provides Win7-compatible platform adapters and non-Windows
// stubs for package-level tests.
package windows
+17
View File
@@ -0,0 +1,17 @@
package windows
// Edition identifies the application build channel shown by the UI.
type Edition string
const EditionLegacy Edition = "Legacy"
// Platform is the minimal boundary for target-specific capabilities.
type Platform interface {
OS() string
Edition() Edition
}
// New returns the platform implementation selected by build tags.
func New() Platform {
return newPlatform()
}
@@ -0,0 +1,19 @@
//go:build !windows
package windows
import "runtime"
type platformStub struct{}
func newPlatform() Platform {
return platformStub{}
}
func (platformStub) OS() string {
return runtime.GOOS
}
func (platformStub) Edition() Edition {
return EditionLegacy
}
@@ -0,0 +1,13 @@
package windows
import "testing"
func TestPlatformStubContract(t *testing.T) {
platform := New()
if platform.OS() == "" {
t.Fatal("OS() should not be empty")
}
if platform.Edition() != EditionLegacy {
t.Fatalf("Edition() = %q, want %q", platform.Edition(), EditionLegacy)
}
}
@@ -0,0 +1,17 @@
//go:build windows
package windows
type platform struct{}
func newPlatform() Platform {
return platform{}
}
func (platform) OS() string {
return "windows"
}
func (platform) Edition() Edition {
return EditionLegacy
}