1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00

tested MouseEvent

This commit is contained in:
ser1zw 2011-05-05 00:59:55 +09:00
parent 4813ec29bc
commit 6be99de63c
3 changed files with 21 additions and 4 deletions

View file

@ -56,7 +56,7 @@ VALUE
rb_allocate(VALUE klass)
{
MouseEvent *ptr;
return Data_Make_Struct(klass, MouseEvent, 0, -1, ptr);
return Data_Make_Struct(klass, MouseEvent, 0, 0, ptr);
}
/*

View file

@ -21,11 +21,11 @@ __NAMESPACE_BEGIN_OPENCV
__NAMESPACE_BEGIN_GUI
__NAMESPACE_BEGIN_MOUSEEVENT
typedef struct MouseEvent{
typedef struct MouseEvent {
CvPoint point;
int event;
int flag;
}MouseEvent;
} MouseEvent;
VALUE rb_class();
@ -44,7 +44,7 @@ VALUE rb_alt_key_q(VALUE self);
VALUE new_object(int event, int x, int y, int flag);
inline MouseEvent *MOUSEEVENT(VALUE object){
inline MouseEvent *MOUSEEVENT(VALUE object) {
MouseEvent *ptr;
Data_Get_Struct(object, MouseEvent, ptr);
return ptr;

17
test/test_mouseevent.rb Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env ruby
# -*- mode: ruby; coding: utf-8-unix -*-
require 'test/unit'
require 'opencv'
require File.expand_path(File.dirname(__FILE__)) + '/helper'
include OpenCV
include GUI
# Tests for OpenCV::MouseEvent
class TestMouseEvent < OpenCVTestCase
def test_initialize
assert_not_nil(MouseEvent.new)
assert_equal(MouseEvent, MouseEvent.new.class)
end
end