void TestPointRemoveCommand::redoUndoPointRemove()
{
    KoPathShape path1;
    path1.moveTo(QPointF(0, 0));
    path1.lineTo(QPointF(0, 100));
    KoPathPoint *point1 = path1.curveTo(QPointF(0, 50), QPointF(100, 50), QPointF(100, 100));
    KoPathPoint *point2 = path1.lineTo(QPointF(200, 100));
    path1.curveTo(QPointF(200, 50), QPointF(300, 50), QPointF(300, 100));

    QPainterPath orig1(QPointF(0, 0));
    orig1.lineTo(0, 100);
    orig1.cubicTo(0, 50, 100, 50, 100, 100);
    orig1.lineTo(200, 100);
    orig1.cubicTo(200, 50, 300, 50, 300, 100);

    QVERIFY(orig1 == path1.outline());

    KoPathShape path2;
    path2.moveTo(QPointF(0, 0));
    KoPathPoint *point3 = path2.curveTo(QPointF(50, 0), QPointF(100, 50), QPointF(100, 100));
    path2.curveTo(QPointF(50, 100), QPointF(0, 50), QPointF(0, 0));
    path2.closeMerge();

    QList<KoPathPointData> pd;
    pd.append(KoPathPointData(&path1, path1.pathPointIndex(point1)));
    pd.append(KoPathPointData(&path1, path1.pathPointIndex(point2)));
    pd.append(KoPathPointData(&path2, path2.pathPointIndex(point3)));

    QPainterPath ppath1Org = path1.outline();
    QPainterPath ppath2Org = path2.outline();

    MockShapeController mockController;
    KoShapeController shapeController(0, &mockController);

    KUndo2Command *cmd = KoPathPointRemoveCommand::createCommand(pd, &shapeController);
    cmd->redo();

    QPainterPath ppath1(QPointF(0, 0));
    ppath1.lineTo(0, 100);
    ppath1.cubicTo(0, 50, 300, 50, 300, 100);

    QPainterPath ppath2(QPointF(0, 0));
    ppath2.cubicTo(50, 0, 0, 50, 0, 0);
    ppath2.closeSubpath();

    QVERIFY(ppath1 == path1.outline());
    QVERIFY(ppath2 == path2.outline());

    cmd->undo();

    QVERIFY(ppath1Org == path1.outline());
    QVERIFY(ppath2Org == path2.outline());

    delete cmd;
}
int main(int ac, char **av)
{
  if (strlen(HOSTTYPE) < 4 || strncmp(HOSTTYPE, "i386", 4) != 0)
    /* This is not an `i386' platform.  We can't run this test. */
    return 0;

#ifdef HAVE_MPROTECT
  printf("Making code segment writable.\n");
  if (mprotect((void *)orig1, (long)main - (long)orig1,
               PROT_EXEC|PROT_READ|PROT_WRITE) < 0)
    {
      printf("mprotect failed\n");
      return 0;
    }
#else /* HAVE_MPROTECT */
  printf("No mprotect() found - cannot make code segment writable.\n");
  printf("Trying to run the test anyway, "
         "but this may legitimately fail or dump core.\n");
#endif /* HAVE_MPROTECT */

  printf("Starting attach tests.\n");
  printf("pass: "******" %d", pass);
      fflush(stdout);

      /* Attach substitutions.  We do "before" substitutions on even rounds
         and "after" substitutions on odd rounds. */
      substs = (pass & 1) ? substs_after : substs_before;
      
#if SSH_NetBSD == 200
      ssh_attach_ifioctl();
#else /* SSH_NetBSD == 200 */
      ssh_attach_substitutions();
#endif /* SSH_NetBSD == 200 */

      /* Test that the substitutions get called correctly. */

      orig_called = subst_called = 0;
      orig1(pass);
      assert(orig_called && subst_called);

      orig_called = subst_called = 0;
      orig2(pass + 1, pass + 2, pass + 3, pass + 4, pass + 5, pass + 6,
            pass + 7, pass + 8, pass + 9, pass + 10, pass + 11, pass + 12);
      assert(orig_called && subst_called);

      orig_called = subst_called = 0;
      orig3();
      assert(!orig_called && subst_called);

      /* Detach all substitutions. */
#if SSH_NetBSD == 200
      ssh_detach_ifioctl();
#else /* SSH_NetBSD == 200 */
      ssh_detach_substitutions();
#endif /* SSH_NetBSD == 200 */

      /* Check that only the originals get called. */
      orig_called = subst_called = 0;
      orig1(pass);
      assert(orig_called && !subst_called);

      orig_called = subst_called = 0;
      orig2(pass + 1, pass + 2, pass + 3, pass + 4, pass + 5, pass + 6,
            pass + 7, pass + 8, pass + 9, pass + 10, pass + 11, pass + 12);
      assert(orig_called && !subst_called);

      orig_called = subst_called = 0;
      orig3();
      assert(orig_called && !subst_called);

      /* Check that return value from original function is correctly
         retained in after substitution. */
      substs = substs_retval;
      if (orig_retval(3) != 4)
        ssh_fatal("orig_retval returned incorrect value (no subst).");
#if SSH_NetBSD == 200
      ssh_attach_ifioctl();
#else /* SSH_NetBSD == 200 */
      ssh_attach_substitutions();
#endif /* SSH_NetBSD == 200 */
      orig_called = subst_called = 0;
      if (orig_retval(3) != 4)
        ssh_fatal("orig_retval returned incorrect value after substituting.");
      if (!orig_called || !subst_called)
        ssh_fatal("retval: both functions not called");
#if SSH_NetBSD == 200
      ssh_detach_ifioctl();
#else /* SSH_NetBSD == 200 */
      ssh_detach_substitutions();
#endif /* SSH_NetBSD == 200 */
      if (orig_retval(3) != 4)
        ssh_fatal("orig_retval returned incorrect value (after detach).");
    }
  printf("\nAttach tests successful.\n");

  return 0;
}