def testWriteSFVec4(self): field = avango.osg.SFVec4() field.value = avango.osg.Vec4(1.1, 1.2, 1.3, 1.4) hout = StringIO.StringIO() connect.write("A", field, hout) self.assertFloatListEqual("A\x00SFVec4\x00", "1.1\x001.2\x001.3\x001.4", "\n", hout.getvalue())
def testWriteMFVec3(self): field = avango.osg.MFVec3() field.value = [ avango.osg.Vec3(1.1, 1.2, 1.3), avango.osg.Vec3(2.1, 2.2, 2.3) ] hout = StringIO.StringIO() connect.write("A", field, hout) self.assertFloatListEqual("A\x00MFVec3\x00", "1.1\x001.2\x001.3\x002.1\x002.2\x002.3", "\n", hout.getvalue())
def testWriteSFFloat(self): field = avango.SFFloat() field.value = float(1.2) hout = StringIO.StringIO() connect.write("A", field, hout) self.assertFloatListEqual("A\x00SFFloat\x00", "1.2", "\n", hout.getvalue())
def testWriteMFString(self): mfstring = avango.MFString() mfstring.value = ["Test Number One", " Number 2. "] hout = StringIO.StringIO() connect.write("C", mfstring, hout) self.assertEqual("C\x00MFString\x00Test Number One\x00 Number 2. \n", hout.getvalue())
def testWriteMFVec2(self): field = avango.osg.MFVec2() field.value = [avango.osg.Vec2(1.1, 1.2), avango.osg.Vec2(2.1, 2.2)] hout = StringIO.StringIO() connect.write("A", field, hout) self.assertFloatListEqual("A\x00MFVec2\x00", "1.1\x001.2\x002.1\x002.2", "\n", hout.getvalue())
def testWriteSFMatrix(self): field = avango.osg.SFMatrix() field.value = avango.osg.make_trans_mat(0, 8, 15) hout = StringIO.StringIO() connect.write("A", field, hout) self.assertFloatListEqual("A\x00SFMatrix\x00", """1.0\x000.0\x000.0\x000.0\x00 0.0\x001.0\x000.0\x000.0\x00 0.0\x000.0\x001.0\x000.0\x00 0.0\x008.0\x0015.0\x001.0""", "\n", hout.getvalue())
def testWriteSFMatrix(self): field = avango.osg.SFMatrix() field.value = avango.osg.make_trans_mat(0, 8, 15) hout = StringIO.StringIO() connect.write("A", field, hout) self.assertFloatListEqual( "A\x00SFMatrix\x00", """1.0\x000.0\x000.0\x000.0\x00 0.0\x001.0\x000.0\x000.0\x00 0.0\x000.0\x001.0\x000.0\x00 0.0\x008.0\x0015.0\x001.0""", "\n", hout.getvalue())
def testWriteMFMatrix(self): field = avango.osg.MFMatrix() field.value = [ avango.osg.make_trans_mat(1, 2, 3), avango.osg.make_trans_mat(4, 5, 6) ] hout = StringIO.StringIO() connect.write("A", field, hout) self.assertFloatListEqual("A\x00MFMatrix\x00", """1.0\x000.0\x000.0\x000.0\x00 0.0\x001.0\x000.0\x000.0\x00 0.0\x000.0\x001.0\x000.0\x00 1.0\x002.0\x003.0\x001.0\x00 1.0\x000.0\x000.0\x000.0\x00 0.0\x001.0\x000.0\x000.0\x00 0.0\x000.0\x001.0\x000.0\x00 4.0\x005.0\x006.0\x001.0 """, "\n", hout.getvalue())
def testWriteMFMatrix(self): field = avango.osg.MFMatrix() field.value = [ avango.osg.make_trans_mat(1, 2, 3), avango.osg.make_trans_mat(4, 5, 6) ] hout = StringIO.StringIO() connect.write("A", field, hout) self.assertFloatListEqual( "A\x00MFMatrix\x00", """1.0\x000.0\x000.0\x000.0\x00 0.0\x001.0\x000.0\x000.0\x00 0.0\x000.0\x001.0\x000.0\x00 1.0\x002.0\x003.0\x001.0\x00 1.0\x000.0\x000.0\x000.0\x00 0.0\x001.0\x000.0\x000.0\x00 0.0\x000.0\x001.0\x000.0\x00 4.0\x005.0\x006.0\x001.0 """, "\n", hout.getvalue())
def testWriteMFInt(self): mfint = avango.MFInt() mfint.value = [ 0, 8, 15 ] hout = StringIO.StringIO() connect.write("C", mfint, hout) self.assertEqual("C\x00MFInt\x000\x008\x0015\n", hout.getvalue())
def testWriteSFString(self): sfstring = avango.SFString() sfstring.value = "Test Number One" hout = StringIO.StringIO() connect.write("B", sfstring, hout) self.assertEqual("B\x00SFString\x00Test Number One\n", hout.getvalue())
def testWriteSFInt(self): sfint = avango.SFInt() sfint.value = 42 hout = StringIO.StringIO() connect.write("A", sfint, hout) self.assertEqual("A\x00SFInt\x0042\n", hout.getvalue())
def testWriteMFInt(self): mfint = avango.MFInt() mfint.value = [0, 8, 15] hout = StringIO.StringIO() connect.write("C", mfint, hout) self.assertEqual("C\x00MFInt\x000\x008\x0015\n", hout.getvalue())
def testWriteSFBool(self): field = avango.SFBool() field.value = True hout = StringIO.StringIO() connect.write("A", field, hout) self.assertEqual("A\x00SFBool\x001\n", hout.getvalue())
def testWriteMFString(self): mfstring = avango.MFString() mfstring.value = [ "Test Number One", " Number 2. " ] hout = StringIO.StringIO() connect.write("C", mfstring, hout) self.assertEqual("C\x00MFString\x00Test Number One\x00 Number 2. \n", hout.getvalue())