pyobjc / pyobjc-framework-Quartz / PyObjCTest / test_cvopenglbufferpool.py

from PyObjCTools.TestSupport import *
from Quartz import *

try:
    unicode
except NameError:
    unicode = str


try:
    long
except NameError:
    long = int
class TestCVOpenGLBufferPool (TestCase):
    def testTypes(self):
        self.assertIsCFType(CVOpenGLBufferPoolRef)

    def testConstants(self):
        self.assertIsInstance(kCVOpenGLBufferPoolMinimumBufferCountKey, unicode)
        self.assertIsInstance(kCVOpenGLBufferPoolMaximumBufferAgeKey, unicode)

    def testFunctions(self):
        self.assertIsInstance(CVOpenGLBufferPoolGetTypeID(), (int, long))

        # FIXME: find some good creation parameters
        self.assertArgIsOut(CVOpenGLBufferPoolCreate, 3)
        self.assertArgIsCFRetained(CVOpenGLBufferPoolCreate, 3)
        rv, pool = CVOpenGLBufferPoolCreate(None, {
            kCVOpenGLBufferPoolMinimumBufferCountKey: 1,
            kCVOpenGLBufferPoolMaximumBufferAgeKey: 42.0,
            }, {}, None)
        self.assertEqual(rv, 0)
        self.assertIsInstance(pool, CVOpenGLBufferPoolRef)

        v = CVOpenGLBufferPoolRetain(pool)
        self.assertTrue(v is pool)
        CVOpenGLBufferPoolRelease(v)

        v = CVOpenGLBufferPoolGetAttributes(pool)
        self.assertIsInstance(v, CFDictionaryRef)

        v = CVOpenGLBufferPoolGetOpenGLBufferAttributes(pool)
        self.assertIsInstance(v, CFDictionaryRef)

        self.assertArgIsOut(CVOpenGLBufferPoolCreateOpenGLBuffer, 2)
        self.assertArgIsCFRetained(CVOpenGLBufferPoolCreateOpenGLBuffer, 2)
        rv, buf = CVOpenGLBufferPoolCreateOpenGLBuffer(None, pool, None)
        self.assertIsInstance(rv, (int, long))
        if rv == 0:
            self.assertIsInstance(buf, CVOpenGLBufferRef)
        else:
            self.assertTrue(buf is None)

if __name__ == "__main__":
    main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.