[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcaca] [PATCH] ruby/caca-display.c: Use UINT2NUM instead of NUM2UINT.
- To: libcaca@lists.zoy.org
- Subject: [libcaca] [PATCH] ruby/caca-display.c: Use UINT2NUM instead of NUM2UINT.
- From: Tony Miller <mcfiredrill@gmail.com>
- Date: Sat, 10 Sep 2011 11:18:38 -0700
- Delivered-to: list-libcaca@zoy.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=R/cVswR3KP2eFLy9y+dwGQhOFLFvZ2p2K65DiM4URRI=; b=pGlBuZR0mDYIUiwj1FLxISNT9k5w6LMz38CoCJW2eBmJKAUI5Lqn91+ma9xLZWvQSf uVyplyPnHP6FvqFdUONPKEieOtLmc8qdlaJg9aIvt9SVdo9OmDQ30v4o0KpLlLAvHQFx EGOoVwPyG8Xvb9gA/8raA4esaytK+ybiStLjM=
- Reply-to: libcaca@lists.zoy.org
- Sender: libcaca-bounce@lists.zoy.org
- User-agent: Mutt/1.5.21 (2010-09-15)
This patch fixes some functions in ruby/caca-display.c that incorrectly use
NUM2UINT instead of UINT2NUM.
I wrote some tests that use these functions.
The patch is the latest commit in this repo as well:
git://github.com/mcfiredrill/libcaca.git
-Tony
---
ruby/caca-display.c | 10 +++++-----
ruby/t/tc_display.rb | 17 +++++++++++++++++
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/ruby/caca-display.c b/ruby/caca-display.c
index 80f90d3..6556c4d 100644
--- a/ruby/caca-display.c
+++ b/ruby/caca-display.c
@@ -114,17 +114,17 @@ static VALUE set_time2(VALUE self, VALUE t)
static VALUE get_time(VALUE self)
{
- return NUM2UINT(caca_get_display_time(_SELF));
+ return UINT2NUM(caca_get_display_time(_SELF));
}
static VALUE get_width(VALUE self)
{
- return NUM2UINT(caca_get_display_width(_SELF));
+ return UINT2NUM(caca_get_display_width(_SELF));
}
static VALUE get_height(VALUE self)
{
- return NUM2UINT(caca_get_display_height(_SELF));
+ return UINT2NUM(caca_get_display_height(_SELF));
}
static VALUE set_title(VALUE self, VALUE t)
@@ -144,12 +144,12 @@ static VALUE set_title2(VALUE self, VALUE t)
static VALUE get_mouse_x(VALUE self)
{
- return NUM2UINT(caca_get_mouse_x(_SELF));
+ return UINT2NUM(caca_get_mouse_x(_SELF));
}
static VALUE get_mouse_y(VALUE self)
{
- return NUM2UINT(caca_get_mouse_y(_SELF));
+ return UINT2NUM(caca_get_mouse_y(_SELF));
}
static VALUE set_mouse(VALUE self, VALUE visible)
diff --git a/ruby/t/tc_display.rb b/ruby/t/tc_display.rb
index ff2b64e..8bd3f17 100644
--- a/ruby/t/tc_display.rb
+++ b/ruby/t/tc_display.rb
@@ -31,4 +31,21 @@ class TC_Canvas < Test::Unit::TestCase
d = Caca::Display.new()
d.cursor = 1
end
+ def test_get_mouse_coordinates
+ c = Caca::Canvas.new(3, 3)
+ d = Caca::Display.new(c)
+ assert_not_nil(d.mouse_x)
+ assert_not_nil(d.mouse_y)
+ end
+ def test_get_display_dimensions
+ c = Caca::Canvas.new(3, 3)
+ d = Caca::Display.new(c)
+ assert_not_nil(d.height)
+ assert_not_nil(d.width)
+ end
+ def test_get_time
+ c = Caca::Canvas.new(3, 3)
+ d = Caca::Display.new(c)
+ assert_not_nil(d.time)
+ end
end
--
1.7.6
--
This is the Caca Labs mailing-list, see http://caca.zoy.org/
Trouble unsubscribing? Please contact <sam@zoy.org>
List archives are at http://caca.zoy.org/list/