Skip to content

Commit

Permalink
fix: fix TUs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Le Saux committed Feb 15, 2024
1 parent 7b348fb commit 9b1659c
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 76 deletions.
68 changes: 29 additions & 39 deletions cli/main_test.go

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions export/ascii/ascii.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ func Ascii(filePath string, data []byte, p color.Palette, dontImportDsk bool, cg
v, err := constants.FirmwareNumber(p[i])
if err == nil {
palette[i] = fmt.Sprintf("%.2d", v)
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
}
hardwarepalette := make([]string, len(p))
Expand Down Expand Up @@ -178,8 +178,8 @@ func AsciiByColumn(filePath string, data []byte, p color.Palette, dontImportDsk
v, err := constants.FirmwareNumber(p[i])
if err == nil {
palette[i] = fmt.Sprintf("%.2d", v)
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
}
hardwarepalette := make([]string, len(p))
Expand Down Expand Up @@ -294,8 +294,8 @@ func FormatAssemblyCPCPalette(p color.Palette, eol string) string {
out += ", "
}
}
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
}
return out
Expand All @@ -314,8 +314,8 @@ func FormatAssemblyBasicPalette(p color.Palette, eol string) string {
out += ", "
}
}
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
}
return out
Expand Down
8 changes: 4 additions & 4 deletions export/impdraw/overscan/overscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ func Overscan(filePath string, data []byte, p color.Palette, screenMode uint8, c
v, err := constants.HardwareValues(p[i])
if err == nil {
o[(0x7F00-0x170)+i] = v[0]
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
}
for i := len(p); i < 16; i++ {
Expand Down Expand Up @@ -275,8 +275,8 @@ func EgxOverscan(filePath string, data []byte, p color.Palette, mode1, mode2 uin
v, err := constants.HardwareValues(p[i])
if err == nil {
o[(0x7f00-0x170)+i] = v[0]
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions export/impdraw/palette/ink.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func Ink(filePath string, p color.Palette, screenMode uint8, dontImportDsk bool,
for j := 0; j < 12; j++ {
data[i] = uint8(v)
}
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions export/ocpartstudio/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1467,8 +1467,8 @@ func BasicLoader(filePath string, p color.Palette, cfg *config.MartineConfig) er
v, err := constants.FirmwareNumber(p[i])
if err == nil {
out += fmt.Sprintf("%0.2d", v)
} else {
log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
// } else {
// log.GetLogger().Error("Error while getting the hardware values for color %v, error :%v\n", p[0], err)
}
if i+1 < len(p) {
out += ","
Expand Down
2 changes: 1 addition & 1 deletion export/png/png_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func TestPaletteOutput(t *testing.T) {
_, _ = log.InitLoggerWithFile("test.log")
p := constants.CpcOldPalette
if err := png.PalToPng("test.png", p[0:16]); err != nil {
if err := png.PalToPng("../../test.png", p[0:16]); err != nil {
t.Fatalf("error while generating the palette with error :%v\n", err)
}

Expand Down
7 changes: 1 addition & 6 deletions gfx/animate/animate_delta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ func init() {
}

func TestOpenGif(t *testing.T) {
os.RemoveAll(("tests"))
err := os.Mkdir("tests", os.ModePerm)
if err != nil {
t.Fatal(err)
}
fr, err := os.Open("../../samples/coke.gif")
if err != nil {
t.Fatal(err)
Expand All @@ -41,7 +36,7 @@ func TestOpenGif(t *testing.T) {
rect := image.Rect(0, 0, v.Bounds().Max.X, v.Bounds().Max.Y)
img := image.NewNRGBA(rect)
draw.Draw(img, rect, v, rect.Min, draw.Over)
if err := png.Png(fmt.Sprintf("tests/%d.png", i), img); err != nil {
if err := png.Png(fmt.Sprintf(".././../test/%d.png", i), img); err != nil {
t.Fatal(err)
}
}
Expand Down
18 changes: 6 additions & 12 deletions gfx/animate/anitmate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,21 @@ import (

func TestAnimate(t *testing.T) {
file := "../../samples/sonic_rotate.gif"
err := os.MkdirAll("animation-test", os.ModePerm)
if err != nil {
t.Fatal(err)
}
e := config.NewMartineConfig(file, "animation-test")
e := config.NewMartineConfig(file, "../../test")
e.Size = constants.Size{Width: 40, Height: 50, ColorsAvailable: 8}
var screenMode uint8 = 0
fs := []string{file}

err = Animation(fs, screenMode, e)
err := Animation(fs, screenMode, e)
if err != nil {
t.Fatal(err)
}
os.RemoveAll("animation-test")
}

func TestDeltaMotif(t *testing.T) {
err := DeltaMotif(
"../../samples/coke.gif",
&config.MartineConfig{InputPath: "triangles.gif", OutputPath: "."},
&config.MartineConfig{InputPath: "triangles.gif", OutputPath: "../../test"},
20,
0xc000,
1)
Expand All @@ -65,11 +60,10 @@ func TestCompressZx0(t *testing.T) {
t.Fatalf("%v", err)
}
compressed := encode.Encode(b)
err = amsdos.SaveOSFile("../../samples/test.zx0", compressed)
err = amsdos.SaveOSFile("../../test/test.zx0", compressed)
if err != nil {
t.Fatalf("%v", err)
}
_ = os.Remove("TRIANGLE.asm")
}

func TestDisplayCode(t *testing.T) {
Expand All @@ -89,7 +83,7 @@ func TestMergeGifImages(t *testing.T) {
imgRect := image.Rectangle{Min: image.Point{X: 0, Y: 0}, Max: image.Point{X: gifs.Config.Width, Y: gifs.Config.Height}}
origImg := image.NewRGBA(imgRect)
draw.Draw(origImg, gifs.Image[0].Bounds(), gifs.Image[0], gifs.Image[0].Bounds().Min, 0)
err = savePng("origin.png", origImg)
err = savePng("../../test/origin.png", origImg)
if err != nil {
t.Fatal(err)
}
Expand All @@ -100,7 +94,7 @@ func TestMergeGifImages(t *testing.T) {
draw.Draw(img, previousImg.Bounds(), previousImg, previousImg.Bounds().Min, draw.Over)
currImg := gifs.Image[i]
draw.Draw(img, currImg.Bounds(), currImg, currImg.Bounds().Min, draw.Over)
filename := fmt.Sprintf("origin-%.2d.png", i)
filename := fmt.Sprintf("../../test/origin-%.2d.png", i)
err = savePng(filename, img)
if err != nil {
t.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions gfx/transformation/delta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ func TestSaveDelta(t *testing.T) {
for i := 0; i < 320; i++ {
d.Add(0xFF, uint16(i))
}
if err := d.Save("delta.bin"); err != nil {
if err := d.Save("../../test/delta.bin"); err != nil {
t.Fatalf("expected no error and gets %v\n", err)
}
filesize := 4 + (320 * 2)

fi, err := os.Lstat("delta.bin")
fi, err := os.Lstat("../../test/delta.bin")
if err != nil {
t.Fatalf("expected no error while getting informations gets :%v\n", err)
}
Expand Down

0 comments on commit 9b1659c

Please sign in to comment.