Skip to content
Permalink
Browse files

Backport test suite from master

  • Loading branch information
nyalldawson committed Jul 15, 2015
1 parent 60b14a2 commit 9932ae15575532ecc4a6ffc4950457090236cd41
Showing with 1,216 additions and 679 deletions.
  1. +96 −86 src/core/qgsrenderchecker.cpp
  2. +17 −6 src/core/qgsrenderchecker.h
  3. +7 −7 tests/bench/main.cpp
  4. +42 −0 tests/renderchecker.js
  5. +2 −1 tests/src/analysis/CMakeLists.txt
  6. +2 −2 tests/src/analysis/testopenstreetmap.cpp
  7. +15 −15 tests/src/analysis/testqgsrastercalculator.cpp
  8. +6 −6 tests/src/analysis/testqgsvectoranalyzer.cpp
  9. +2 −2 tests/src/analysis/testqgszonalstatistics.cpp
  10. +1 −1 tests/src/app/CMakeLists.txt
  11. +1 −3 tests/src/app/testqgisappclipboard.cpp
  12. +1 −2 tests/src/core/CMakeLists.txt
  13. +1 −1 tests/src/core/qgscompositionchecker.cpp
  14. +1 −1 tests/src/core/regression1141.cpp
  15. +2 −3 tests/src/core/regression992.cpp
  16. +1 −1 tests/src/core/testcontrastenhancements.cpp
  17. +3 −3 tests/src/core/testmaprendererjob.cpp
  18. +7 −7 tests/src/core/testqgis.cpp
  19. +0 −2 tests/src/core/testqgsapplication.cpp
  20. +19 −9 tests/src/core/testqgsatlascomposition.cpp
  21. +21 −14 tests/src/core/testqgsblendmodes.cpp
  22. +13 −9 tests/src/core/testqgscomposerdd.cpp
  23. +9 −5 tests/src/core/testqgscomposereffects.cpp
  24. +12 −4 tests/src/core/testqgscomposergroup.cpp
  25. +11 −8 tests/src/core/testqgscomposerhtml.cpp
  26. +9 −5 tests/src/core/testqgscomposerlabel.cpp
  27. +12 −8 tests/src/core/testqgscomposermap.cpp
  28. +40 −9 tests/src/core/testqgscomposermapgrid.cpp
  29. +10 −6 tests/src/core/testqgscomposermapoverview.cpp
  30. +15 −6 tests/src/core/testqgscomposermodel.cpp
  31. +13 −6 tests/src/core/testqgscomposermultiframe.cpp
  32. +17 −14 tests/src/core/testqgscomposerobject.cpp
  33. +6 −3 tests/src/core/testqgscomposerpaper.cpp
  34. +12 −25 tests/src/core/testqgscomposerpicture.cpp
  35. +35 −27 tests/src/core/testqgscomposerrotation.cpp
  36. +28 −21 tests/src/core/testqgscomposerscalebar.cpp
  37. +7 −3 tests/src/core/testqgscomposershapes.cpp
  38. +9 −5 tests/src/core/testqgscomposertable.cpp
  39. +13 −8 tests/src/core/testqgscomposertablev2.cpp
  40. +10 −7 tests/src/core/testqgscomposerutils.cpp
  41. +11 −8 tests/src/core/testqgscomposition.cpp
  42. +1 −3 tests/src/core/testqgscoordinatereferencesystem.cpp
  43. +15 −12 tests/src/core/testqgsdiagram.cpp
  44. +1 −1 tests/src/core/testqgsdistancearea.cpp
  45. +8 −0 tests/src/core/testqgsfontutils.cpp
  46. +2 −3 tests/src/core/testqgsgeometry.cpp
  47. +2 −3 tests/src/core/testqgsgradients.cpp
  48. +12 −9 tests/src/core/testqgsimageoperation.cpp
  49. +2 −3 tests/src/core/testqgsinvertedpolygonrenderer.cpp
  50. +73 −7 tests/src/core/testqgslegendrenderer.cpp
  51. +1 −2 tests/src/core/testqgsmaplayer.cpp
  52. +21 −17 tests/src/core/testqgsmaprenderer.cpp
  53. +33 −23 tests/src/core/testqgsmaprotation.cpp
  54. +14 −4 tests/src/core/testqgsmapsettings.cpp
  55. +1 −1 tests/src/core/testqgsnetworkcontentfetcher.cpp
  56. +15 −4 tests/src/core/testqgspainteffect.cpp
  57. +98 −6 tests/src/core/testqgspallabeling.cpp
  58. +1 −2 tests/src/core/testqgspoint.cpp
  59. +9 −5 tests/src/core/testqgsproject.cpp
  60. +2 −3 tests/src/core/testqgsrasterfilewriter.cpp
  61. +2 −3 tests/src/core/testqgsrasterfill.cpp
  62. +26 −20 tests/src/core/testqgsrasterlayer.cpp
  63. +2 −3 tests/src/core/testqgsrastersublayer.cpp
  64. +17 −11 tests/src/core/testqgsrenderers.cpp
  65. +1 −1 tests/src/core/testqgsrulebasedrenderer.cpp
  66. +2 −3 tests/src/core/testqgsshapeburst.cpp
  67. +3 −3 tests/src/core/testqgsstylev2.cpp
  68. +2 −2 tests/src/core/testqgsvectordataprovider.cpp
  69. +0 −2 tests/src/core/testqgsvectorfilewriter.cpp
  70. +7 −7 tests/src/core/testqgsvectorlayer.cpp
  71. +8 −23 tests/src/core/testqgsvectorlayercache.cpp
  72. +2 −2 tests/src/core/testziplayer.cpp
  73. +1 −1 tests/src/gui/CMakeLists.txt
  74. +1 −1 tests/src/gui/testprojectionissues.cpp
  75. +1 −1 tests/src/gui/testqgsdualview.cpp
  76. +9 −11 tests/src/gui/testqgsquickprint.cpp
  77. +6 −6 tests/src/gui/testqgsrasterhistogram.cpp
  78. +1 −1 tests/src/gui/testqgsrubberband.cpp
  79. +1 −1 tests/src/gui/testqgsscalecombobox.cpp
  80. +1 −1 tests/src/providers/CMakeLists.txt
  81. +34 −8 tests/src/providers/grass/CMakeLists.txt
  82. +19 −14 tests/src/providers/grass/testqgsgrassprovider.cpp
  83. +4 −4 tests/src/providers/testqgsgdalprovider.cpp
  84. +16 −16 tests/src/providers/testqgswcspublicservers.cpp
  85. +15 −9 tests/src/python/CMakeLists.txt
  86. +2 −12 tests/src/python/test_provider_shapefile.py
  87. +4 −0 tests/src/python/test_qgis_local_server.py
  88. +1 −2 tests/src/python/test_qgsatlascomposition.py
  89. +6 −3 tests/src/python/test_qgsblendmodes.py
  90. +9 −0 tests/src/python/test_qgscomposermapgrid.py
  91. +91 −0 tests/src/python/test_qgscomposerpicture.py
  92. +28 −5 tests/src/python/test_qgsdelimitedtextprovider.py
  93. +31 −25 tests/src/python/test_qgsgeometry.py
  94. +5 −6 tests/src/python/test_qgsnetworkcontentfetcher.py
  95. +6 −2 tests/src/python/test_qgspallabeling_base.py
  96. +2 −3 tests/src/python/test_qgszonalstatistics.py
  97. BIN tests/testdata/control_images/expected_atlas_autoscale1/expected_atlas_autoscale1_mask.png
  98. BIN tests/testdata/control_images/expected_atlas_autoscale2/expected_atlas_autoscale2_mask.png
  99. BIN ...tdata/control_images/expected_atlas_autoscale_old_api1/expected_atlas_autoscale_old_api1_mask.png
  100. BIN ...tdata/control_images/expected_atlas_autoscale_old_api2/expected_atlas_autoscale_old_api2_mask.png
  101. BIN tests/testdata/control_images/expected_atlas_filtering1/expected_atlas_filtering1_mask.png
  102. BIN tests/testdata/control_images/expected_atlas_fixedscale1/expected_atlas_fixedscale1_mask.png
  103. BIN tests/testdata/control_images/expected_atlas_fixedscale2/expected_atlas_fixedscale2_mask.png
  104. BIN ...ata/control_images/expected_atlas_fixedscale_old_api1/expected_atlas_fixedscale_old_api1_mask.png
  105. BIN ...ata/control_images/expected_atlas_fixedscale_old_api2/expected_atlas_fixedscale_old_api2_mask.png
  106. BIN tests/testdata/control_images/expected_atlas_hiding1/expected_atlas_hiding1_mask.png
  107. BIN tests/testdata/control_images/expected_atlas_hiding2/expected_atlas_hiding2_mask.png
  108. BIN ...estdata/control_images/expected_atlas_predefinedscales1/expected_atlas_predefinedscales1_mask.png
  109. BIN ...estdata/control_images/expected_atlas_predefinedscales2/expected_atlas_predefinedscales2_mask.png
  110. BIN tests/testdata/control_images/expected_atlas_sorting1/expected_atlas_sorting1_mask.png
  111. BIN tests/testdata/control_images/expected_atlas_sorting2/expected_atlas_sorting2_mask.png
  112. BIN tests/testdata/control_images/expected_atlas_two_maps1/expected_atlas_two_maps1_mask.png
  113. BIN tests/testdata/control_images/expected_atlas_two_maps2/expected_atlas_two_maps2_mask.png
  114. BIN .../expected_composerattributetable_columnwidth/expected_composerattributetable_columnwidth_mask.png
  115. BIN ...ages/expected_composerattributetable_drawempty/expected_composerattributetable_drawempty_mask.png
  116. BIN .../expected_composerattributetable_headersonly/expected_composerattributetable_headersonly_mask.png
  117. BIN ...rol_images/expected_composerattributetable_render/expected_composerattributetable_render_mask.png
  118. BIN .../expected_composerattributetable_showmessage/expected_composerattributetable_showmessage_mask.png
  119. BIN ...xpected_composermap_exteriorticks_annotated/expected_composermap_exteriorticks_annotated_mask.png
  120. BIN ...ected_composermap_exteriorticks_annotated2/expected_composermap_exteriorticks_annotated2_mask.png
  121. BIN ...images/expected_composermap_filteredannotations/expected_composermap_filteredannotations_mask.png
  122. BIN tests/testdata/control_images/expected_composermap_grid/expected_composermap_grid_mask.png
  123. BIN ...map_interiorexteriorticks_annotated/expected_composermap_interiorexteriorticks_annotated_mask.png
  124. BIN ...p_interiorexteriorticks_annotated2/expected_composermap_interiorexteriorticks_annotated2_mask.png
  125. BIN ...xpected_composermap_interiorticks_annotated/expected_composermap_interiorticks_annotated_mask.png
  126. BIN ...ected_composermap_interiorticks_annotated2/expected_composermap_interiorticks_annotated2_mask.png
  127. BIN ...ages/expected_composermap_lineborder_annotated/expected_composermap_lineborder_annotated_mask.png
  128. BIN ...es/expected_composermap_lineborder_annotated2/expected_composermap_lineborder_annotated2_mask.png
  129. BIN ...l_images/expected_composermap_rotatedannotations/expected_composermap_rotatedannotations_mask.png
  130. BIN ...ted_composermap_verticaldescending_inside/expected_composermap_verticaldescending_inside_mask.png
  131. BIN ...d_composermap_verticaldescending_outside/expected_composermap_verticaldescending_outside_mask.png
  132. BIN .../testdata/control_images/expected_composerrotation_label/expected_composerrotation_label_mask.png
  133. BIN ...a/control_images/expected_composerscalebar_doublebox/expected_composerscalebar_doublebox_mask.png
  134. BIN ...tdata/control_images/expected_composerscalebar_numeric/expected_composerscalebar_numeric_mask.png
  135. BIN ...a/control_images/expected_composerscalebar_singlebox/expected_composerscalebar_singlebox_mask.png
  136. BIN ...ages/expected_composerscalebar_singlebox_alpha/expected_composerscalebar_singlebox_alpha_mask.png
  137. BIN tests/testdata/control_images/expected_composerscalebar_tick/expected_composerscalebar_tick_mask.png
  138. BIN ...a/control_images/expected_composerutils_drawtext_pos/expected_composerutils_drawtext_pos_mask.png
  139. BIN ...es/expected_composerutils_drawtext_posnocolor/expected_composerutils_drawtext_posnocolor_mask.png
  140. BIN ...control_images/expected_composerutils_drawtext_rect/expected_composerutils_drawtext_rect_mask.png
  141. BIN ...ages/expected_composerutils_drawtext_rectalign/expected_composerutils_drawtext_rectalign_mask.png
  142. BIN ...images/expected_composerutils_drawtext_rectflag/expected_composerutils_drawtext_rectflag_mask.png
  143. BIN .../expected_composerutils_drawtext_rectnocolor/expected_composerutils_drawtext_rectnocolor_mask.png
  144. BIN tests/testdata/control_images/expected_geometry_bufferCheck/expected_geometry_bufferCheck_mask.png
  145. BIN ...ata/control_images/expected_geometry_differenceCheck2/expected_geometry_differenceCheck2_mask.png
  146. BIN tests/testdata/control_images/expected_imageop_bcnochange/expected_imageop_bcnochange_mask.png
  147. BIN tests/testdata/control_images/expected_imageop_colorizefull/expected_imageop_colorizefull_mask.png
  148. BIN ...estdata/control_images/expected_imageop_colorizepartial/expected_imageop_colorizepartial_mask.png
  149. BIN .../testdata/control_images/expected_imageop_decreasebright/expected_imageop_decreasebright_mask.png
  150. BIN ...tdata/control_images/expected_imageop_decreasecontrast/expected_imageop_decreasecontrast_mask.png
  151. BIN tests/testdata/control_images/expected_imageop_decreasesat/expected_imageop_decreasesat_mask.png
  152. BIN tests/testdata/control_images/expected_imageop_dt_spread/expected_imageop_dt_spread_mask.png
  153. BIN tests/testdata/control_images/expected_imageop_fliphoz/expected_imageop_fliphoz_mask.png
  154. BIN tests/testdata/control_images/expected_imageop_flipvert/expected_imageop_flipvert_mask.png
  155. BIN tests/testdata/control_images/expected_imageop_gaussianblur/expected_imageop_gaussianblur_mask.png
  156. BIN ...a/control_images/expected_imageop_gaussianblur_small/expected_imageop_gaussianblur_small_mask.png
  157. BIN tests/testdata/control_images/expected_imageop_grayaverage/expected_imageop_grayaverage_mask.png
  158. BIN tests/testdata/control_images/expected_imageop_graylightness/expected_imageop_graylightness_mask.png
  159. BIN .../testdata/control_images/expected_imageop_grayluminosity/expected_imageop_grayluminosity_mask.png
  160. BIN .../testdata/control_images/expected_imageop_increasebright/expected_imageop_increasebright_mask.png
  161. BIN ...tdata/control_images/expected_imageop_increasecontrast/expected_imageop_increasecontrast_mask.png
  162. BIN tests/testdata/control_images/expected_imageop_increasesat/expected_imageop_increasesat_mask.png
  163. BIN tests/testdata/control_images/expected_imageop_nochange/expected_imageop_nochange_mask.png
  164. BIN ...estdata/control_images/expected_imageop_opacitydecrease/expected_imageop_opacitydecrease_mask.png
  165. BIN ...estdata/control_images/expected_imageop_opacityincrease/expected_imageop_opacityincrease_mask.png
  166. BIN ...estdata/control_images/expected_imageop_opacitynochange/expected_imageop_opacitynochange_mask.png
  167. BIN tests/testdata/control_images/expected_imageop_overlaycolor/expected_imageop_overlaycolor_mask.png
  168. BIN tests/testdata/control_images/expected_imageop_satnochange/expected_imageop_satnochange_mask.png
  169. BIN tests/testdata/control_images/expected_imageop_smallimage/expected_imageop_smallimage_mask.png
  170. BIN tests/testdata/control_images/expected_imageop_stackblur/expected_imageop_stackblur_mask.png
  171. BIN ...control_images/expected_imageop_stackblur_alphaonly/expected_imageop_stackblur_alphaonly_mask.png
  172. BIN tests/testdata/control_images/expected_legend_basic/expected_legend_basic_mask.png
  173. BIN tests/testdata/control_images/expected_legend_big_marker/expected_legend_big_marker_mask.png
  174. BIN tests/testdata/control_images/expected_legend_filter_by_map/expected_legend_filter_by_map.png
  175. BIN tests/testdata/control_images/expected_legend_filter_by_map/expected_legend_filter_by_map_mask.png
  176. BIN ...estdata/control_images/expected_legend_long_symbol_text/expected_legend_long_symbol_text_mask.png
  177. BIN tests/testdata/control_images/expected_legend_three_columns/expected_legend_three_columns_mask.png
  178. BIN tests/testdata/control_images/expected_painteffect_blur/expected_painteffect_blur_mask.png
  179. BIN .../testdata/control_images/expected_painteffect_drawsource/expected_painteffect_drawsource_mask.png
  180. BIN tests/testdata/control_images/expected_painteffect_outerglow/expected_painteffect_outerglow_mask.png
  181. BIN tests/testdata/control_images/expected_painteffect_stack/expected_painteffect_stack_mask.png
  182. BIN tests/testdata/control_images/expected_pal_canvas/sp_buffer/sp_buffer_mask.png
  183. BIN ...control_images/expected_pal_canvas/sp_partials_labels_enabled/sp_partials_labels_enabled_mask.png
  184. BIN tests/testdata/control_images/expected_pal_canvas/sp_shadow/sp_shadow_mask.png
  185. BIN ...trol_images/expected_pal_canvas_line/sp_curved_placement_above/sp_curved_placement_above_mask.png
  186. BIN ...trol_images/expected_pal_canvas_line/sp_curved_placement_below/sp_curved_placement_below_mask.png
  187. BIN ...ol_images/expected_pal_canvas_line/sp_curved_placement_online/sp_curved_placement_online_mask.png
  188. BIN ...s_line/sp_line_placement_above_line_orientation/sp_line_placement_above_line_orientation_mask.png
  189. BIN ...vas_line/sp_line_placement_above_map_orientation/sp_line_placement_above_map_orientation_mask.png
  190. BIN ...s_line/sp_line_placement_below_line_orientation/sp_line_placement_below_line_orientation_mask.png
  191. BIN ...vas_line/sp_line_placement_below_map_orientation/sp_line_placement_below_map_orientation_mask.png
  192. BIN ...ontrol_images/expected_pal_canvas_line/sp_line_placement_online/sp_line_placement_online_mask.png
  193. BIN ...tdata/control_images/expected_pal_composer/sp_img_background_rect/sp_img_background_rect_mask.png
  194. BIN ...es/expected_pal_composer/sp_img_background_rect_w_offset/sp_img_background_rect_w_offset_mask.png
  195. BIN tests/testdata/control_images/expected_pal_composer/sp_img_buffer/sp_img_buffer_mask.png
  196. BIN .../testdata/control_images/expected_pal_composer/sp_img_default_label/sp_img_default_label_mask.png
  197. BIN ...ages/expected_pal_composer/sp_img_partials_labels_enabled/sp_img_partials_labels_enabled_mask.png
  198. BIN tests/testdata/control_images/expected_pal_composer/sp_img_shadow/sp_img_shadow_mask.png
  199. BIN tests/testdata/control_images/expected_pal_composer/sp_img_text_color/sp_img_text_color_mask.png
  200. BIN ...control_images/expected_pal_composer/sp_img_text_size_map_unit/sp_img_text_size_map_unit_mask.png
  201. BIN ...tdata/control_images/expected_pal_composer/sp_pdf_background_rect/sp_pdf_background_rect_mask.png
  202. BIN ...es/expected_pal_composer/sp_pdf_background_rect_w_offset/sp_pdf_background_rect_w_offset_mask.png
  203. BIN ...estdata/control_images/expected_pal_composer/sp_pdf_background_svg/sp_pdf_background_svg_mask.png
  204. BIN ...ages/expected_pal_composer/sp_pdf_background_svg_w_offset/sp_pdf_background_svg_w_offset_mask.png
  205. BIN tests/testdata/control_images/expected_pal_composer/sp_pdf_buffer/sp_pdf_buffer_mask.png
  206. BIN .../testdata/control_images/expected_pal_composer/sp_pdf_default_label/sp_pdf_default_label_mask.png
  207. BIN ...ages/expected_pal_composer/sp_pdf_partials_labels_enabled/sp_pdf_partials_labels_enabled_mask.png
  208. BIN tests/testdata/control_images/expected_pal_composer/sp_pdf_shadow/sp_pdf_shadow_mask.png
  209. BIN tests/testdata/control_images/expected_pal_composer/sp_pdf_text_color/sp_pdf_text_color_mask.png
  210. BIN ...control_images/expected_pal_composer/sp_pdf_text_size_map_unit/sp_pdf_text_size_map_unit_mask.png
  211. BIN tests/testdata/control_images/expected_pal_composer/sp_svg_buffer/sp_svg_buffer_mask.png
  212. BIN ...ages/expected_pal_composer/sp_svg_partials_labels_enabled/sp_svg_partials_labels_enabled_mask.png
  213. BIN tests/testdata/control_images/expected_pal_composer/sp_svg_shadow/sp_svg_shadow_mask.png
  214. BIN ...s/expected_pal_composer_line/sp_img_curved_placement_above/sp_img_curved_placement_above_mask.png
  215. BIN ...s/expected_pal_composer_line/sp_img_curved_placement_below/sp_img_curved_placement_below_mask.png
  216. BIN ...expected_pal_composer_line/sp_img_curved_placement_online/sp_img_curved_placement_online_mask.png
  217. BIN ...p_img_line_placement_above_line_orientation/sp_img_line_placement_above_line_orientation_mask.png
  218. BIN .../sp_img_line_placement_above_map_orientation/sp_img_line_placement_above_map_orientation_mask.png
  219. BIN ...p_img_line_placement_below_line_orientation/sp_img_line_placement_below_line_orientation_mask.png
  220. BIN .../sp_img_line_placement_below_map_orientation/sp_img_line_placement_below_map_orientation_mask.png
  221. BIN ...ges/expected_pal_composer_line/sp_img_line_placement_online/sp_img_line_placement_online_mask.png
  222. BIN ...s/expected_pal_composer_line/sp_pdf_curved_placement_above/sp_pdf_curved_placement_above_mask.png
  223. BIN ...s/expected_pal_composer_line/sp_pdf_curved_placement_below/sp_pdf_curved_placement_below_mask.png
  224. BIN ...expected_pal_composer_line/sp_pdf_curved_placement_online/sp_pdf_curved_placement_online_mask.png
  225. BIN ...p_pdf_line_placement_above_line_orientation/sp_pdf_line_placement_above_line_orientation_mask.png
  226. BIN .../sp_pdf_line_placement_above_map_orientation/sp_pdf_line_placement_above_map_orientation_mask.png
  227. BIN ...p_pdf_line_placement_below_line_orientation/sp_pdf_line_placement_below_line_orientation_mask.png
  228. BIN .../sp_pdf_line_placement_below_map_orientation/sp_pdf_line_placement_below_map_orientation_mask.png
  229. BIN ...ges/expected_pal_composer_line/sp_pdf_line_placement_online/sp_pdf_line_placement_online_mask.png
  230. BIN ...s/expected_pal_composer_line/sp_svg_curved_placement_above/sp_svg_curved_placement_above_mask.png
  231. BIN ...s/expected_pal_composer_line/sp_svg_curved_placement_below/sp_svg_curved_placement_below_mask.png
  232. BIN ...expected_pal_composer_line/sp_svg_curved_placement_online/sp_svg_curved_placement_online_mask.png
  233. BIN ...p_svg_line_placement_above_line_orientation/sp_svg_line_placement_above_line_orientation_mask.png
  234. BIN .../sp_svg_line_placement_above_map_orientation/sp_svg_line_placement_above_map_orientation_mask.png
  235. BIN ...p_svg_line_placement_below_line_orientation/sp_svg_line_placement_below_line_orientation_mask.png
  236. BIN .../sp_svg_line_placement_below_map_orientation/sp_svg_line_placement_below_map_orientation_mask.png
  237. BIN ...ges/expected_pal_composer_line/sp_svg_line_placement_online/sp_svg_line_placement_online_mask.png
  238. BIN tests/testdata/control_images/expected_pal_server/sp_buffer/sp_buffer_mask.png
  239. BIN tests/testdata/control_images/expected_pal_server/sp_shadow/sp_shadow_mask.png
  240. BIN ...trol_images/expected_pal_server_line/sp_curved_placement_above/sp_curved_placement_above_mask.png
  241. BIN ...trol_images/expected_pal_server_line/sp_curved_placement_below/sp_curved_placement_below_mask.png
  242. BIN ...ol_images/expected_pal_server_line/sp_curved_placement_online/sp_curved_placement_online_mask.png
  243. BIN ...r_line/sp_line_placement_above_line_orientation/sp_line_placement_above_line_orientation_mask.png
  244. BIN ...ver_line/sp_line_placement_above_map_orientation/sp_line_placement_above_map_orientation_mask.png
  245. BIN ...r_line/sp_line_placement_below_line_orientation/sp_line_placement_below_line_orientation_mask.png
  246. BIN ...ver_line/sp_line_placement_below_map_orientation/sp_line_placement_below_map_orientation_mask.png
  247. BIN ...ontrol_images/expected_pal_server_line/sp_line_placement_online/sp_line_placement_online_mask.png
  248. BIN tests/testdata/control_images/expected_rgbwcmyk01_YeGeo.jp2/expected_rgbwcmyk01_YeGeo.jp2_mask.png
  249. BIN ...rol_images/maprotation/expected_lines-parallel-label+45/expected_lines-parallel-label+45_mask.png
  250. BIN tests/testdata/float1-16.tif
  251. BIN tests/testdata/provider/shapefile.dbf
  252. BIN tests/testdata/provider/shapefile.shp
  253. BIN tests/testdata/provider/shapefile.shx
  254. BIN tests/testdata/qgis_local_server/logo.png
