TEST_F(DisplayItemPropertyTreeBuilderTest, SkipUnnecessaryRangeRecords)
{
    TransformationMatrix rotation;
    rotation.rotate(1 /* degrees */);

    // The only drawing is in the second transform.
    auto transform1 = processBeginTransform3D(rotation);
    auto transform2 = processBeginTransform3D(rotation);
    processDummyDisplayItem();
    auto transform3 = processBeginTransform3D(rotation);
    processEndTransform3D(transform3);
    processDummyDisplayItem();
    processEndTransform3D(transform2);
    processEndTransform3D(transform1);
    finishPropertyTrees();

    // There should be only two ranges.
    // They must both belong to the same grandchild of the root node.
    ASSERT_EQ(2u, rangeRecords().size());
    size_t transformNodeIndex = rangeRecords()[0].transformNodeIndex;
    EXPECT_EQ(2u, nodeDepth(transformTree(), transformTree().nodeAt(transformNodeIndex)));
    EXPECT_THAT(rangeRecordsAsStdVector(), ElementsAre(
        AllOf(hasRange(2, 3), hasTransformNode(transformNodeIndex)),
        AllOf(hasRange(5, 6), hasTransformNode(transformNodeIndex))));
}
Exemplo n.º 2
0
void
Reader::dumpNode(bsl::ostream & os) const
{
    const char *name  = nodeName();
    const char *value = nodeValue();
    const char *nsUri = nodeNamespaceUri();

    int      line   = getLineNumber();
    int      column = getColumnNumber();
    int      depth  = nodeDepth();
    NodeType type   = nodeType();

    bsl::string strPad((bsl::string::size_type)depth*2, ' ');

    os << strPad
       << "Node pos="  << line  << ":" << column
       << " type=" << type
       << "(" << nodeTypeAsString(type)
       << ") empty=" << isEmptyElement()
       << " hasValue=" << nodeHasValue()
       << " name=" << CHK(name)
       << " value=" <<  CHK(value)
       << " uri=" << CHK(nsUri)
       << bsl::endl;

    int numAttr  = numAttributes();

    for (int i = 0; i < numAttr; ++i)
    {
        ElementAttribute attr;
        lookupAttribute(&attr, i);

        os << strPad
           << "  ATTRIBUTE  "
           << CHK(attr.qualifiedName())
           << "="
           << CHK(attr.value())
           << " uri="
           << CHK(attr.namespaceUri())
           << bsl::endl;
    }
}