Permalink
Browse files

Final tests for CairoContext - test coverage is now complete

  • Loading branch information...
1 parent 2d2b25e commit 50a7871e7aae7fefd133591b7d94716860a6f38b @auroraeosrose auroraeosrose committed Jul 5, 2009
Showing with 906 additions and 53 deletions.
  1. +1 −1 cairo_context.c
  2. +1 −1 tests/CairoContext/Paths/appendPath.phpt
  3. +1 −1 tests/CairoContext/Transformations/deviceToUser.phpt
  4. +1 −1 tests/CairoContext/Transformations/deviceToUserDistance.phpt
  5. +1 −1 tests/CairoContext/Transformations/userToDevice.phpt
  6. +1 −1 tests/CairoContext/Transformations/userToDeviceDistance.phpt
  7. +6 −6 tests/CairoContext/cairo_paint_with_alpha.phpt
  8. +1 −1 tests/CairoContext/clip.phpt
  9. +1 −1 tests/CairoContext/clipExtents.phpt
  10. +1 −1 tests/CairoContext/clipPreserve.phpt
  11. +1 −1 tests/CairoContext/clipRectangleList.phpt
  12. +1 −1 tests/CairoContext/copyPage.phpt
  13. +11 −2 tests/CairoContext/fill.phpt
  14. +11 −2 tests/CairoContext/fillExtents.phpt
  15. +11 −2 tests/CairoContext/fillPreserve.phpt
  16. +1 −1 tests/CairoContext/getAntialias.phpt
  17. +1 −1 tests/CairoContext/getDash.phpt
  18. +1 −1 tests/CairoContext/getDashCount.phpt
  19. +1 −1 tests/CairoContext/getFillRule.phpt
  20. +1 −1 tests/CairoContext/getGroupTarget.phpt
  21. +1 −1 tests/CairoContext/getLineCap.phpt
  22. +1 −1 tests/CairoContext/getLineJoin.phpt
  23. +35 −0 tests/CairoContext/getLineWidth.phpt
  24. +33 −0 tests/CairoContext/getMiterLimit.phpt
  25. +33 −0 tests/CairoContext/getOperator.phpt
  26. +1 −1 tests/CairoContext/getSource.phpt
  27. +1 −1 tests/CairoContext/getTarget.phpt
  28. +1 −1 tests/CairoContext/getTarget_custom_class.phpt
  29. +1 −1 tests/CairoContext/getTarget_errors.phpt
  30. +33 −0 tests/CairoContext/getTolerance.phpt
  31. +67 −0 tests/CairoContext/inFill.phpt
  32. +67 −0 tests/CairoContext/inStroke.phpt
  33. +50 −0 tests/CairoContext/mask.phpt
  34. +74 −0 tests/CairoContext/maskSurface.phpt
  35. +30 −0 tests/CairoContext/paint.phpt
  36. +48 −0 tests/CairoContext/paintWithAlpha.phpt
  37. +1 −1 tests/CairoContext/popGroup.phpt
  38. +1 −1 tests/CairoContext/popGroupToSource.phpt
  39. +1 −1 tests/CairoContext/pushGroup.phpt
  40. +1 −1 tests/CairoContext/pushGroupWithContent.phpt
  41. +30 −0 tests/CairoContext/resetClip.phpt
  42. +1 −1 tests/CairoContext/restore.phpt
  43. +1 −1 tests/CairoContext/save.phpt
  44. +1 −1 tests/CairoContext/setAntialias.phpt
  45. +1 −1 tests/CairoContext/setFillRule.phpt
  46. +1 −1 tests/CairoContext/setLineCap.phpt
  47. +1 −1 tests/CairoContext/setLineJoin.phpt
  48. +52 −0 tests/CairoContext/setLineWidth.phpt
  49. +52 −0 tests/CairoContext/setMiterLimit.phpt
  50. +53 −0 tests/CairoContext/setOperator.phpt
  51. +1 −1 tests/CairoContext/setSourceRGB.phpt
  52. +1 −1 tests/CairoContext/setSourceRGBA.phpt
  53. +12 −5 tests/CairoContext/setSourceSurface.phpt
  54. +53 −0 tests/CairoContext/setTolerance.phpt
  55. +11 −2 tests/CairoContext/showPage.phpt
  56. +30 −0 tests/CairoContext/stroke.phpt
  57. +40 −0 tests/CairoContext/strokeExtents.phpt
  58. +30 −0 tests/CairoContext/strokePreserve.phpt
