Example #1
0
TEST_F(MatchResultTest, AuthorRulesMultipleScopes)
{
    const StylePropertySet* authorSets[] = { propertySet(0), propertySet(1), propertySet(2), propertySet(3) };

    MatchResult result;

    result.finishAddingUARules();

    result.addMatchedProperties(authorSets[0]);
    result.addMatchedProperties(authorSets[1]);
    result.finishAddingAuthorRulesForTreeScope();

    result.addMatchedProperties(authorSets[2]);
    result.addMatchedProperties(authorSets[3]);
    result.finishAddingAuthorRulesForTreeScope();

    testMatchedPropertiesRange(result.allRules(), 4, authorSets);
    testMatchedPropertiesRange(result.uaRules(), 0, nullptr);
    testMatchedPropertiesRange(result.authorRules(), 4, authorSets);

    ImportantAuthorRanges important(result);

    auto iter = important.begin();
    EXPECT_NE(important.end(), iter);
    testMatchedPropertiesRange(*iter, 2, &authorSets[2]);

    ++iter;
    EXPECT_NE(important.end(), iter);
    testMatchedPropertiesRange(*iter, 2, authorSets);

    ++iter;
    EXPECT_EQ(important.end(), iter);
}
Example #2
0
TEST_F(MatchResultTest, AuthorRules) {
  const StylePropertySet* authorSets[] = {propertySet(0), propertySet(1)};

  MatchResult result;

  result.finishAddingUARules();
  result.addMatchedProperties(authorSets[0]);
  result.addMatchedProperties(authorSets[1]);
  result.finishAddingAuthorRulesForTreeScope();

  testMatchedPropertiesRange(result.allRules(), 2, authorSets);
  testMatchedPropertiesRange(result.uaRules(), 0, nullptr);
  testMatchedPropertiesRange(result.authorRules(), 2, authorSets);

  ImportantAuthorRanges important(result);
  EXPECT_EQ(important.end(), ++important.begin());
}
Example #3
0
TEST_F(MatchResultTest, UARulesAndAuthorRulesMultipleScopes) {
  const StylePropertySet* allSets[] = {propertySet(0), propertySet(1),
                                       propertySet(2), propertySet(3),
                                       propertySet(4), propertySet(5)};
  const StylePropertySet** uaSets = &allSets[0];
  const StylePropertySet** authorSets = &allSets[2];

  MatchResult result;

  result.addMatchedProperties(uaSets[0]);
  result.addMatchedProperties(uaSets[1]);
  result.finishAddingUARules();

  result.addMatchedProperties(authorSets[0]);
  result.addMatchedProperties(authorSets[1]);
  result.finishAddingAuthorRulesForTreeScope();

  result.addMatchedProperties(authorSets[2]);
  result.addMatchedProperties(authorSets[3]);
  result.finishAddingAuthorRulesForTreeScope();

  testMatchedPropertiesRange(result.allRules(), 6, allSets);
  testMatchedPropertiesRange(result.uaRules(), 2, uaSets);
  testMatchedPropertiesRange(result.authorRules(), 4, authorSets);

  ImportantAuthorRanges important(result);

  ImportantAuthorRangeIterator iter = important.begin();
  EXPECT_NE(important.end(), iter);
  testMatchedPropertiesRange(*iter, 2, &authorSets[2]);

  ++iter;
  EXPECT_NE(important.end(), iter);
  testMatchedPropertiesRange(*iter, 2, authorSets);

  ++iter;
  EXPECT_EQ(important.end(), iter);
}
Example #4
0
TEST_F(MatchResultTest, UAAndAuthorRules)
{
    const StylePropertySet* allSets[] = { propertySet(0), propertySet(1), propertySet(2), propertySet(3) };
    const StylePropertySet** uaSets = &allSets[0];
    const StylePropertySet** authorSets = &allSets[2];

    MatchResult result;

    result.addMatchedProperties(uaSets[0]);
    result.addMatchedProperties(uaSets[1]);
    result.finishAddingUARules();

    result.addMatchedProperties(authorSets[0]);
    result.addMatchedProperties(authorSets[1]);
    result.finishAddingAuthorRulesForTreeScope();

    testMatchedPropertiesRange(result.allRules(), 4, allSets);
    testMatchedPropertiesRange(result.uaRules(), 2, uaSets);
    testMatchedPropertiesRange(result.authorRules(), 2, authorSets);

    ImportantAuthorRanges important(result);
    EXPECT_EQ(important.end(), ++important.begin());
}