Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geometry::Object copy constructor and assignment operator don't copy handlers correctly #11020

Closed
martyngigg opened this issue Aug 27, 2014 · 1 comment
Assignees
Labels
Framework Issues and pull requests related to components in the Framework High Priority An issue or pull request that if not addressed is severe enough to postponse a release.
Milestone

Comments

@martyngigg
Copy link
Member

This ticket is blocks : TRAC10169

There is also no unit test for this behaviour. This snippet of code will fail with the current HEAD

#!cpp
  void testCopyConstructorGivesObjectWithSameAttributes()
  {
    Object_sptr original = ComponentCreationHelper::createSphere(1.0, V3D(), "sphere");
    int objType(-1);
    double radius(-1.0), height(-1.0);
    std::vector`<V3D>` pts;
    original->GetObjectGeom(objType, pts, radius, height);
    TS_ASSERT_EQUALS(2, objType);
    TS_ASSERT(boost::dynamic_pointer_cast`<GluGeometryHandler>`(original->getGeometryHandler()));

    Object copy(*original);
    // The copy should be a primitive object with a GluGeometryHandler
    objType = -1;
    copy.GetObjectGeom(objType, pts, radius, height);

    TS_ASSERT_EQUALS(2, objType);
    TS_ASSERT(boost::dynamic_pointer_cast`<GluGeometryHandler>`(copy.getGeometryHandler()));
  }

  void testAssignmentOperatorGivesObjectWithSameAttributes()
  {
    Object_sptr original = ComponentCreationHelper::createSphere(1.0, V3D(), "sphere");
    int objType(-1);
    double radius(-1.0), height(-1.0);
    std::vector`<V3D>` pts;
    original->GetObjectGeom(objType, pts, radius, height);
    TS_ASSERT_EQUALS(2, objType);
    TS_ASSERT(boost::dynamic_pointer_cast`<GluGeometryHandler>`(original->getGeometryHandler()));

    Object lhs; // initialize
    lhs = *original; // assign
    // The copy should be a primitive object with a GluGeometryHandler
    objType = -1;
    lhs.GetObjectGeom(objType, pts, radius, height);

    TS_ASSERT_EQUALS(2, objType);
    TS_ASSERT(boost::dynamic_pointer_cast`<GluGeometryHandler>`(lhs.getGeometryHandler()));
  }
@martyngigg
Copy link
Member Author

This issue was originally trac ticket 10178

@martyngigg martyngigg added High Priority An issue or pull request that if not addressed is severe enough to postponse a release. Framework Issues and pull requests related to components in the Framework labels Jun 3, 2015
@martyngigg martyngigg self-assigned this Jun 3, 2015
@martyngigg martyngigg added this to the Release 3.3 milestone Jun 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues and pull requests related to components in the Framework High Priority An issue or pull request that if not addressed is severe enough to postponse a release.
Projects
None yet
Development

No branches or pull requests

1 participant