Monday, 13 December 2010

Tests written, code passes

        [Test]
        def load_background():
                source = detab("""
                <image path="data/images/foo.bar" />
                """)

                print source
                sr = StringReader(source)
                r = XmlReader.Create(sr)
                r.MoveToContent()
                img = Image()
                img.load(r)
                Assert.AreEqual("data/images/foo.bar", img.path)


        [Test]
        def save_background():
                path = "data/images/foo.bar"
                img = Image(path)
                assert img.path == path

                target = detab("""
                <image path="data/images/foo.bar" />
                """)

                sw = StringWriter()
                xs = xws()
                using r = XmlWriter.Create(sw, xs):
                        img.save(r)
                Assert.AreEqual(target, "${sw}")


Now, I need an image panel.

No comments: