@@ -1492,46 +1492,52 @@ suite('p5.RendererGL', function() {
14921492 suite ( 'tint() in WEBGL mode' , function ( ) {
14931493 test ( 'default tint value is set and not null' , function ( ) {
14941494 myp5 . createCanvas ( 100 , 100 , myp5 . WEBGL ) ;
1495- assert . deepEqual ( myp5 . _renderer . states . tint . array ( ) , [ 1 , 1 , 1 , 1 ] ) ;
1495+ assert . deepEqual ( myp5 . _renderer . states . tint
1496+ . _getRGBA ( [ 255 , 255 , 255 , 255 ] ) , [ 255 , 255 , 255 , 255 ] ) ;
14961497 } ) ;
14971498
14981499
14991500
15001501 test ( 'tint value is modified correctly when tint() is called' , function ( ) {
15011502
1502- function assertDeepEqualColor ( actual , expected ) {
1503- if ( typeof actual === 'string' && typeof expected === 'string' ) {
1504- assert . equal ( actual , expected ) ;
1505- } else {
1506- assert . deepEqual ( actual , myp5 . color ( expected ) . array ( ) ) ;
1507- }
1503+ function assertColorEq ( tint , colArray ) {
1504+ assert . deepEqual ( tint . _getRGBA ( [ 255 , 255 , 255 , 255 ] ) , colArray ) ;
15081505 }
1506+
15091507 myp5 . createCanvas ( 100 , 100 , myp5 . WEBGL ) ;
1508+
15101509 myp5 . tint ( 0 , 153 , 204 , 126 ) ;
1511- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 0 , 153 , 204 , 126 ] ) ;
1510+ assertColorEq ( myp5 . _renderer . states . tint , [ 0 , 153 , 204 , 126 ] ) ;
1511+
15121512 myp5 . tint ( 100 , 120 , 140 ) ;
1513- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 100 , 120 , 140 , 255 ] ) ;
1514-
1513+ assertColorEq ( myp5 . _renderer . states . tint , [ 100 , 120 , 140 , 255 ] ) ;
1514+
15151515 myp5 . tint ( 'violet' ) ;
1516- // Note that in WEBGL mode, we don't convert color strings to arrays until the shader,
1516+ // Note that in WEBGL mode, we don't convert color strings to arrays until the shader,
15171517 // so the tint state is still the string 'violet' at this point, not the array [238, 130, 238, 255].
1518- //assertDeepEqualColor(myp5._renderer.states.tint.array() , [238, 130, 238, 255]);
1519- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , 'violet' ) ;
1518+ //assertDeepEqualColor(myp5._renderer.states.tint, [238, 130, 238, 255]);
1519+ assert . equal ( myp5 . _renderer . states . tint , 'violet' ) ;
15201520
15211521 myp5 . tint ( 100 ) ;
1522- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 100 , 100 , 100 , 255 ] ) ;
1522+ assertColorEq ( myp5 . _renderer . states . tint , [ 100 , 100 , 100 , 255 ] ) ;
1523+
15231524 myp5 . tint ( 100 , 126 ) ;
1524- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 100 , 100 , 100 , 126 ] ) ;
1525+ assertColorEq ( myp5 . _renderer . states . tint , [ 100 , 100 , 100 , 126 ] ) ;
1526+
15251527 myp5 . tint ( [ 100 , 126 , 0 , 200 ] ) ;
1526- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 100 , 126 , 0 , 200 ] ) ;
1528+ assertColorEq ( myp5 . _renderer . states . tint , [ 100 , 126 , 0 , 200 ] ) ;
1529+
15271530 myp5 . tint ( [ 100 , 126 , 0 ] ) ;
1528- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 100 , 126 , 0 , 255 ] ) ;
1531+ assertColorEq ( myp5 . _renderer . states . tint , [ 100 , 126 , 0 , 255 ] ) ;
1532+
15291533 myp5 . tint ( [ 100 ] ) ;
1530- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 100 , 100 , 100 , 255 ] ) ;
1534+ assertColorEq ( myp5 . _renderer . states . tint , [ 100 , 100 , 100 , 255 ] ) ;
1535+
15311536 myp5 . tint ( [ 100 , 126 ] ) ;
1532- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 100 , 100 , 100 , 126 ] ) ;
1537+ assertColorEq ( myp5 . _renderer . states . tint , [ 100 , 100 , 100 , 126 ] ) ;
1538+
15331539 myp5 . tint ( myp5 . color ( 255 , 204 , 0 ) ) ;
1534- assertDeepEqualColor ( myp5 . _renderer . states . tint . array ( ) , [ 255 , 204 , 0 , 255 ] ) ;
1540+ assertColorEq ( myp5 . _renderer . states . tint , [ 255 , 204 , 0 , 255 ] ) ;
15351541 } ) ;
15361542
15371543 test ( 'tint should be reset after draw loop' , function ( ) {
@@ -1548,7 +1554,8 @@ suite('p5.RendererGL', function() {
15481554 } ;
15491555 } ) ;
15501556 } ) . then ( function ( _tint ) {
1551- assert . deepEqual ( _tint . array ( ) , [ 1 , 1 , 1 , 1 ] ) ;
1557+ assert . deepEqual ( _tint . _getRGBA ( [ 255 , 255 , 255 , 255 ] ) ,
1558+ [ 255 , 255 , 255 , 255 ] ) ;
15521559 } ) ;
15531560 } ) ;
15541561 } ) ;
0 commit comments