Skip to content

Commit

Permalink
Merge pull request #71 from nikitadyumin/master
Browse files Browse the repository at this point in the history
[BUG #7931] fixed rgbToRgbString method that returned "rgb(0,0,0,0)" instead of "rgba(0,0,0,0)" if alpha value was equal to 0
  • Loading branch information
wittemann committed Dec 19, 2013
2 parents 699caea + e396214 commit 42003c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions framework/source/class/qx/test/util/ColorUtil.js
Expand Up @@ -25,6 +25,14 @@ qx.Class.define("qx.test.util.ColorUtil",
members :
{

testRgbToRgbString : function()
{
this.assertEquals("rgba(255,0,0,1)", qx.util.ColorUtil.rgbToRgbString([255, 0, 0, 1]));
this.assertEquals("rgba(255,0,0,0.5)", qx.util.ColorUtil.rgbToRgbString([255, 0, 0, 0.5]));
this.assertEquals("rgba(255,0,0,0)", qx.util.ColorUtil.rgbToRgbString([255, 0, 0, 0]));
this.assertEquals("rgb(255,0,0)", qx.util.ColorUtil.rgbToRgbString([255, 0, 0]));
},

testCssStringToRgb : function()
{
this.assertEquals("255,0,0", qx.util.ColorUtil.cssStringToRgb("rgba(255,0,0,1)"));
Expand Down
2 changes: 1 addition & 1 deletion framework/source/class/qx/util/ColorUtil.js
Expand Up @@ -269,7 +269,7 @@ qx.Bootstrap.define("qx.util.ColorUtil",
* @return {String} an RGB string
*/
rgbToRgbString : function(rgb) {
return "rgb" + (rgb[3] ? "a" : "") + "(" + rgb.join(",") + ")";
return "rgb" + (rgb[3] !== undefined ? "a" : "") + "(" + rgb.join(",") + ")";
},


Expand Down

0 comments on commit 42003c8

Please sign in to comment.