module Terminal.Game.DrawSpec where import Test.Hspec import Terminal.Game.Plane import Terminal.Game.Draw spec :: Spec spec = do describe "mergePlanes" $ do it "piles multiple planes together" $ mergePlanes (stringPlane "aa") [((1,2), cell 'b')] `shouldBe` stringPlane "ab" it "works in the middle too" $ mergePlanes (stringPlane "aaa\naaa\naaa") [((2,2), cell 'b')] `shouldBe` stringPlane "aaa\naba\naaa" describe "textBox/textBoxLiquid" $ do let s = "las rana in Spa" w = 6 ps = textBox s w 2 pl = textBoxLiquid s w it "textBox follows specific size" $ planeSize ps `shouldBe` (6, 2) it "textBoxLiquid fits the whole string" $ planeSize pl `shouldBe` (6, 3) describe "***" $ do let a = stringPlane ".\n.\n.\n" b = stringPlane "*" c = stringPlane ".\n*\n.\n" it "blits b in the centre of a" $ a *** b `shouldBe` c