[dia] Testcase for missing Object::position update
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Testcase for missing Object::position update
- Date: Fri, 30 Jul 2010 18:01:33 +0000 (UTC)
commit 220dafd8bb3b3f7171349e82da085cc5336618c5
Author: Hans Breuer <hans breuer org>
Date: Fri Jul 30 17:09:44 2010 +0200
Testcase for missing Object::position update
The diagram-as-element was jumping during move due to this.
Now this kind of error is catched by the unit-test, too.
tests/test-objects.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/tests/test-objects.c b/tests/test-objects.c
index 2747ad0..10cd6f8 100644
--- a/tests/test-objects.c
+++ b/tests/test-objects.c
@@ -180,11 +180,12 @@ static void
_test_movement (const DiaObjectType *type)
{
Handle *h1 = NULL, *h2 = NULL;
- Point from = {0, 0};
+ Point from = {5, 5};
DiaObject *o = type->ops->create (&from, type->default_user_data, &h1, &h2);
Rectangle bbox1, bbox2;
Point to = {10, 10};
ObjectChange *change;
+ Point pos;
/* does the object move ... ? */
from = o->position;
@@ -197,16 +198,24 @@ _test_movement (const DiaObjectType *type)
g_assert ( fabs((bbox2.right - bbox2.left) - (bbox1.right - bbox1.left)) < EPSILON
&& fabs((bbox2.bottom - bbox2.top) - (bbox1.bottom - bbox1.top)) < EPSILON);
/* .... really: without changing size ? */
+ pos = o->position;
bbox1 = o->bounding_box;
change = o->ops->move (o, &to);
if (change) /* usually this is NULL for move */
_object_change_free(change);
+ /* does the position reflect the move? */
+ g_assert (pos.x - o->position.x == from.x - to.x && pos.y - o->position.y == from.y - to.y );
+
bbox2 = o->bounding_box;
/* test fails e.g. for 'Cisco - Web cluster' probably due to bezier-bbox-issues: bug 568115 */
if ( strcmp (type->name, "Cisco - IP Softphone") == 0
|| strcmp (type->name, "Cisco - Router in building") == 0
|| strcmp (type->name, "Cisco - MCU") == 0
|| strcmp (type->name, "Cisco - Mac Woman") == 0
+ /* more failing recently? */
+ || strcmp (type->name, "Cisco - SVX (interchangeable with End office)") == 0
+ /* ... changed move condition (starting point) */
+ || strcmp (type->name, "Cisco - ATM Tag Switch Router") == 0
/* FIXME: this shape should be simple enough to actually fix the bug */
|| strcmp (type->name, "Assorted - Heart") == 0
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]