@@ -0,0 +1,1971 @@
+from ..pdf_infos import PDFInfos%0Afrom ..pdf_renderer import renderAllPages%0Afrom ..decomposer import decompose_pages%0A%0ApdfFilename = %22../testtalks/FATE_Motivation.pdf%22%0AsizePX = (1024, 768)%0A%0Ainfos = PDFInfos.create(pdfFilename)%0A%0Apages = list(renderAllPages(pdfFilename, sizePX = sizePX,%0A                            pageCount = infos and infos.pageCount()))%0A    %0Aslides = decompose_pages(pages, infos)%0A%0Adef test_frame_sizes():%0A    for frame in slides.frames():%0A        assert frame.size().width() == sizePX%5B0%5D%0A        assert frame.size().height() == sizePX%5B1%5D%0A%0Adef test_frame_count():%0A    assert slides.frameCount() == infos.pageCount()%0A    assert len(list(slides.frames())) == slides.frameCount()%0A%0Adef test_pdfInfos():%0A    assert slides.pdfInfos() is infos%0A%0A# --------------------------------------------------------------------%0A    %0Afrom ..slide_renderer import FrameRenderer%0A%0Aimport numpy%0Afrom ..dynqt import QtGui, qimage2ndarray%0A%0AhasApp = QtGui.QApplication.instance()%0Aif not hasApp:%0A    app = QtGui.QApplication(%5B%5D)%0A%0Ascene = QtGui.QGraphicsScene(0, 0, sizePX%5B0%5D, sizePX%5B1%5D)%0A%0Adef get_render_result(renderer):%0A    frame = renderer.frame()%0A    img = QtGui.QImage(frame.size().toSize(), QtGui.QImage.Format_RGB32)%0A    img.fill(QtGui.QColor(0, 0, 0).rgb())%0A    p = QtGui.QPainter(img)%0A    r = renderer.sceneBoundingRect()%0A    p.translate(-r.topLeft())%0A    renderer.scene().render(p, r)%0A    return qimage2ndarray.rgb_view(img)%0A%0A%0Adef assert_render_result(renderer, expected_result):%0A    actual_result = get_render_result(renderer)%0A    assert actual_result.shape == expected_result.shape%0A    rendering_differences = actual_result - expected_result%0A    assert numpy.all(rendering_differences == 0)%0A%0A%0A# TODO: add page number argument (splitting up test)%0Adef test_render_results():%0A    renderer = FrameRenderer(None)%0A    scene.addItem(renderer)%0A    for page, frame in zip(pages, slides.frames()):%0A        renderer.setFrame(frame)%0A        assert_render_result(renderer, page)%0A    %0A

add unit tests for rendering results