Hi Larry
On Thu, Feb 20, 2014 at 8:16 AM, Larry Shaffer <lar...@dakotacarto.com>wrote: > Hi, > > While trying to get some labeling bugs fixed, I noticed some serious > issues with the local unit test server, for qgis_mapsev.fcgi, I had > previously made, and some issues relating to the loading of test fonts. The > latter drove me crazy for over a week trying to track it down, but I > finally have a workaround. I can now essentially 'trust' the output from > server tests. > > What changes did I make? > > * Tossed all the old QgsLocalServer[Config] classes and support files > > * QgsLocalServer is now a server controller class [0] with these features: > - Web and FCGI processes are separated and can be independently > controlled > - Abstracted controller can work with any backend Web and FCGI-spawning > executables > - Initial Lighttpd and spawn-fcgi support, but can work with Nginx, > Apache, uWSGI, fcgiwrap, etc. > - Just need local init scripts, or commands, and configs to add new > backends, which only need to be on PATH > - Uses sockets on *nix-based machines > > * Removed FreeSansQGIS font and added Bitstream Vera Sans (Roman, Bold, > Oblique, Bold Oblique) test font family [1] > * Test fonts reworked to have specific 'QGIS Vera Sans' name to avoid font > conflicts > * Test fonts are now built into desktop and server executables via > testdata.qrc > * In Release builds, all test fonts are available, but not loaded by > default > * In Debug builds, all test fonts are available, but only Roman and Bold > styles are loaded by default > * Loading of test fonts moved to QgsFontUtils, with sip bindings > > > What does this affect? > > Very little, except my sanity. :-) Other than the adding of testdata.qrc > to the desktop and server executables, regardless of build type, only the > fledgling Python unit tests for labeling were affected. This is because no > one else used the old QgsLocalServer classes. > > > So, what's this mean? > > * Adding a local server to a Python test class is very simple [1] > * Once Web and FCGI-spawning executables are available on PATH, no other > config required > * Classes are initial foundation for a Python plugin that allows live > previewing of current project in a local, no-config QGIS Server, with > chose-able web client loaded into QWebPage > > * Test fonts are more robust, but still fairly small in size (load > quickly) [2, see char tables] > * Test fonts can easily be loaded via C++ or Python in desktop or unit > tests > * Example: loaded from PyQGIS Console (running RelWithDebInfo build) > > from PyQt4.QtGui import * > fontdb = QFontDatabase() > > fontdb.styles(QgsFontUtils.standardTestFontFamily()) --> [u'Bold', > u'Roman'] > QgsFontUtils.loadStandardTestFonts(['Bold Oblique']) --> True > fontdb.styles(QgsFontUtils.standardTestFontFamily()) --> [u'Bold Oblique', > u'Bold', u'Roman'] > > tf = QgsFontUtils.getStandardTestFont('Bold Oblique', 12) --> QFont > tf.family() --> u'QGIS Vera Sans' > tf.bold() --> True > tf.italic() --> True > tf.pointSize() --> 12 > > * Such manual loading of test font(s) in a Release build allows helping > users debug labeling, etc. with a known, valid font > * Using similar interface, other fonts of differing typeface, writing > direction, etc. can easily be unit tested > > > Caveats? > > * Only config'd to work with lighttpd/spawn-fcgi and only on Mac, right now > > This is because I didn't have time to also config on other platforms and > work on labeling bugs. It's fairly quick to do however. See [3, 4], if > interested in adding a platform/server setup. The labeling tests generally > failed on most platforms anyways, due to other issues that this setup has > fixed. > > * Practically no docstrings or other documentation, yet (classes are > pretty semantic, though) > > * Control images need rebuilt.. so, all labeling tests will fail until then > > > Lastly, please do not hesitate to make my submitted code better. :-) > > > [0] > https://github.com/qgis/QGIS/blob/master/tests/src/python/qgis_local_server.py#L208-L467 > [1] > https://github.com/qgis/QGIS/blob/master/tests/src/python/qgis_local_server.py#L542-L587 > [2] https://github.com/qgis/QGIS/tree/master/tests/testdata/font/QGIS-Vera > [3] > https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgis_local_server.py#L51 > [4] > https://github.com/qgis/QGIS/tree/master/tests/testdata/qgis_local_server > > This is awesome stuff thanks! Regards Tim > Regards, > > Larry Shaffer > Dakota Cartography > Black Hills, South Dakota > > _______________________________________________ > Qgis-developer mailing list > Qgis-developer@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-developer > -- Tim Sutton - QGIS Project Steering Committee Member ============================================== Please do not email me off-list with technical support questions. Using the lists will gain more exposure for your issues and the knowledge surrounding your issue will be shared with all. Irc: timlinux on #qgis at freenode.net ==============================================
_______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer