fix rawptr handling
MODIFY
gen_rust.py
gen_rust.py
@@ -2424,7 +2424,7 @@ class RawPtrTypeInfo(TypeInfo):
return var_name
if self.is_by_ptr:
return "reinterpret_cast<{}*>({})".format(self.cpptype, var_name)
- return "reinterpret_cast<{}*>(&{})".format(self.inner.cpptype, var_name)
+ return "reinterpret_cast<{}>({})".format(self.cpptype, var_name)
def cpp_method_call_invoke(self, call_name, call_args, is_constructor, attr_type):
if self.is_by_ptr:

MODIFY
tests/core.rs
tests/core.rs
use opencv::{
core::{self, CV_32S, CV_32SC3, CV_64F, CV_64FC1, CV_8U, CV_8UC2, MAKETYPE, Moments},
+ core::{Point2f, RotatedRect, Size2f},
Result,
};
@@ -25,3 +26,15 @@ fn cpu_features_line() -> Result<()> {
assert!(cpu_feats.is_ascii());
Ok(())
}
+
+#[test]
+fn rotated_rect() -> Result<()> {
+ let rect = RotatedRect::new(Point2f::new(100., 100.), Size2f::new(100., 100.), 90.)?;
+ let mut pts = [Point2f::default(); 4];
+ rect.points(&mut pts)?;
+ assert_eq!(Point2f::new(50., 50.), pts[0]);
+ assert_eq!(Point2f::new(150., 50.), pts[1]);
+ assert_eq!(Point2f::new(150., 150.), pts[2]);
+ assert_eq!(Point2f::new(50., 150.), pts[3]);
+ Ok(())
+}

fix rawptr handling