def _test_pipedimagerpq():
    pentagonpts = ((504.5, 100.0), (100.0, 393.9), (254.5, 869.4), (754.5, 869.4), (909.0, 393.9))
    linepts = ((350, 50), (200, 150), (400, 250), (300, 350), (150, 250), (100, 450))
    testapp = QApplication(['PipedImagerPQ'])
    drawcmnds = []
    drawcmnds.append({'action': 'setTitle', 'title': 'Tester'})
    drawcmnds.append({'action': 'show'})
    drawcmnds.append({'action': 'clear', 'color': 'black'})
    drawcmnds.append({'action': 'screenInfo'})
    testimage = QImage(500, 500, QImage.Format_ARGB32_Premultiplied)
    testimage.fill(4278190080)
    testpainter = QPainter(testimage)
    testpainter.setBrush(QBrush(QColor(0, 255, 0, 128), Qt.SolidPattern))
    testpainter.setPen(QPen(QBrush(QColor(255, 0, 0, 255), Qt.SolidPattern), 5.0, Qt.SolidLine, Qt.SquareCap, Qt.MiterJoin))
    testpainter.drawRect(QRectF(5.0, 255.0, 240.0, 240.0))
    testpainter.setBrush(QBrush(QColor(0, 0, 255, 255), Qt.SolidPattern))
    testpainter.setPen(QPen(QBrush(QColor(0, 0, 0, 255), Qt.SolidPattern), 5.0, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin))
    testpainter.drawPolygon(QPolygonF([QPointF((0.25 * ptx), ((0.25 * pty) + 250)) for (ptx, pty) in pentagonpts]))
    testpainter.setBrush(Qt.NoBrush)
    testpainter.setPen(QPen(QBrush(QColor(255, 255, 255, 255), Qt.SolidPattern), 3.0, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin))
    testpainter.drawPolyline(QPolygonF([QPointF(pts, pty) for (pts, pty) in linepts]))
    testpainter.end()
    testimgwidth = testimage.width()
    testimgheight = testimage.height()
    testimgstride = testimage.bytesPerLine()
    testimgdata = bytearray((testimgheight * testimgstride))
    k = 0
    for pty in range(testimgheight):
        for ptx in range(testimgwidth):
            pixval = testimage.pixel(ptx, pty)
            (aval, rgbval) = divmod(pixval, ((256 * 256) * 256))
            (rval, gbval) = divmod(rgbval, (256 * 256))
            (gval, bval) = divmod(gbval, 256)
            testimgdata[k] = bval
            k += 1
            testimgdata[k] = gval
            k += 1
            testimgdata[k] = rval
            k += 1
            testimgdata[k] = aval
            k += 1
    testblocksize = 4000
    testnumblocks = ((((testimgheight * testimgstride) + testblocksize) - 1) // testblocksize)
    drawcmnds.append({'action': 'newImage', 'width': testimgwidth, 'height': testimgheight, 'stride': testimgstride})
    for k in range(testnumblocks):
        if (k < (testnumblocks - 1)):
            blkdata = testimgdata[(k * testblocksize):((k + 1) * testblocksize)]
        else:
            blkdata = testimgdata[(k * testblocksize):]
        drawcmnds.append({'action': 'newImage', 'blocknum': (k + 1), 'numblocks': testnumblocks, 'startindex': (k * testblocksize), 'blockdata': blkdata})
    drawcmnds.append({'action': 'show'})
    drawcmnds.append({'action': 'exit'})
    (cmndrecvpipe, cmndsendpipe) = multiprocessing.Pipe(False)
    (rspdrecvpipe, rspdsendpipe) = multiprocessing.Pipe(False)
    testviewer = PipedImagerPQ(cmndrecvpipe, rspdsendpipe)
    tester = _CommandSubmitterPQ(testviewer, cmndsendpipe, rspdrecvpipe, drawcmnds)
    tester.show()
    testresult = testapp.exec_()
    if (testresult != 0):
        sys.exit(testresult)
def _test_pipedimagerpq():
    pentagonpts = ((504.5, 100.0), (100.0, 393.9), (254.5, 869.4), (754.5, 869.4), (909.0, 393.9))
    linepts = ((350, 50), (200, 150), (400, 250), (300, 350), (150, 250), (100, 450))
    testapp = QApplication(['PipedImagerPQ'])
    drawcmnds = []
    drawcmnds.append({'action': 'setTitle', 'title': 'Tester'})
    drawcmnds.append({'action': 'show'})
    drawcmnds.append({'action': 'clear', 'color': 'black'})
    drawcmnds.append({'action': 'screenInfo'})
    testimage = QImage(500, 500, QImage.Format_ARGB32_Premultiplied)
    testimage.fill(4278190080)
    testpainter = QPainter(testimage)
    testpainter.setBrush(QBrush(QColor(0, 255, 0, 128), Qt.SolidPattern))
    testpainter.setPen(QPen(QBrush(QColor(255, 0, 0, 255), Qt.SolidPattern), 5.0, Qt.SolidLine, Qt.SquareCap, Qt.MiterJoin))
    testpainter.drawRect(QRectF(5.0, 255.0, 240.0, 240.0))
    testpainter.setBrush(QBrush(QColor(0, 0, 255, 255), Qt.SolidPattern))
    testpainter.setPen(QPen(QBrush(QColor(0, 0, 0, 255), Qt.SolidPattern), 5.0, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin))
    testpainter.drawPolygon(QPolygonF([QPointF((0.25 * ptx), ((0.25 * pty) + 250)) for (ptx, pty) in pentagonpts]))
    testpainter.setBrush(Qt.NoBrush)
    testpainter.setPen(QPen(QBrush(QColor(255, 255, 255, 255), Qt.SolidPattern), 3.0, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin))
    testpainter.drawPolyline(QPolygonF([QPointF(pts, pty) for (pts, pty) in linepts]))
    testpainter.end()
    testimgwidth = testimage.width()
    testimgheight = testimage.height()
    testimgstride = testimage.bytesPerLine()
    testimgdata = bytearray((testimgheight * testimgstride))
    k = 0
    for pty in range(testimgheight):
        for ptx in range(testimgwidth):
            pixval = testimage.pixel(ptx, pty)
            (aval, rgbval) = divmod(pixval, ((256 * 256) * 256))
            (rval, gbval) = divmod(rgbval, (256 * 256))
            (gval, bval) = divmod(gbval, 256)
            testimgdata[k] = bval
            k += 1
            testimgdata[k] = gval
            k += 1
            testimgdata[k] = rval
            k += 1
            testimgdata[k] = aval
            k += 1
    testblocksize = 4000
    testnumblocks = ((((testimgheight * testimgstride) + testblocksize) - 1) // testblocksize)
    drawcmnds.append({'action': 'newImage', 'width': testimgwidth, 'height': testimgheight, 'stride': testimgstride})
    for k in range(testnumblocks):
        if (k < (testnumblocks - 1)):
            blkdata = testimgdata[(k * testblocksize):((k + 1) * testblocksize)]
        else:
            blkdata = testimgdata[(k * testblocksize):]
        drawcmnds.append({'action': 'newImage', 'blocknum': (k + 1), 'numblocks': testnumblocks, 'startindex': (k * testblocksize), 'blockdata': blkdata})
    drawcmnds.append({'action': 'show'})
    drawcmnds.append({'action': 'exit'})
    (cmndrecvpipe, cmndsendpipe) = multiprocessing.Pipe(False)
    (rspdrecvpipe, rspdsendpipe) = multiprocessing.Pipe(False)
    testviewer = PipedImagerPQ(cmndrecvpipe, rspdsendpipe)
    tester = _CommandSubmitterPQ(testviewer, cmndsendpipe, rspdrecvpipe, drawcmnds)
    tester.show()
    testresult = testapp.exec_()
    if (testresult != 0):
        sys.exit(testresult)