X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test%2Fpmx_test.py;h=e9185eea52ee44da446666f0991410923ca7a0dc;hb=cf6ec3e04ee67bbe635510486475961ed32e46f2;hp=1e89b0dcb910320e9207c50f2c84692bc509c237;hpb=1396b6606b794a2b5502af4973ec425ae6924d49;p=meshio%2Fpymeshio.git diff --git a/test/pmx_test.py b/test/pmx_test.py index 1e89b0d..e9185ee 100644 --- a/test/pmx_test.py +++ b/test/pmx_test.py @@ -1,7 +1,9 @@ # coding: utf-8 import unittest +import io import pymeshio.pmd import pymeshio.pmx.reader +import pymeshio.pmx.writer PMX_FILE=pymeshio.unicode('resources/初音ミクVer2.pmx') @@ -44,3 +46,14 @@ class TestPmx(unittest.TestCase): self.assertEqual(45, len(model.rigidbodies)) self.assertEqual(27, len(model.joints)) + def test_write(self): + # read source file + buf=pymeshio.common.readall(PMX_FILE) + # read and write to out + model=pymeshio.pmx.reader.read(io.BytesIO(buf)) + out=io.BytesIO() + pymeshio.pmx.writer.write(out, model) + # read out buffer again + model2=pymeshio.pmx.reader.read(io.BytesIO(out.getvalue())) + self.assertEqual(model, model2) +