Esempio n. 1
0
def SingleContextHandlerInstance(context_code):
    try:
        c = dsight.ContextHandler(context_code, 3, 3)
        c = dsight.ContextHandler(context_code, 3, 3)

    except dsight.PythonExceptionWrapper as e:
        message, code = e.args
        if code == dsight.EXCEPTION_CODE_MULTIPLE_CONTEXT:
            return True

        raise e

    return False
Esempio n. 2
0
def DestructorResetStates(context_code):
    try:
        c1 = dsight.ContextHandler(context_code, 3, 3)
        c1 = None
        c2 = dsight.ContextHandler(context_code, 3, 3)

    except dsight.PythonExceptionWrapper as e:
        message, code = e.args
        if code == dsight.EXCEPTION_CODE_MULTIPLE_CONTEXT:
            return False
        raise e

    return True
Esempio n. 3
0
def AddOutOfBoundViewport(context_code):
    context = dsight.ContextHandler(context_code, 3, 3)
    canvas = context.AddCanvas(2, 2, None)
    try:
        canvas.AddViewport(0, 0, 4, 4)

    except dsight.PythonExceptionWrapper as e:
        message, code = e.args
        if code == dsight.EXCEPTION_CODE_INVALID_COORDINATES_OUT_OF_BOUNDS:
            return 1

        raise e

    return 0
Esempio n. 4
0
def ZeroSubdivision(context_code):
    context = dsight.ContextHandler(context_code, 3, 3)
    canvas = context.AddCanvas(0, 0, None)
    try:
        canvas.AddViewport(0, 0, 1, 1)

    except dsight.PythonExceptionWrapper as e:
        message, code = e.args
        if e.code == dsight.EXCEPTION_CODE_INVALID_COORDINATES_OUT_OF_BOUNDS:
            return 0

        raise e

    return 1
Esempio n. 5
0
def PreventViewportOverlapFromZeroZeroToOneOne(context_code):
    context = dsight.ContextHandler(context_code, 3, 3)
    canvas = context.AddCanvas(2, 2, None)
    canvas.AddViewport(0, 0, 1, 1)
    try:
        canvas.AddViewport(0, 0, 1, 1)

    except dsight.PythonExceptionWrapper as e:
        message, code = e.args
        if code == dsight.EXCEPTION_CODE_INVALID_COORDINATES_OVERLAP:
            return 1

        raise e

    return 0
Esempio n. 6
0
def DoNotOverlap(context_code):
    context = dsight.ContextHandler(context_code, 3, 3)
    canvas = context.AddCanvas(4, 4, None)
    canvas.AddViewport(0, 0, 2, 2)
    try:
        canvas.AddViewport(2, 2, 5, 5)

    except dsight.PythonExceptionWrapper as e:
        message, code = e.args
        if code == dsight.EXCEPTION_CODE_INVALID_COORDINATES_OVERLAP:
            return 0

        raise e

    return 1
Esempio n. 7
0
def CheckRefCountSetDefaultCanvasSize(context_code):
    r1 = dsight.ContextHandler(context_code, 3, 3)
    r2 = r1.SetDefaultCanvasSize(100, 100)
    return sys.getrefcount(r1) == 3
Esempio n. 8
0
def CheckRefCountChainWhithSetDefaultCanvasSize(context_code):
    context = dsight.ContextHandler(context_code, 3,
                                    3).SetDefaultCanvasSize(100, 100)
    return sys.getrefcount(context) == 2
Esempio n. 9
0
def ChainWhithSetDefaultCanvasSize(context_code):
    context = dsight.ContextHandler(context_code, 3,
                                    3).SetDefaultCanvasSize(100, 100)
    return type(context) == dsight.ContextHandler
Esempio n. 10
0
def SetDefaultCanvasSizeMustReturnItself(context_code):
    context = dsight.ContextHandler(context_code, 3, 3)
    return context == context.SetDefaultCanvasSize(100, 100)
Esempio n. 11
0
def CannotRemoveCanvasViewportTwice(context_code):
    context = dsight.ContextHandler(context_code, 3, 3)
    canvas = context.AddCanvas(0, 0, None)
    context.RemoveCanvas(canvas)
    return not context.RemoveCanvas(canvas)
Esempio n. 12
0
def RemoveCanvas(context_code):
    context = dsight.ContextHandler(context_code, 3, 3)
    canvas = context.AddCanvas(0, 0, None)
    return context.RemoveCanvas(canvas)
Esempio n. 13
0
def CannotRemoveViewportTwice(context_code):
    context = dsight.ContextHandler(context_code, 3, 3)
    canvas = context.AddCanvas(0, 0, None)
    viewport = canvas.AddViewport(0, 0, 1, 1)
    canvas.RemoveViewport(viewport)
    return not canvas.RemoveViewport(viewport)