diff options
author | Julien Dessaux | 2021-01-12 15:56:28 +0100 |
---|---|---|
committer | Julien Dessaux | 2021-01-12 15:56:28 +0100 |
commit | d4b3c2c4ce6a175a07a67a5491485efb93281257 (patch) | |
tree | 8590b2592dbd14864011aa60622e47f718250252 | |
parent | Updated menu tests to account properly for duplicate keys (diff) | |
download | shell-game-launcher-d4b3c2c4ce6a175a07a67a5491485efb93281257.tar.gz shell-game-launcher-d4b3c2c4ce6a175a07a67a5491485efb93281257.tar.bz2 shell-game-launcher-d4b3c2c4ce6a175a07a67a5491485efb93281257.zip |
Fixed invalid handling of menu offsets
-rw-r--r-- | config/menu.go | 4 | ||||
-rw-r--r-- | config/menu_test.go | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/config/menu.go b/config/menu.go index a442036..f405ec5 100644 --- a/config/menu.go +++ b/config/menu.go @@ -39,11 +39,11 @@ func (m *Menu) validate(name string) error { } // Banner is just any string, nothing to validate // XOffset - if m.XOffset <= 0 { + if m.XOffset < 0 { return errors.New("XOffset must be a positive integer") } // YOffset - if m.YOffset <= 0 { + if m.YOffset < 0 { return errors.New("YOffset must be a positive integer") } // MenuEntries diff --git a/config/menu_test.go b/config/menu_test.go index d0b1805..095b699 100644 --- a/config/menu_test.go +++ b/config/menu_test.go @@ -18,10 +18,7 @@ func TestMenuValidate(t *testing.T) { t.Fatal("Negative XOffset should not be valid") } // YOffset - menu = Menu{ - XOffset: 1, - YOffset: -1, - } + menu = Menu{YOffset: -1} if err := menu.validate("test"); err == nil { t.Fatal("Negative YOffset should not be valid") } |