Skip to content
Snippets Groups Projects
Commit 1b121ca7 authored by tobias's avatar tobias
Browse files

added entity name to Copy and CreateEntityFromView; modified unit tests

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1788 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 80dfbd42
No related branches found
No related tags found
No related merge requests found
......@@ -227,6 +227,7 @@ void EntityImpl::DoCopy(EntityImplPtr dest)
{
// first copy the chain - residue - atom hierarchy before replicating the
// bond network and the torsions
dest->SetName(this->GetName());
this->ReplicateHierarchy(dest);
this->DoCopyBondsAndTorsions(dest);
}
......
......@@ -398,6 +398,7 @@ EntityHandle CreateEntityFromView(const EntityView& view,
if (!handle.IsValid()) {
handle=CreateEntity();
}
handle.SetName(view.GetName());
Replicator replicator(handle.Impl(), view, include_exlusive_atoms);
TorsionAdder adder(replicator, handle.Impl(), view);
return handle;
......
......@@ -49,6 +49,8 @@ EntityHandle make_test_entity()
ChainHandle chain = e.InsertChain("A");
ResidueHandle res1 = e.AppendResidue(chain, "MET");
eh.SetName("TestEntity");
e.InsertAtom(res1, "N",geom::Vec3(21.609,35.384,56.705));
e.InsertAtom(res1, "CA",geom::Vec3(20.601,35.494,57.793));
e.InsertAtom(res1, "C",geom::Vec3(19.654,34.300,57.789));
......@@ -78,6 +80,9 @@ BOOST_AUTO_TEST_SUITE( mol_base )
BOOST_AUTO_TEST_CASE(entity_creator)
{
EntityHandle eh = CreateEntity();
eh.SetName("TestEntity");
BOOST_CHECK(eh.GetName()=="TestEntity");
XCSEditor e=eh.RequestXCSEditor();
ChainHandle chain = e.InsertChain("C");
BOOST_CHECK(chain.GetName()=="C");
......@@ -297,6 +302,8 @@ BOOST_AUTO_TEST_CASE(copy)
{
EntityHandle eh=make_test_entity();
EntityHandle cp=eh.Copy();
BOOST_CHECK_EQUAL(cp.GetName(),eh.GetName());
ResidueHandle x2=eh.FindResidue("A", mol::ResNum(2));
BOOST_CHECK_EQUAL(cp.GetAtomCount(),eh.GetAtomCount());
BOOST_CHECK_EQUAL(cp.GetResidueCount(),eh.GetResidueCount());
......
......@@ -30,6 +30,7 @@ using namespace ost::mol;
EntityHandle mk_test_ent()
{
EntityHandle ent=CreateEntity();
ent.SetName("TestEntity");
XCSEditor edi=ent.RequestXCSEditor();
ChainHandle chain_a=edi.InsertChain("A");
ResidueHandle res_a=edi.AppendResidue(chain_a, "A");
......@@ -333,5 +334,18 @@ BOOST_AUTO_TEST_CASE(test_intersection_b)
bonds));
}
BOOST_AUTO_TEST_CASE(entity_from_view) {
EntityHandle ent=mk_test_ent();
EntityView v1=ent.Select("aname=B,C,F,G");
EntityHandle ent_fv=mol::CreateEntityFromView(v1, false);
BOOST_CHECK_EQUAL(ent.GetName(), ent_fv.GetName());
BOOST_CHECK_EQUAL(ent_fv.GetBondCount(),2);
BOOST_CHECK_EQUAL(ent_fv.GetAtomCount(), 4);
BOOST_CHECK_EQUAL(ent_fv.GetResidueCount(), 4);
BOOST_CHECK_EQUAL(ent_fv.GetChainCount(), 2);
}
BOOST_AUTO_TEST_SUITE_END()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment