File: testGeomParam.py

package info (click to toggle)
alembic-graphics 1.8.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,708 kB
  • sloc: cpp: 89,261; python: 8,053; makefile: 19; csh: 4
file content (127 lines) | stat: -rw-r--r-- 6,368 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#-******************************************************************************
#
# Copyright (c) 2012,
#  Sony Pictures Imageworks Inc. and
#  Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# *       Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# *       Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# *       Neither the name of Sony Pictures Imageworks, nor
# Industrial Light & Magic, nor the names of their contributors may be used
# to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#-******************************************************************************
import unittest
from buildTestData import *

class GeomParamTest(unittest.TestCase):
    def geomParamImpl(self,  iTPTraits, iTypedGeomParamSample ):

        compare = TraitsComparison[iTPTraits.__name__]

        ovals = ArrayTraitsData[iTPTraits.__name__][1]
        samp  = iTypedGeomParamSample( ovals, GeometryScope.kConstantScope )
        ivals = samp.getVals()

        self.assertEqual(len( ivals ), len( ovals ))
        for i in range( len( ivals ) ):
            self.assertTrue( compare( ivals[i], ovals[i] ) )

        samp2 = iTypedGeomParamSample()
        samp2.setVals( ovals )
        ivals = samp2.getVals()

        self.assertEqual(len( ivals ), len( ovals ))

        for i in range( len( ivals ) ):
            self.assertTrue( compare( ivals[i], ovals[i] ) )

    def testOGeomParamSample(self):
        self.geomParamImpl( BooleanTPTraits, OBooleanGeomParamSample )
        self.geomParamImpl( Uint8TPTraits  , OUcharGeomParamSample )
        self.geomParamImpl( Int8TPTraits   , OCharGeomParamSample )
        self.geomParamImpl( Uint16TPTraits , OUInt16GeomParamSample )
        self.geomParamImpl( Int16TPTraits  , OInt16GeomParamSample )
        self.geomParamImpl( Uint32TPTraits , OUInt32GeomParamSample )
        self.geomParamImpl( Int32TPTraits  , OInt32GeomParamSample )
        self.geomParamImpl( Uint64TPTraits , OUInt64GeomParamSample )
        self.geomParamImpl( Int64TPTraits  , OInt64GeomParamSample )
        self.geomParamImpl( Float16TPTraits, OHalfGeomParamSample )
        self.geomParamImpl( Float32TPTraits, OFloatGeomParamSample )
        self.geomParamImpl( Float64TPTraits, ODoubleGeomParamSample )
        self.geomParamImpl( StringTPTraits , OStringGeomParamSample )
        self.geomParamImpl( WstringTPTraits, OWstringGeomParamSample )

        self.geomParamImpl( V2sTPTraits    , OV2sGeomParamSample )
        self.geomParamImpl( V2iTPTraits    , OV2iGeomParamSample )
        self.geomParamImpl( V2fTPTraits    , OV2fGeomParamSample )
        self.geomParamImpl( V2dTPTraits    , OV2dGeomParamSample )

        self.geomParamImpl( V3sTPTraits    , OV3sGeomParamSample )
        self.geomParamImpl( V3iTPTraits    , OV3iGeomParamSample )
        self.geomParamImpl( V3fTPTraits    , OV3fGeomParamSample )
        self.geomParamImpl( V3dTPTraits    , OV3dGeomParamSample )

        self.geomParamImpl( P2sTPTraits    , OP2sGeomParamSample )
        self.geomParamImpl( P2iTPTraits    , OP2iGeomParamSample )
        self.geomParamImpl( P2fTPTraits    , OP2fGeomParamSample )
        self.geomParamImpl( P2dTPTraits    , OP2dGeomParamSample )

        self.geomParamImpl( P3sTPTraits    , OP3sGeomParamSample )
        self.geomParamImpl( P3iTPTraits    , OP3iGeomParamSample )
        self.geomParamImpl( P3fTPTraits    , OP3fGeomParamSample )
        self.geomParamImpl( P3dTPTraits    , OP3dGeomParamSample )

        self.geomParamImpl( Box2sTPTraits  , OBox2sGeomParamSample )
        self.geomParamImpl( Box2iTPTraits  , OBox2iGeomParamSample )
        self.geomParamImpl( Box2fTPTraits  , OBox2fGeomParamSample )
        self.geomParamImpl( Box2dTPTraits  , OBox2dGeomParamSample )

        self.geomParamImpl( Box3sTPTraits  , OBox3sGeomParamSample )
        self.geomParamImpl( Box3iTPTraits  , OBox3iGeomParamSample )
        self.geomParamImpl( Box3fTPTraits  , OBox3fGeomParamSample )
        self.geomParamImpl( Box3dTPTraits  , OBox3dGeomParamSample )

        self.geomParamImpl( M33fTPTraits   , OM33fGeomParamSample )
        self.geomParamImpl( M33dTPTraits   , OM33dGeomParamSample )
        self.geomParamImpl( M44fTPTraits   , OM44fGeomParamSample )
        self.geomParamImpl( M44dTPTraits   , OM44dGeomParamSample )

        self.geomParamImpl( QuatfTPTraits  , OQuatfGeomParamSample )
        self.geomParamImpl( QuatdTPTraits  , OQuatdGeomParamSample )

        self.geomParamImpl( C3hTPTraits    , OC3hGeomParamSample )
        self.geomParamImpl( C3fTPTraits    , OC3fGeomParamSample )
        self.geomParamImpl( C3cTPTraits    , OC3cGeomParamSample )

        self.geomParamImpl( C4hTPTraits    , OC4hGeomParamSample )
        self.geomParamImpl( C4fTPTraits    , OC4fGeomParamSample )
        self.geomParamImpl( C4cTPTraits    , OC4cGeomParamSample )

        self.geomParamImpl( N2fTPTraits    , ON2fGeomParamSample )
        self.geomParamImpl( N2dTPTraits    , ON2dGeomParamSample )

        self.geomParamImpl( N3fTPTraits    , ON3fGeomParamSample )
        self.geomParamImpl( N3dTPTraits    , ON3dGeomParamSample )