Ejemplo n.º 1
0
    def test_renderTex2_collHeight(self):
        tex = libVect.StrechedTexture("wolfenscii/asset/test/tex123")

        res = tex.getColl(0.1, 0)
        self.assertTrue(len(res) == 0)

        res = tex.getColl(0.1, 1)
        self.assertTrue(len(res) == 1)
        self.assertTrue(res[0].char in [
            '4',
            '5',
        ])

        res = tex.getColl(0.1, 2)
        self.assertTrue(len(res) == 2)
        self.assertEqual(res[0].char, '0')
        self.assertEqual(['0', '5'], [p.char for p in res])

        res = tex.getColl(0.1, 3)
        self.assertTrue(len(res) == 3)

        res = tex.getColl(0.1, 4)
        self.assertTrue(len(res) == 4)

        res = tex.getColl(0.1, 10)
        self.assertEqual(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
                         [p.char for p in res])
Ejemplo n.º 2
0
    def test_renderTex2_collHeight(self):
        tex = libVect.StrechedTexture("wolfenscii/asset/test/tex2")

        res = tex.getColl(0.1, 0)
        self.assertTrue(len(res) == 0)

        res = tex.getColl(0.1, 1)
        self.assertTrue(len(res) == 1)
        self.assertEqual(res[0].char, 'A')

        res = tex.getColl(0.1, 2)
        self.assertTrue(len(res) == 2)
        self.assertEqual(res[0].char, 'A')
        self.assertEqual(res[1].char, 'C')

        res = tex.getColl(0.1, 3)
        self.assertTrue(len(res) == 3)
        self.assertEqual(res[0].char, 'A')
        self.assertEqual(res[1].char, 'A')
        self.assertEqual(res[2].char, 'C')

        res = tex.getColl(0.1, 4)
        self.assertTrue(len(res) == 4)
        self.assertEqual(res[0].char, 'A')
        self.assertEqual(res[1].char, 'A')
        self.assertEqual(res[2].char, 'C')
        self.assertEqual(res[3].char, 'C')
Ejemplo n.º 3
0
    def test_renderTex2(self):
        tex = libVect.StrechedTexture("wolfenscii/asset/test/tex2")

        for i in range(11):
            ratio = i / 10.0
            #print "ratio", ratio

            res = tex.getColl(ratio, 1)
            if ratio < 0.5:
                self.assertEqual(res[0].char, 'A')
                self.assertTrue(len(res) == 1)
            else:
                self.assertEqual(res[0].char, 'B')
                self.assertTrue(len(res) == 1)

        for i in range(11):
            ratio = i / 10.0
            #print "ratio", ratio

            res = tex.getColl(ratio, 2)
            self.assertTrue(len(res) == 2)
            if ratio < 0.5:
                self.assertEqual(res[0].char, 'A')
                self.assertEqual(res[1].char, 'C')
            else:
                self.assertEqual(res[0].char, 'B')
                self.assertEqual(res[1].char, 'D')
Ejemplo n.º 4
0
    def test_renderTex1(self):
        tex = libVect.StrechedTexture("wolfenscii/asset/test/tex1")

        for i in range(15):
            res = tex.getColl(i / 10.0, 1)
            self.assertTrue(res[0].char == 'A')
            self.assertTrue(len(res) == 1)
Ejemplo n.º 5
0
    def test_renderTex1_collHeight(self):
        tex = libVect.StrechedTexture("wolfenscii/asset/test/tex1")

        res = tex.getColl(0.1, 0)
        self.assertTrue(len(res) == 0)

        res = tex.getColl(0.1, 1)
        self.assertTrue(len(res) == 1)
        for p in res:
            self.assertEqual(p.char, 'A')

        res = tex.getColl(0.1, 2)
        self.assertTrue(len(res) == 2)
        for p in res:
            self.assertEqual(p.char, 'A')

        res = tex.getColl(0.1, 4)
        self.assertTrue(len(res) == 4)
        for p in res:
            self.assertEqual(p.char, 'A')
Ejemplo n.º 6
0
    def test_loadTexture(self):
        tex = libVect.StrechedTexture("wolfenscii/asset/test/tex1")
        #print tex.texData

        tex = libVect.StrechedTexture("wolfenscii/asset/test/tex2")