@@ -25,6 +25,16 @@ describe('Canvas', function () {
2525 assert . ok ( / ^ \d + \. \d + \. \d + $ / . test ( Canvas . cairoVersion ) ) ;
2626 } ) ;
2727
28+ it ( 'Allows accessing the prototype on the constructor (GH-803)' , function ( ) {
29+ // Fails for 0.8 and 0.10.
30+ if ( / v 0 .( 8 | 1 0 ) / . test ( process . version ) ) return ;
31+ var c = new Canvas ( 10 , 10 ) ;
32+ Canvas . prototype . width ;
33+ assert ( ! c . hasOwnProperty ( 'width' ) ) ;
34+ assert ( 'width' in c ) ;
35+ assert ( Canvas . prototype . hasOwnProperty ( 'width' ) ) ;
36+ } ) ;
37+
2838 it ( '.parseFont()' , function ( ) {
2939 var tests = [
3040 '20px Arial'
@@ -607,6 +617,11 @@ describe('Canvas', function () {
607617 } ) ;
608618 } ) ;
609619
620+ xit ( 'Context2d allows accessing the prototype on the constructor (GH-803)' , function ( ) {
621+ // Seems like a bug in libcairo2 causes a crash if this is evaluated.
622+ Canvas . Context2d . prototype . patternQuality ;
623+ } ) ;
624+
610625 it ( 'Context2d#createImageData(width, height)' , function ( ) {
611626 var canvas = new Canvas ( 20 , 20 )
612627 , ctx = canvas . getContext ( '2d' ) ;
@@ -622,6 +637,10 @@ describe('Canvas', function () {
622637 assert . equal ( 0 , imageData . data [ 3 ] ) ;
623638 } ) ;
624639
640+ it ( 'ImageData allows accessing the prototype on the constructor (GH-803)' , function ( ) {
641+ Canvas . ImageData . prototype . width ;
642+ } ) ;
643+
625644 it ( 'Context2d#measureText().width' , function ( ) {
626645 var canvas = new Canvas ( 20 , 20 )
627646 , ctx = canvas . getContext ( '2d' ) ;
0 commit comments