mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-12-22 09:30:19 +00:00
Remove warnings
This commit is contained in:
parent
cd23f03b82
commit
02bde9e795
@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
@ -20,7 +19,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Read the contents of the usage file
|
||||
usageBytes, err := ioutil.ReadFile(usagePath)
|
||||
usageBytes, err := os.ReadFile(usagePath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -29,7 +28,7 @@ func main() {
|
||||
usage := string(usageBytes)
|
||||
|
||||
// Read the contents of the readme file
|
||||
readmeBytes, err := ioutil.ReadFile(readmePath)
|
||||
readmeBytes, err := os.ReadFile(readmePath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -47,7 +46,7 @@ func main() {
|
||||
newReadme := readme[:startIndex+len(startMarker)] + "\n```terminal\n" + usage + "\n```\n" + readme[endIndex:]
|
||||
|
||||
// Write the updated readme back to the file
|
||||
err = ioutil.WriteFile(readmePath, []byte(newReadme), os.ModePerm)
|
||||
err = os.WriteFile(readmePath, []byte(newReadme), os.ModePerm)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -113,11 +113,7 @@ func (k *keyboard) putKey(keyEvent *fyne.KeyEvent) {
|
||||
case fyne.KeyF5:
|
||||
k.s.a.SendCommand(izapple2.CommandShowSpeed)
|
||||
case fyne.KeyF6:
|
||||
if k.s.screenMode != screen.ScreenModeGreen {
|
||||
k.s.screenMode = screen.ScreenModeGreen
|
||||
} else {
|
||||
k.s.screenMode = screen.ScreenModeNTSC
|
||||
}
|
||||
k.s.screenMode = screen.NextScreenMode(k.s.screenMode)
|
||||
case fyne.KeyF7:
|
||||
k.s.showPages = !k.s.showPages
|
||||
case fyne.KeyF9:
|
||||
|
@ -108,11 +108,7 @@ func (k *sdlKeyboard) putKey(keyEvent *sdl.KeyboardEvent) {
|
||||
k.a.SendCommand(izapple2.CommandToggleSpeed)
|
||||
}
|
||||
case sdl.K_F6:
|
||||
if k.screenMode == screen.ScreenModeNTSC {
|
||||
k.screenMode = screen.ScreenModeGreen
|
||||
} else {
|
||||
k.screenMode = screen.ScreenModeNTSC
|
||||
}
|
||||
k.screenMode = screen.NextScreenMode(k.screenMode)
|
||||
case sdl.K_F7:
|
||||
k.showPages = !k.showPages
|
||||
case sdl.K_F9:
|
||||
|
@ -41,7 +41,6 @@ func (k *KeyboardChannel) PutRune(ch rune) {
|
||||
// Some substitutions useful for Macs that transform chars with the option key
|
||||
pos := slices.Index(macOptionChars, ch)
|
||||
if pos >= 0 {
|
||||
println("Mac option char: ", string(ch), " -> ", string(macOptionSubs[pos]))
|
||||
ch = rune(macOptionSubs[pos])
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package screen
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -10,7 +9,7 @@ import (
|
||||
|
||||
func TestSnapshots(t *testing.T) {
|
||||
// Verifies all the scenarios on the ./test_resources folder
|
||||
files, err := ioutil.ReadDir("./test_resources/")
|
||||
files, err := os.ReadDir("./test_resources/")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -34,16 +33,16 @@ func testScenario(t *testing.T, fileName string) {
|
||||
referenceName := buildImageName(fileName, screenMode, false)
|
||||
actualName := buildImageName(fileName, screenMode, true)
|
||||
|
||||
reference, err := ioutil.ReadFile(referenceName)
|
||||
reference, err := os.ReadFile(referenceName)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
actual, err := ioutil.ReadFile(actualName)
|
||||
actual, err := os.ReadFile(actualName)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if bytes.Compare(reference, actual) != 0 {
|
||||
if !bytes.Equal(reference, actual) {
|
||||
t.Errorf("Files %s and %s should be equal", referenceName, actualName)
|
||||
replaceIfNeeded(referenceName, actualName)
|
||||
} else {
|
||||
|
@ -23,6 +23,17 @@ const (
|
||||
ScreenModeNTSC
|
||||
)
|
||||
|
||||
func NextScreenMode(screenMode int) int {
|
||||
switch screenMode {
|
||||
case ScreenModeGreen:
|
||||
return ScreenModePlain
|
||||
case ScreenModePlain:
|
||||
return ScreenModeNTSC
|
||||
default:
|
||||
return ScreenModeGreen
|
||||
}
|
||||
}
|
||||
|
||||
// Snapshot the currently visible screen
|
||||
func Snapshot(vs VideoSource, screenMode int) *image.RGBA {
|
||||
videoMode := vs.GetCurrentVideoMode()
|
||||
|
Loading…
Reference in New Issue
Block a user