public void MergeIntoTest() { StyleCollection target = new StyleCollection(); StyleDefn defn = new StyleDefn(); defn.Match = "doc:Label.sea"; defn.Border.Color = PDFColors.Red; defn.Border.Width = 10; defn.Font.FontFamily = (PDFFontSelector)"Helvetica"; target.Add(defn); StyleDefn defn2 = new StyleDefn(); defn2.Match = ".sea"; // lower priority defn2.Border.Color = PDFColors.Gray; defn2.Columns.ColumnCount = 3; target.Add(defn2); StyleDefn defn3 = new StyleDefn(); defn3.AppliedClass = "other"; defn3.Border.Width = 20; defn3.Stroke.Color = PDFColors.Aqua; target.Add(defn3); Label lbl = new Label(); lbl.ElementName = "doc:Label"; ComponentState state = ComponentState.Normal; Style style = new Style(); target.MergeInto(style, lbl, state); style.Flatten(); Assert.IsFalse(style.HasValues);//no style class on the label lbl.StyleClass = "sea"; style = new Style(); target.MergeInto(style, lbl, state); style.Flatten(); Assert.AreEqual(PDFColors.Red, style.Border.Color); //from defn as higher priority Assert.AreEqual((PDFUnit)10, style.Border.Width); // from defn (defn2 has no width) Assert.AreEqual((PDFFontSelector)"Helvetica", style.Font.FontFamily); //from defn Assert.AreEqual(3, style.Columns.ColumnCount); //from defn2 (lower priority but not set on defn) Assert.IsFalse(style.IsValueDefined(StyleKeys.StrokeColorKey)); //defn3 does have a stroke, but shoulld not be included }