Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-09-29 19:35:32 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-09-29 19:35:32 (GMT)
commitce310cb0fdeed6ca07ad2e8d09ecbfef9a0367f0 (patch)
tree2c199224e2256c460253899ec1e5b78c3d43a6c7
parenta0a88aed6d3062ac9d498b2fe40bae24d8dfee9c (diff)
Add gradient test
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--cairo_perf_test.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/cairo_perf_test.py b/cairo_perf_test.py
index 43960c1..4e4f0e1 100644
--- a/cairo_perf_test.py
+++ b/cairo_perf_test.py
@@ -21,7 +21,7 @@ png_test_file = '/usr/share/icons/gnome/256x256/emotes/face-cool.png'
class CairoTest(Gtk.DrawingArea):
- tests = ['box', 'circle', 'text', 'bitmap', 'bitmap_ops']
+ tests = ['box', 'circle', 'text', 'bitmap', 'bitmap_ops', 'gradient']
def __init__(self):
self._test_number = 0
@@ -75,7 +75,14 @@ class CairoTest(Gtk.DrawingArea):
ctx.set_source_surface(self._im_surface)
ctx.paint()
ctx.restore()
-
+ if self._test == 'gradient':
+ ctx.rectangle(x, y, width, width)
+ pat = cairo.LinearGradient (x, y, x+ width, y + width)
+ r, g, b, a = colors[random.randint(0, 5)]
+ pat.add_color_stop_rgba (0, r, g, b, a)
+ r, g, b, a = colors[random.randint(0, 5)]
+ pat.add_color_stop_rgba (1, r, g, b, a)
+ ctx.set_source(pat)
ctx.fill()
logging.error("Time test %s = %f s.", self._test,
(time.time() - timeini))