Skip to content

Commit

Permalink
Adapt tests for travis
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 16, 2020
1 parent ce86cde commit 91d773a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/src/python/test_qgscolorramplegendnode.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ def test_icon(self):
node = TestColorRampLegend(layer_tree_layer, r, 'min_label', 'max_label') node = TestColorRampLegend(layer_tree_layer, r, 'min_label', 'max_label')


pixmap = node.data(Qt.DecorationRole) pixmap = node.data(Qt.DecorationRole)
self.assertTrue(self.imageCheck('color_ramp_legend_node_icon', 'color_ramp_legend_node_icon', pixmap.toImage()))
im = QImage(pixmap.size(), QImage.Format_ARGB32)
im.fill(QColor(255, 255, 255))
p = QPainter(im)
p.drawPixmap(0, 0, pixmap)
p.end()

self.assertTrue(self.imageCheck('color_ramp_legend_node_icon', 'color_ramp_legend_node_icon', im))


def test_draw(self): def test_draw(self):
r = QgsGradientColorRamp(QColor(200, 0, 0, 100), QColor(0, 200, 0, 200)) r = QgsGradientColorRamp(QColor(200, 0, 0, 100), QColor(0, 200, 0, 200))
Expand All @@ -104,6 +111,7 @@ def test_draw(self):
item_context = QgsLayerTreeModelLegendNode.ItemContext() item_context = QgsLayerTreeModelLegendNode.ItemContext()


image = QImage(400, 250, QImage.Format_ARGB32) image = QImage(400, 250, QImage.Format_ARGB32)
image.fill(QColor(255, 255, 255))


p = QPainter(image) p = QPainter(image)


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 91d773a

Please sign in to comment.