summaryrefslogtreecommitdiffstats
path: root/tests/libother
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-03-30 14:44:24 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-03-31 11:26:46 -0300
commitc6d32c0339749257ac1b97a48f3c8fdd6f10e50c (patch)
tree0deab5256962798a7b33ea21c4bef1fa5fd8173a /tests/libother
parent7c7d35f56293f4b7d7ce000bc03bab6f4d9994be (diff)
downloadshiboken-c6d32c0339749257ac1b97a48f3c8fdd6f10e50c.tar.gz
shiboken-c6d32c0339749257ac1b97a48f3c8fdd6f10e50c.tar.xz
shiboken-c6d32c0339749257ac1b97a48f3c8fdd6f10e50c.zip
libsample's Point extended with a reverse operator defined in libother.
The libother's Number class now defines a multiply reverse operator with libsample's Point class. Tests were added to check if the generated binding correctly calls Number.__rmul__ method with Point as argument. Reviewed by Anderson Lizardo <anderson.lizardo@openbossa.org> Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Diffstat (limited to 'tests/libother')
-rw-r--r--tests/libother/number.cpp6
-rw-r--r--tests/libother/number.h8
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/libother/number.cpp b/tests/libother/number.cpp
index 0c64def6..61dc3319 100644
--- a/tests/libother/number.cpp
+++ b/tests/libother/number.cpp
@@ -46,3 +46,9 @@ Number::toStr() const
return in.str().c_str();
}
+Point
+operator*(const Point& p, const Number& n)
+{
+ return Point(p.x() * n.value(), p.y() * n.value());
+}
+
diff --git a/tests/libother/number.h b/tests/libother/number.h
index d739802d..32af3325 100644
--- a/tests/libother/number.h
+++ b/tests/libother/number.h
@@ -37,18 +37,24 @@
#include "libothermacros.h"
#include "str.h"
+#include "point.h"
class LIBOTHER_API Number
{
public:
explicit Number(int value) : m_value(value) {};
- int value() { return m_value; }
+ int value() const { return m_value; }
Str toStr() const;
operator Str() const { return toStr(); }
+ friend LIBOTHER_API Point operator*(const Point&, const Number&);
+
private:
int m_value;
};
+
+LIBOTHER_API Point operator*(const Point&, const Number&);
+
#endif // NUMBER_H