コード例 #1
0
TEST_F(ModelFixture, ShadingSurfaceGroup_SetParent)
{
  Model model;

  Site site = model.getUniqueModelObject<Site>();
  Building building = model.getUniqueModelObject<Building>();
  Space space(model);

  ShadingSurfaceGroup group(model);
  EXPECT_EQ("Building", group.shadingSurfaceType());
  ASSERT_TRUE(group.parent());
  EXPECT_EQ(building.handle(), group.parent()->handle());
  EXPECT_FALSE(group.space());

  EXPECT_TRUE(group.setParent(site));
  EXPECT_EQ("Site", group.shadingSurfaceType());
  ASSERT_TRUE(group.parent());
  EXPECT_EQ(site.handle(), group.parent()->handle());
  EXPECT_FALSE(group.space());

  EXPECT_TRUE(group.setParent(space));
  EXPECT_EQ("Space", group.shadingSurfaceType());
  ASSERT_TRUE(group.parent());
  EXPECT_EQ(space.handle(), group.parent()->handle());
  ASSERT_TRUE(group.space());
  EXPECT_EQ(space.handle(), group.space()->handle());

  EXPECT_TRUE(group.setParent(building));
  EXPECT_EQ("Building", group.shadingSurfaceType());
  ASSERT_TRUE(group.parent());
  EXPECT_EQ(building.handle(), group.parent()->handle());
  EXPECT_FALSE(group.space());
}
コード例 #2
0
TEST_F(ModelFixture, ShadingSurfaceGroup_Site_Hierarchy)
{
  Model model;

  // make a site
  Site site = model.getUniqueModelObject<Site>();

  // add a shading surface group
  ShadingSurfaceGroup group(model);
  EXPECT_TRUE(group.setShadingSurfaceType("Site"));

  // make a new shading surface
  Point3dVector points;
  points.push_back(Point3d(0, 2, 0));
  points.push_back(Point3d(0, 0, 0));
  points.push_back(Point3d(1, 0, 0));
  ShadingSurface surface(points, model);
  EXPECT_TRUE(surface.setShadingSurfaceGroup(group));
  ASSERT_TRUE(surface.shadingSurfaceGroup());
  EXPECT_EQ(group.handle(), surface.shadingSurfaceGroup()->handle());

  // check children from group
  ASSERT_EQ(static_cast<unsigned>(1), group.children().size());
  EXPECT_EQ(surface.handle(), group.children()[0].handle());

  // now check children from site
  ASSERT_EQ(static_cast<unsigned>(1), site.children().size());
  EXPECT_EQ(group.handle(), site.children()[0].handle());

  // check parent from group
  ASSERT_TRUE(group.parent());
  EXPECT_EQ(site.handle(), group.parent()->handle());

  // check parent from surface
  ASSERT_TRUE(surface.parent());
  EXPECT_EQ(group.handle(), surface.parent()->handle());
}