<div dir="ltr">Recipe that can be included in a pytest or nose test suite to compare appearance of widget with reference saved on disk, or generate the references that don't exist: <br><div><br></div><div><a href="http://www.codeproject.com/Tips/1134902/Testing-QWidget-Snapshot-Regression-in-PyQt">http://www.codeproject.com/Tips/1134902/Testing-QWidget-Snapshot-Regression-in-PyQt</a><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font size="2" style="font-size:small"><br></font></div><div><font size="2" style="font-size:small">Super easy to use: </font></div><div><font size="2" style="font-size:small"><br></font></div><div><pre lang="python" id="gmail-pre45406" class="gmail-notranslate" style="color:rgb(0,0,0);background-color:rgb(251,237,187);padding:6px;font-stretch:normal;font-size:9pt;line-height:normal;font-family:consolas,"courier new",courier,mono;white-space:pre-wrap;border:1px solid rgb(251,237,187);overflow:auto;word-wrap:break-word;word-break:break-word;margin-top:0px"><span class="gmail-code-string" style="margin:0px;padding:0px;border:0px;color:rgb(128,0,128)">app = QApplication([])
widget = QLabel('test')
assert check_widget_snapshot(widget, folder, 'label')</span></pre></div><div><font size="2" style="font-size:small">will generate label.png in folder for widget if it doesn't exist; if it exists, it will load it and compare current widget.grab(). If it finds an RMS of the differences to be > tolerance (default 0, not shown), it will geneate a diff, here it would be called label_diff.png, to help troubleshoot. </font></div><div><font size="2" style="font-size:small"><br></font></div><div><font size="2" style="font-size:small">In some cases (might be most, not sure yet), no need to even wait for app.exec() to start!. </font></div><div><font size="2" style="font-size:small"><br></font></div><div><font size="2" style="font-size:small">Feedback welcome.</font></div><div><font size="2" style="font-size:small">Oliver</font><div style="font-size:small"><font size="1">Open Source contributions: <a href="http://pubsub.sf.net/" style="color:rgb(17,85,204)" target="_blank">PyPubSub</a>,</font><span style="font-size:x-small"> </span><a href="https://github.com/schollii/nose2pytest" style="color:rgb(17,85,204);font-size:x-small" target="_blank">nose2pytest</a><span style="font-size:x-small">,</span><span style="font-size:x-small"> L</span><a href="http://lua-icxx.sf.net/" style="font-size:x-small;color:rgb(17,85,204)" target="_blank">ua-iCxx</a><span style="font-size:x-small">, </span><a href="http://iof.sf.net/" style="font-size:x-small;color:rgb(17,85,204)" target="_blank">iof</a></div><div style="font-size:small"><font size="1"><a href="http://stackoverflow.com/users/869951/schollii" style="color:rgb(17,85,204)" target="_blank">StackOverflow</a> contributions</font></div></div><div><font size="1"><br></font></div><div></div></div></div></div></div></div></div>
</div></div>