View
@@ -1380,7 +1380,7 @@ PHP_FUNCTION(cairo_paint_with_alpha)
double alpha = 0.0;
PHP_CAIRO_ERROR_HANDLING(FALSE)
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &context_zval, cairo_ce_cairocontext, &alpha) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Od", &context_zval, cairo_ce_cairocontext, &alpha) == FAILURE) {
PHP_CAIRO_RESTORE_ERRORS(FALSE)
return;
}
@@ -1,5 +1,5 @@
--TEST--
-Cairo->appendPath() method
+CairoContext->appendPath() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->deviceToUser() method
+CairoContext->deviceToUser() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->deviceToUserDistance() method
+CairoContext->deviceToUserDistance() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->userToDevice() method
+CairoContext->userToDevice() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->userToDeviceDistance() method
+CairoContext->userToDeviceDistance() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -25,7 +25,7 @@ cairo_paint_with_alpha();
cairo_paint_with_alpha($context);
cairo_paint_with_alpha($context, 1, 1);
-// check arg types, should be int
+// check arg types, should be context, double
cairo_paint_with_alpha(1, 1);
cairo_paint_with_alpha($context, array());
?>
@@ -35,13 +35,13 @@ object(CairoImageSurface)#%d (0) {
object(CairoContext)#%d (0) {
}
-Warning: cairo_paint_with_alpha() expects exactly 1 parameter, 2 given in %s on line %d
+Warning: cairo_paint_with_alpha() expects exactly 2 parameters, 0 given in %s on line %d
-Warning: cairo_paint_with_alpha() expects exactly 1 parameter, 0 given in %s on line %d
+Warning: cairo_paint_with_alpha() expects exactly 2 parameters, 1 given in %s on line %d
-Warning: cairo_paint_with_alpha() expects exactly 1 parameter, 3 given in %s on line %d
+Warning: cairo_paint_with_alpha() expects exactly 2 parameters, 3 given in %s on line %d
CAUGHT ERROR: Argument 1 passed to cairo_paint_with_alpha() must be an instance of CairoContext, integer given
-Warning: cairo_paint_with_alpha() expects exactly 1 parameter, 2 given in %s on line %d
+Warning: cairo_paint_with_alpha() expects parameter 1 to be CairoContext, integer given in %s on line %d
-Warning: cairo_paint_with_alpha() expects exactly 1 parameter, 2 given in %s on line %d
+Warning: cairo_paint_with_alpha() expects parameter 2 to be double, array given in %s on line %d
@@ -1,5 +1,5 @@
--TEST--
-Cairo->clip() method
+CairoContext->clip() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->clipExtents() method
+CairoContext->clipExtents() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->clipPreserve() method
+CairoContext->clipPreserve() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->clipRectangleList() method
+CairoContext->clipRectangleList() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->copyPage() method
+CairoContext->copyPage() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->fill() method
+CairoContext->fill() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -13,9 +13,18 @@ $context = new CairoContext($surface);
var_dump($context);
$context->fill();
+
+/* Wrong number args */
+try {
+ $context->fill('foobar');
+ trigger_error('fill requires no args');
+} catch (CairoException $e) {
+ echo $e->getMessage(), PHP_EOL;
+}
?>
--EXPECTF--
object(CairoImageSurface)#%d (0) {
}
object(CairoContext)#%d (0) {
-}
+}
+CairoContext::fill() expects exactly 0 parameters, 1 given
@@ -1,5 +1,5 @@
--TEST--
-Cairo->fillExtents() method
+CairoContext->fillExtents() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -13,6 +13,14 @@ $context = new CairoContext($surface);
var_dump($context);
var_dump($context->fillExtents());
+
+/* Wrong number args */
+try {
+ $context->fillExtents('foobar');
+ trigger_error('fillExtents requires no args');
+} catch (CairoException $e) {
+ echo $e->getMessage(), PHP_EOL;
+}
?>
--EXPECTF--
object(CairoImageSurface)#%d (0) {
@@ -28,4 +36,5 @@ array(4) {
float(0)
[3]=>
float(0)
-}
+}
+CairoContext::fillExtents() expects exactly 0 parameters, 1 given
@@ -1,5 +1,5 @@
--TEST--
-Cairo->fill() method
+CairoContext->fill() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -13,9 +13,18 @@ $context = new CairoContext($surface);
var_dump($context);
$context->fillPreserve();
+
+/* Wrong number args */
+try {
+ $context->fillPreserve('foobar');
+ trigger_error('fillPreserve requires no args');
+} catch (CairoException $e) {
+ echo $e->getMessage(), PHP_EOL;
+}
?>
--EXPECTF--
object(CairoImageSurface)#%d (0) {
}
object(CairoContext)#%d (0) {
-}
+}
+CairoContext::fillPreserve() expects exactly 0 parameters, 1 given
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getAntialias() method
+CairoContext->getAntialias() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getDash() method
+CairoContext->getDash() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getDashCount() method
+CairoContext->getDashCount() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getFillRule() method
+CairoContext->getFillRule() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getGroupTarget() method
+CairoContext->getGroupTarget() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getLineCap() method
+CairoContext->getLineCap() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getLineJoin() method
+CairoContext->getLineJoin() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -0,0 +1,35 @@
+--TEST--
+CairoContext->getLineWidth() method
+--SKIPIF--
+<?php
+if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
+?>
+--FILE--
+<?php
+$surface = new CairoImageSurface(CairoFormat::ARGB32, 50, 50);
+var_dump($surface);
+
+$context = new CairoContext($surface);
+var_dump($context);
+
+$context->setLineWidth(1);
+var_dump($context->getLineWidth());
+
+
+/* wrong params */
+try {
+ $context->getLineWidth(1);
+ trigger_error('CairoContext->getLineWidth() expects 1 param');
+}
+catch (CairoException $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
+
+?>
+--EXPECTF--
+object(CairoImageSurface)#%d (0) {
+}
+object(CairoContext)#%d (0) {
+}
+float(1)
+CairoContext::getLineWidth() expects exactly 0 parameters, 1 given
@@ -0,0 +1,33 @@
+--TEST--
+Cairo->getMiterLimit() method
+--SKIPIF--
+<?php
+if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
+?>
+--FILE--
+<?php
+$surface = new CairoImageSurface(CairoFormat::ARGB32, 50, 50);
+var_dump($surface);
+
+$context = new CairoContext($surface);
+var_dump($context);
+
+$context->setMiterLimit(1);
+var_dump($context->getMiterLimit());
+
+/* wrong params */
+try {
+ $context->getMiterLimit('foobar');
+ trigger_error('Cairo->getMiterLimit() expects no params');
+}
+catch (CairoException $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
+?>
+--EXPECTF--
+object(CairoImageSurface)#%d (0) {
+}
+object(CairoContext)#%d (0) {
+}
+float(1)
+CairoContext::getMiterLimit() expects exactly 0 parameters, 1 given
@@ -0,0 +1,33 @@
+--TEST--
+CairoContext->getOperator() function
+--SKIPIF--
+<?php
+if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
+?>
+--FILE--
+<?php
+$surface = new CairoImageSurface(CairoFormat::ARGB32, 50, 50);
+var_dump($surface);
+
+$context = new CairoContext($surface);
+var_dump($context);
+
+$context->setOperator(CAIRO_FORMAT_ARGB32);
+var_dump($context->getOperator());
+
+try {
+ $context->getOperator(1);
+ trigger_error('CairoContext->getOperator expects 0 parameters.');
+}
+catch (CairoException $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
+
+?>
+--EXPECTF--
+object(CairoImageSurface)#%d (0) {
+}
+object(CairoContext)#%d (0) {
+}
+int(0)
+CairoContext::getOperator() expects exactly 0 parameters, 1 given
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getSource() method
+CairoContext->getSource() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getTarget() method
+CairoContext->getTarget() method
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getTarget() should return custom classes derived from CairoImageSurface
+CairoContext->getTarget() should return custom classes derived from CairoImageSurface
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
@@ -1,5 +1,5 @@
--TEST--
-Cairo->getTarget() error conditions
+CairoContext->getTarget() error conditions
--SKIPIF--
<?php
if(!extension_loaded('cairo')) die('skip - Cairo extension not available');
Oops, something went wrong.

0 comments on commit 50a7871

Please sign in to comment.