TEST(VoidElement, CopyConstruction) { tawara::VoidElement ve1(8); EXPECT_EQ(tawara::ids::Void, tawara::VoidElement(ve1).id()); EXPECT_EQ(8, tawara::VoidElement(ve1).size()); EXPECT_FALSE(tawara::VoidElement(ve1).fill()); tawara::VoidElement ve2(8, true); EXPECT_EQ(tawara::ids::Void, tawara::VoidElement(ve2).id()); EXPECT_EQ(8, tawara::VoidElement(ve2).size()); EXPECT_TRUE(tawara::VoidElement(ve2).fill()); tawara::VoidElement ve3(8, false); EXPECT_EQ(tawara::ids::Void, tawara::VoidElement(ve3).id()); EXPECT_EQ(8, tawara::VoidElement(ve3).size()); EXPECT_FALSE(tawara::VoidElement(ve3).fill()); }
TEST(VoidElement, Construction) { tawara::VoidElement ve1(8); EXPECT_EQ(tawara::ids::Void, ve1.id()); EXPECT_EQ(8, ve1.size()); EXPECT_FALSE(ve1.fill()); tawara::VoidElement ve2(8, true); EXPECT_EQ(tawara::ids::Void, ve2.id()); EXPECT_EQ(8, ve2.size()); EXPECT_TRUE(ve2.fill()); tawara::VoidElement ve3(8, false); EXPECT_EQ(tawara::ids::Void, ve3.id()); EXPECT_EQ(8, ve3.size()); EXPECT_FALSE(ve3.fill()); }
void CRectangle::getchargeL() { ptbegin.clear(); ptend.clear(); CVector v1=ptsEnd; CVector vrx;vrx.getcoorx(); CVector vry;vry.getcoory(); CVector vrz;vrz.getcoorz(); CVector vro;vro.getcooro(); CVector v2=ptbvir.back(); CVector v3=v1-v2; vrx=vrx*(v3.dot(vrx)); vry=vry*(v3.dot(vry)); CVector v3x=v2+vrx; CVector v3y=v2+vry;//(v3.dot(vry)); CVector e=v3x+vry;//(v3.dot(vry)); CVector ve1(v1.x,v2.y); CVector vb1(v2.x,v1.y); CPoint p11(ptsEnd); CPoint p22(ptsBegin); CVector vp11(p11.x,p11.y); ptbegin.push_back(v2); ptbegin.push_back(v3x);//p1); ptbegin.push_back(e);//ptevir.back()); ptbegin.push_back(v3y);//p3); ptend.push_back(v3x);//p1); ptend.push_back(e);//ptevir.back()); ptend.push_back(v3y);//p3); ptend.push_back(v2); // bez=new CBezier(this); updatecore(); }
TEST(VoidElement, CopyElement) { tawara::StringElement se(0x80, "12345"); std::streamsize se_size(se.size()); tawara::VoidElement ve1(se); EXPECT_EQ(se_size, ve1.size()); EXPECT_FALSE(ve1.fill()); tawara::VoidElement ve2(se, true); EXPECT_EQ(se_size, ve2.size()); EXPECT_TRUE(ve2.fill()); // Test elements with a size right on the border of two encoded sizes for // the body size for (int ii(0); ii < 10; ++ii) { tawara::BinaryElement be(0x81, std::vector<char>(0x3FFB + ii, 0xC0)); tawara::VoidElement ve3(be); EXPECT_EQ(be.size(), ve3.size()); } }
bool CRectangle::getCharge() { if (cancharge) { ptbegin.clear(); ptend.clear(); CVector v1=ptevir.back(); CVector vrx;vrx.getcoorx(); CVector vry;vry.getcoory(); CVector vrz;vrz.getcoorz(); CVector vro;vro.getcooro(); CVector v2=ptbvir.back(); CVector v3=v1-v2; vrx=vrx*(v3.dot(vrx)); vry=vry*(v3.dot(vry)); CVector v3x=v2+vrx; CVector v3y=v2+vry;//(v3.dot(vry)); CVector e=v3x+vry;//(v3.dot(vry)); CVector ve1(v1.x,v2.y); CVector vb1(v2.x,v1.y); CPoint p11(ptevir.back()); CPoint p22(ptbvir.back()); CVector vp11(p11.x,p11.y); ptbegin.push_back(v2); ptbegin.push_back(v3x);//p1); ptbegin.push_back(e);//ptevir.back()); ptbegin.push_back(v3y);//p3); ptend.push_back(v3x);//p1); ptend.push_back(e);//ptevir.back()); ptend.push_back(v3y);//p3); ptend.push_back(v2); // updatecore(); box.empty(); box.add(v2); box.add(v3x); box.add(e); box.add(v3y); mesh.empty(); CVector uv=box.getParam(ptbegin[0]); mesh.addVertex(new CVertex(ptbegin[0],uv.x,uv.y)); uv=box.getParam(ptbegin[1]); mesh.addVertex(new CVertex(ptbegin[1],uv.x,uv.y)); new CEdge(mesh.Vertex(mesh.Vcount()-2),mesh.Vertex(mesh.Vcount()-1),mesh.Ecount()); uv=box.getParam(ptbegin[2]); mesh.addVertex(new CVertex(ptbegin[2],uv.x,uv.y)); new CEdge(mesh.Vertex(mesh.Vcount()-2),mesh.Vertex(mesh.Vcount()-1),mesh.Ecount()); uv=box.getParam(ptbegin[3]); mesh.addVertex(new CVertex(ptbegin[3],uv.x,uv.y)); new CEdge(mesh.Vertex(mesh.Vcount()-2),mesh.Vertex(mesh.Vcount()-1),mesh.Ecount()); new CEdge(mesh.Vertex(mesh.Vcount()-1),mesh.Vertex(mesh.Vcount()-4),mesh.Ecount()); // bez=new CBezier(this); return cancharge; } else { return false; } }