@@ -27,6 +27,8 @@
#include <QDebug>
#include <QBuffer>

static int renderCounter = 0;

QgsRenderChecker::QgsRenderChecker()
: mReport( "" )
, mMatchTarget( 0 )
@@ -35,6 +37,8 @@ QgsRenderChecker::QgsRenderChecker()
, mExpectedImageFile( "" )
, mMismatchCount( 0 )
, mColorTolerance( 0 )
, mMaxSizeDifferenceX( 0 )
, mMaxSizeDifferenceY( 0 )
, mElapsedTimeTarget( 0 )
, mBufferDashMessages( false )
{
@@ -43,16 +47,14 @@ QgsRenderChecker::QgsRenderChecker()
QString QgsRenderChecker::controlImagePath() const
{
QString myDataDir( TEST_DATA_DIR ); //defined in CmakeLists.txt
QString myControlImageDir = myDataDir + QDir::separator() + "control_images" +
QDir::separator() + mControlPathPrefix;
QString myControlImageDir = myDataDir + "/control_images/" + mControlPathPrefix;
return myControlImageDir;
}

void QgsRenderChecker::setControlName( const QString &theName )
{
mControlName = theName;
mExpectedImageFile = controlImagePath() + theName + QDir::separator() + mControlPathSuffix
+ theName + ".png";
mExpectedImageFile = controlImagePath() + theName + "/" + mControlPathSuffix + theName + ".png";
}

QString QgsRenderChecker::imageToHash( QString theImageFile )
@@ -101,8 +103,7 @@ void QgsRenderChecker::drawBackground( QImage* image )

bool QgsRenderChecker::isKnownAnomaly( QString theDiffImageFile )
{
QString myControlImageDir = controlImagePath() + mControlName
+ QDir::separator();
QString myControlImageDir = controlImagePath() + mControlName + "/";
QDir myDirectory = QDir( myControlImageDir );
QStringList myList;
QString myFilename = "*";
@@ -121,8 +122,7 @@ bool QgsRenderChecker::isKnownAnomaly( QString theDiffImageFile )
mReport += "<tr><td colspan=3>"
"Checking if " + myFile + " is a known anomaly.";
mReport += "</td></tr>";
QString myAnomalyHash = imageToHash( controlImagePath() + mControlName
+ QDir::separator() + myFile );
QString myAnomalyHash = imageToHash( controlImagePath() + mControlName + "/" + myFile );
QString myHashMessage = QString(
"Checking if anomaly %1 (hash %2)<br>" )
.arg( myFile )
@@ -209,8 +209,7 @@ bool QgsRenderChecker::runTest( QString theTestName,
// Save the pixmap to disk so the user can make a
// visual assessment if needed
//
mRenderedImageFile = QDir::tempPath() + QDir::separator() +
theTestName + "_result.png";
mRenderedImageFile = QDir::tempPath() + "/" + theTestName + "_result.png";

myImage.setDotsPerMeterX( myExpectedImage.dotsPerMeterX() );
myImage.setDotsPerMeterY( myExpectedImage.dotsPerMeterY() );
@@ -226,7 +225,7 @@ bool QgsRenderChecker::runTest( QString theTestName,

//create a world file to go with the image...

QFile wldFile( QDir::tempPath() + QDir::separator() + theTestName + "_result.wld" );
QFile wldFile( QDir::tempPath() + "/" + theTestName + "_result.wld" );
if ( wldFile.open( QIODevice::WriteOnly ) )
{
QgsRectangle r = mMapSettings.extent();
@@ -258,9 +257,14 @@ bool QgsRenderChecker::compareImages( QString theTestName,
}
if ( ! theRenderedImageFile.isEmpty() )
{
#ifndef Q_OS_WIN
mRenderedImageFile = theRenderedImageFile;
#else
mRenderedImageFile = theRenderedImageFile.replace( "\\", "/" );
#endif
}
else if ( mRenderedImageFile.isEmpty() )

if ( mRenderedImageFile.isEmpty() )
{
qDebug( "QgsRenderChecker::runTest failed - Rendered Image File not set." );
mReport = "<table>"
@@ -269,6 +273,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
"Image File not set.</td></tr></table>\n";
return false;
}

//
// Load /create the images
//
@@ -286,9 +291,7 @@ bool QgsRenderChecker::compareImages( QString theTestName,
QImage myDifferenceImage( myExpectedImage.width(),
myExpectedImage.height(),
QImage::Format_RGB32 );
QString myDiffImageFile = QDir::tempPath() +
QDir::separator() +
theTestName + "_result_diff.png";
QString myDiffImageFile = QDir::tempPath() + "/" + theTestName + "_result_diff.png";
myDifferenceImage.fill( qRgb( 152, 219, 249 ) );

//check for mask
@@ -310,20 +313,22 @@ bool QgsRenderChecker::compareImages( QString theTestName,
//
// Set the report with the result
//
mReport = "<table>";
mReport = QString( "<script src=\"file://%1/../renderchecker.js\"></script>\n" ).arg( TEST_DATA_DIR );
mReport += "<table>";
mReport += "<tr><td colspan=2>";
mReport += "Test image and result image for " + theTestName + "<br>"
"Expected size: " + QString::number( myExpectedImage.width() ).toLocal8Bit() + "w x " +
QString::number( myExpectedImage.height() ).toLocal8Bit() + "h (" +
QString::number( mMatchTarget ).toLocal8Bit() + " pixels)<br>"
"Actual size: " + QString::number( myResultImage.width() ).toLocal8Bit() + "w x " +
QString::number( myResultImage.height() ).toLocal8Bit() + "h (" +
QString::number( myPixelCount ).toLocal8Bit() + " pixels)";
mReport += "</td></tr>";
mReport += "<tr><td colspan = 2>\n";
mReport += "Expected Duration : <= " + QString::number( mElapsedTimeTarget ) +
"ms (0 indicates not specified)<br>";
mReport += "Actual Duration : " + QString::number( mElapsedTime ) + "ms<br>";
mReport += QString( "<tr><td colspan=2>"
"Test image and result image for %1<br>"
"Expected size: %2 w x %3 h (%4 pixels)<br>"
"Actual size: %5 w x %6 h (%7 pixels)"
"</td></tr>" )
.arg( theTestName )
.arg( myExpectedImage.width() ).arg( myExpectedImage.height() ).arg( mMatchTarget )
.arg( myResultImage.width() ).arg( myResultImage.height() ).arg( myPixelCount );
mReport += QString( "<tr><td colspan=2>\n"
"Expected Duration : <= %1 (0 indicates not specified)<br>"
"Actual Duration : %2 ms<br></td></tr>" )
.arg( mElapsedTimeTarget )
.arg( mElapsedTime );

// limit image size in page to something reasonable
int imgWidth = 420;
@@ -333,21 +338,23 @@ bool QgsRenderChecker::compareImages( QString theTestName,
imgWidth = qMin( myExpectedImage.width(), imgWidth );
imgHeight = myExpectedImage.height() * imgWidth / myExpectedImage.width();
}
QString myImagesString = "</td></tr>"
"<tr><td>Test Result:</td><td>Expected Result:</td><td>Difference (all blue is good, any red is bad)</td></tr>\n"
"<tr><td><img width=" + QString::number( imgWidth ) +
" height=" + QString::number( imgHeight ) +
" src=\"file://" +
mRenderedImageFile +
"\"></td>\n<td><img width=" + QString::number( imgWidth ) +
" height=" + QString::number( imgHeight ) +
" src=\"file://" +
mExpectedImageFile +
"\"></td>\n<td><img width=" + QString::number( imgWidth ) +
" height=" + QString::number( imgHeight ) +
" src=\"file://" +
myDiffImageFile +
"\"></td>\n</tr>\n</table>";

QString myImagesString = QString(
"<tr>"
"<td colspan=2>Compare actual and expected result</td>"
"<td>Difference (all blue is good, any red is bad)</td>"
"</tr>\n<tr>"
"<td colspan=2 id=\"td-%1-%7\"></td>\n"
"<td align=center><img width=%5 height=%6 src=\"file://%2\"></td>\n"
"</tr>"
"</table>\n"
"<script>\naddComparison(\"td-%1-%7\",\"file://%3\",\"file://%4\",%5,%6);\n</script>\n" )
.arg( theTestName )
.arg( myDiffImageFile )
.arg( mRenderedImageFile )
.arg( mExpectedImageFile )
.arg( imgWidth ).arg( imgHeight )
.arg( renderCounter++ );

QString prefix;
if ( !mControlPathPrefix.isNull() )
@@ -369,30 +376,44 @@ bool QgsRenderChecker::compareImages( QString theTestName,

if ( mMatchTarget != myPixelCount )
{
qDebug( "Test image and result image for %s are different - FAILING!", theTestName.toLocal8Bit().constData() );
mReport += "<tr><td colspan=3>";
mReport += "<font color=red>Expected image and result image for " + theTestName + " are different dimensions - FAILING!</font>";
mReport += "</td></tr>";
mReport += myImagesString;
delete maskImage;
return false;
qDebug( "Test image and result image for %s are different dimensions", theTestName.toLocal8Bit().constData() );

if ( qAbs( myExpectedImage.width() - myResultImage.width() ) > mMaxSizeDifferenceX ||
qAbs( myExpectedImage.height() - myResultImage.height() ) > mMaxSizeDifferenceY )
{
mReport += "<tr><td colspan=3>";
mReport += "<font color=red>Expected image and result image for " + theTestName + " are different dimensions - FAILING!</font>";
mReport += "</td></tr>";
mReport += myImagesString;
delete maskImage;
return false;
}
else
{
mReport += "<tr><td colspan=3>";
mReport += "Expected image and result image for " + theTestName + " are different dimensions, but within tolerance";
mReport += "</td></tr>";
}
}

//
// Now iterate through them counting how many
// dissimilar pixel values there are
//

int maxHeight = qMin( myExpectedImage.height(), myResultImage.height() );
int maxWidth = qMin( myExpectedImage.width(), myResultImage.width() );

mMismatchCount = 0;
int colorTolerance = ( int ) mColorTolerance;
for ( int y = 0; y < myExpectedImage.height(); ++y )
for ( int y = 0; y < maxHeight; ++y )
{
const QRgb* expectedScanline = ( const QRgb* )myExpectedImage.constScanLine( y );
const QRgb* resultScanline = ( const QRgb* )myResultImage.constScanLine( y );
const QRgb* maskScanline = hasMask ? ( const QRgb* )maskImage->constScanLine( y ) : 0;
QRgb* diffScanline = ( QRgb* )myDifferenceImage.scanLine( y );

for ( int x = 0; x < myExpectedImage.width(); ++x )
for ( int x = 0; x < maxWidth; ++x )
{
int maskTolerance = hasMask ? qRed( maskScanline[ x ] ) : 0;
int pixelTolerance = qMax( colorTolerance, maskTolerance );
@@ -440,40 +461,14 @@ bool QgsRenderChecker::compareImages( QString theTestName,
//
// Send match result to report
//
mReport += "<tr><td colspan=3>" +
QString::number( mMismatchCount ) + "/" +
QString::number( mMatchTarget ) +
" pixels mismatched (allowed threshold: " +
QString::number( theMismatchCount ) +
", allowed color component tolerance: " +
QString::number( mColorTolerance ) + ")";
mReport += "</td></tr>";
mReport += QString( "<tr><td colspan=3>%1/%2 pixels mismatched (allowed threshold: %3, allowed color component tolerance: %4)</td></tr>" )
.arg( mMismatchCount ).arg( mMatchTarget ).arg( theMismatchCount ).arg( mColorTolerance );

//
// And send it to CDash
//
emitDashMessage( "Mismatch Count", QgsDartMeasurement::Integer, QString( "%1/%2" ).arg( mMismatchCount ).arg( mMatchTarget ) );

bool myAnomalyMatchFlag = isKnownAnomaly( myDiffImageFile );

if ( myAnomalyMatchFlag )
{
mReport += "<tr><td colspan=3>"
"Difference image matched a known anomaly - passing test! "
"</td></tr>";
return true;
}
else
{
mReport += "<tr><td colspan=3>"
"</td></tr>";
emitDashMessage( "No Anomalies Match", QgsDartMeasurement::Text, "Difference image did not match any known anomaly."
" If you feel the difference image should be considered an anomaly "
"you can do something like this\n"
"cp " + myDiffImageFile + " ../tests/testdata/control_images/" + theTestName +
"/<imagename>.{wld,png}" );
}

if ( mMismatchCount <= theMismatchCount )
{
mReport += "<tr><td colspan = 3>\n";
@@ -495,12 +490,27 @@ bool QgsRenderChecker::compareImages( QString theTestName,
return true;
}
}
else

bool myAnomalyMatchFlag = isKnownAnomaly( myDiffImageFile );
if ( myAnomalyMatchFlag )
{
mReport += "<tr><td colspan = 3>\n";
mReport += "<font color=red>Test image and result image for " + theTestName + " are mismatched</font><br>";
mReport += "</td></tr>";
mReport += myImagesString;
return false;
mReport += "<tr><td colspan=3>"
"Difference image matched a known anomaly - passing test! "
"</td></tr>";
return true;
}

mReport += "<tr><td colspan=3></td></tr>";
emitDashMessage( "Image mismatch", QgsDartMeasurement::Text, "Difference image did not match any known anomaly or mask."
" If you feel the difference image should be considered an anomaly "
"you can do something like this\n"
"cp '" + myDiffImageFile + "' " + controlImagePath() + mControlName +
"/\nIf it should be included in the mask run\n"
"scripts/generate_test_mask_image.py '" + mExpectedImageFile + "' '" + mRenderedImageFile + "'\n" );

mReport += "<tr><td colspan = 3>\n";
mReport += "<font color=red>Test image and result image for " + theTestName + " are mismatched</font><br>";
mReport += "</td></tr>";
mReport += myImagesString;
return false;
}
@@ -41,11 +41,12 @@ class CORE_EXPORT QgsRenderChecker
QgsRenderChecker();

//! Destructor
~QgsRenderChecker() {};
~QgsRenderChecker() {}

QString controlImagePath() const;

QString report() { return mReport; };
QString report() { return mReport; }

float matchPercent()
{
return static_cast<float>( mMismatchCount ) /
@@ -55,7 +56,7 @@ class CORE_EXPORT QgsRenderChecker
unsigned int matchTarget() { return mMatchTarget; }
//only records time for actual render part
int elapsedTime() { return mElapsedTime; }
void setElapsedTimeTarget( int theTarget ) { mElapsedTimeTarget = theTarget; };
void setElapsedTimeTarget( int theTarget ) { mElapsedTimeTarget = theTarget; }

/** Base directory name for the control image (with control image path
* suffixed) the path to the image will be constructed like this:
@@ -66,9 +67,9 @@ class CORE_EXPORT QgsRenderChecker
/** Prefix where the control images are kept.
* This will be appended to controlImagePath
*/
void setControlPathPrefix( const QString &theName ) { mControlPathPrefix = theName + QDir::separator(); }
void setControlPathPrefix( const QString &theName ) { mControlPathPrefix = theName + "/"; }

void setControlPathSuffix( const QString& theName ) { mControlPathSuffix = theName + QDir::separator(); }
void setControlPathSuffix( const QString& theName ) { mControlPathSuffix = theName + "/"; }

/** Get an md5 hash that uniquely identifies an image */
QString imageToHash( QString theImageFile );
@@ -96,6 +97,14 @@ class CORE_EXPORT QgsRenderChecker
* @note added in 2.1
*/
void setColorTolerance( unsigned int theColorTolerance ) { mColorTolerance = theColorTolerance; }

/** Sets the largest allowable difference in size between the rendered and the expected image.
* @param xTolerance x tolerance in pixels
* @param yTolerance y tolerance in pixels
* @note added in QGIS 2.12
*/
void setSizeTolerance( int xTolerance, int yTolerance ) { mMaxSizeDifferenceX = xTolerance; mMaxSizeDifferenceY = yTolerance; }

/**
* Test using renderer to generate the image to be compared.
* @param theTestName - to be used as the basis for writing a file to
@@ -129,7 +138,7 @@ class CORE_EXPORT QgsRenderChecker
*/
bool isKnownAnomaly( QString theDiffImageFile );

/**Draws a checkboard pattern for image backgrounds, so that transparency is visible
/** Draws a checkboard pattern for image backgrounds, so that transparency is visible
* without requiring a transparent background for the image
*/
static void drawBackground( QImage* image );
@@ -173,6 +182,8 @@ class CORE_EXPORT QgsRenderChecker
QString mControlName;
unsigned int mMismatchCount;
unsigned int mColorTolerance;
int mMaxSizeDifferenceX;
int mMaxSizeDifferenceY;
int mElapsedTimeTarget;
QgsMapSettings mMapSettings;
QString mControlPathPrefix;

0 comments on commit 9932ae1

Please sign in to comment.
You can’t perform that action at this time.