1#![allow(dead_code)] use crate::properties::{PropertyId, PropertyValue};
14use fop_types::{Color, Length};
15use std::borrow::Cow;
16
17const EN_AUTO: u16 = 9;
22const EN_NONE: u16 = 86;
23const EN_NORMAL: u16 = 87;
24const EN_VISIBLE: u16 = 136;
25const EN_HIDDEN: u16 = 57;
26const EN_COLLAPSE: u16 = 26;
27const EN_SEPARATE: u16 = 120;
28
29const EN_START: u16 = 126;
31const EN_CENTER: u16 = 23;
32const EN_END: u16 = 39;
33const EN_JUSTIFY: u16 = 70;
34const EN_LEFT: u16 = 72;
35const EN_RIGHT: u16 = 113;
36
37const EN_SOLID: u16 = 123;
39const EN_DASHED: u16 = 31;
40const EN_DOTTED: u16 = 36;
41const EN_DOUBLE: u16 = 37;
42const EN_GROOVE: u16 = 55;
43const EN_RIDGE: u16 = 114;
44const EN_INSET: u16 = 67;
45const EN_OUTSET: u16 = 93;
46
47const EN_BLOCK: u16 = 18;
49const EN_INLINE: u16 = 65;
50const EN_STATIC: u16 = 127;
51const EN_RELATIVE: u16 = 109;
52const EN_ABSOLUTE: u16 = 1;
53const EN_FIXED: u16 = 51;
54
55const EN_ALWAYS: u16 = 7;
57const EN_AVOID: u16 = 11;
58
59const EN_LTR: u16 = 75;
61const EN_RTL: u16 = 116;
62
63const EN_LR_TB: u16 = 74;
65const EN_RL_TB: u16 = 115;
66const EN_TB_RL: u16 = 131;
67
68const EN_ITALIC: u16 = 68;
70const EN_OBLIQUE: u16 = 90;
71
72const EN_BOLD: u16 = 19;
74const EN_BOLDER: u16 = 20;
75const EN_LIGHTER: u16 = 73;
76const EN_100: u16 = 141;
77const EN_200: u16 = 142;
78const EN_300: u16 = 143;
79const EN_400: u16 = 144;
80const EN_500: u16 = 145;
81const EN_600: u16 = 146;
82const EN_700: u16 = 147;
83const EN_800: u16 = 148;
84const EN_900: u16 = 149;
85
86const EN_SMALL_CAPS: u16 = 122;
88
89const EN_UNDERLINE: u16 = 134;
91const EN_OVERLINE: u16 = 94;
92const EN_LINE_THROUGH: u16 = 76;
93const EN_BLINK: u16 = 17;
94
95const EN_CAPITALIZE: u16 = 22;
97const EN_UPPERCASE: u16 = 135;
98const EN_LOWERCASE: u16 = 77;
99
100const EN_SCROLL: u16 = 119;
102const EN_ERROR_IF_OVERFLOW: u16 = 42;
103
104const EN_SHOW: u16 = 121;
106const EN_HIDE: u16 = 58;
107
108const EN_BEFORE: u16 = 13;
110const EN_AFTER: u16 = 3;
111const EN_TOP: u16 = 133;
112const EN_BOTTOM: u16 = 20;
113
114const EN_AUTO_LAYOUT: u16 = 9; const EN_BASELINE: u16 = 12;
119const EN_MIDDLE: u16 = 81;
120const EN_SUB: u16 = 128;
121const EN_SUPER: u16 = 129;
122const EN_TEXT_TOP: u16 = 132;
123const EN_TEXT_BOTTOM: u16 = 130;
124
125const EN_DISTRIBUTE: u16 = 34;
127
128const EN_ALPHABETIC: u16 = 6;
130const EN_IDEOGRAPHIC: u16 = 59;
131const EN_HANGING: u16 = 56;
132const EN_MATHEMATICAL: u16 = 79;
133
134const EN_PRE: u16 = 100;
136const EN_NOWRAP: u16 = 88;
137const EN_PRE_WRAP: u16 = 101;
138const EN_PRE_LINE: u16 = 99;
139
140const EN_WRAP: u16 = 139;
142const EN_NO_WRAP: u16 = 88;
143
144const EN_TRUE: u16 = 134;
146const EN_FALSE: u16 = 48;
147
148const EN_ALL: u16 = 5;
150
151const EN_BOTH: u16 = 19;
153
154const EN_INSIDE: u16 = 68;
156const EN_OUTSIDE: u16 = 95;
157
158const EN_SPACE: u16 = 124;
160const EN_RULE: u16 = 117;
161const EN_DOTS: u16 = 35;
162const EN_USE_CONTENT: u16 = 137;
163
164const EN_ODD: u16 = 89;
166const EN_EVEN: u16 = 43;
167const EN_ANY: u16 = 8;
168
169const EN_FIRST: u16 = 50;
171const EN_LAST: u16 = 71;
172const EN_REST: u16 = 112;
173
174const EN_BLANK: u16 = 16;
176const EN_NOT_BLANK: u16 = 85;
177
178const EN_COLUMN: u16 = 28;
180
181const EN_PAGE: u16 = 96;
183
184const EN_NO_FORCE: u16 = 84;
186const EN_EVEN_PAGE: u16 = 44;
187const EN_ODD_PAGE: u16 = 91;
188
189const EN_FORCE: u16 = 53;
191
192const EN_EMBED: u16 = 38;
194const EN_BIDI_OVERRIDE: u16 = 15;
195
196const EN_IGNORE_IF_BEFORE_LINEFEED: u16 = 62;
198const EN_IGNORE_IF_AFTER_LINEFEED: u16 = 61;
199const EN_IGNORE_IF_SURROUNDING_LINEFEED: u16 = 63;
200const EN_PRESERVE: u16 = 102;
201const EN_IGNORE: u16 = 60;
202
203const EN_LINE_HEIGHT: u16 = 75;
205const EN_FONT_HEIGHT: u16 = 52;
206const EN_MAX_HEIGHT: u16 = 80;
207
208const EN_CONSIDER_SHIFTS: u16 = 30;
210const EN_DISREGARD_SHIFTS: u16 = 33;
211
212const EN_CENTRAL: u16 = 24;
214
215const EN_BEFORE_EDGE: u16 = 14;
217const EN_TEXT_BEFORE_EDGE: u16 = 130;
218const EN_AFTER_EDGE: u16 = 4;
219const EN_TEXT_AFTER_EDGE: u16 = 132;
220
221const EN_REFERENCE_AREA: u16 = 108;
223
224const EN_UNIFORM: u16 = 134;
226const EN_NON_UNIFORM: u16 = 86;
227
228const EN_PERCEPTUAL: u16 = 98;
230const EN_RELATIVE_COLORIMETRIC: u16 = 110;
231const EN_SATURATION: u16 = 118;
232const EN_ABSOLUTE_COLORIMETRIC: u16 = 2;
233
234const EN_PAGE_SEQUENCE: u16 = 97;
236const EN_DOCUMENT: u16 = 34;
237
238const EN_FIRST_STARTING_WITHIN_PAGE: u16 = 54;
240const EN_FIRST_INCLUDING_CARRYOVER: u16 = 49;
241const EN_LAST_STARTING_WITHIN_PAGE: u16 = 71;
242const EN_LAST_ENDING_WITHIN_PAGE: u16 = 70;
243
244const EN_AUTO_SELECT: u16 = 10;
246const EN_CHARACTER_BY_CHARACTER: u16 = 25;
247
248const EN_AUTO_MEDIA_USAGE: u16 = 9;
250const EN_PAGINATE: u16 = 97;
251const EN_BOUNDED_IN_ONE_DIMENSION: u16 = 21;
252const EN_UNBOUNDED: u16 = 134;
253
254const EN_NONE_DISPLACE: u16 = 86;
256
257const EN_LINK: u16 = 75;
259const EN_VISITED: u16 = 138;
260const EN_ACTIVE: u16 = 0;
261const EN_HOVER: u16 = 58;
262const EN_FOCUS: u16 = 53;
263
264const EN_NO_AUTO_RESTORE: u16 = 83;
266
267const EN_INDICATE_DESTINATION_TRUE: u16 = 134;
269
270const EN_REPLACE: u16 = 111;
272const EN_NEW: u16 = 82;
273
274const EN_USE_TARGET_PROCESSING_CONTEXT: u16 = 137;
279
280const EN_DOCUMENT_ROOT: u16 = 35;
282
283const EN_ALTERNATE: u16 = 7;
285
286const EN_NORMAL_CITATION: u16 = 87;
291const EN_ALL_CITATION: u16 = 5;
292
293const EN_LINK_COMBINE: u16 = 75;
295const EN_NO_LINK: u16 = 83;
296
297const EN_MERGE: u16 = 80;
299const EN_LEAVE_SEPARATE: u16 = 72;
300
301pub fn get_initial_value(property_id: PropertyId) -> PropertyValue {
306 match property_id {
307 PropertyId::Color => PropertyValue::Color(Color::BLACK),
311
312 PropertyId::FontFamily => PropertyValue::String(Cow::Borrowed("serif")),
314
315 PropertyId::FontSize => PropertyValue::Length(Length::from_pt(12.0)),
317
318 PropertyId::FontStyle => PropertyValue::Enum(EN_NORMAL),
320
321 PropertyId::FontWeight => PropertyValue::Enum(EN_NORMAL),
323
324 PropertyId::FontVariant => PropertyValue::Enum(EN_NORMAL),
326
327 PropertyId::FontStretch => PropertyValue::Enum(EN_NORMAL),
329
330 PropertyId::FontSizeAdjust => PropertyValue::None,
332
333 PropertyId::FontSelectionStrategy => PropertyValue::Enum(EN_AUTO),
335
336 PropertyId::Font => PropertyValue::Auto,
338
339 PropertyId::TextAlign => PropertyValue::Enum(EN_START),
343
344 PropertyId::TextAlignLast => PropertyValue::Enum(EN_START),
346
347 PropertyId::TextIndent => PropertyValue::Length(Length::ZERO),
349
350 PropertyId::TextDecoration => PropertyValue::None,
352
353 PropertyId::TextTransform => PropertyValue::Enum(EN_NONE),
355
356 PropertyId::TextShadow => PropertyValue::None,
358
359 PropertyId::LineHeight => PropertyValue::Enum(EN_NORMAL),
361
362 PropertyId::LetterSpacing => PropertyValue::Enum(EN_NORMAL),
364
365 PropertyId::WordSpacing => PropertyValue::Enum(EN_NORMAL),
367
368 PropertyId::WhiteSpace => PropertyValue::Enum(EN_NORMAL),
370
371 PropertyId::WhiteSpaceCollapse => PropertyValue::Enum(EN_TRUE),
373
374 PropertyId::WhiteSpaceTreatment => PropertyValue::Enum(EN_IGNORE_IF_SURROUNDING_LINEFEED),
376
377 PropertyId::LinefeedTreatment => PropertyValue::Enum(EN_IGNORE),
379
380 PropertyId::WrapOption => PropertyValue::Enum(EN_WRAP),
382
383 PropertyId::MarginTop
385 | PropertyId::MarginRight
386 | PropertyId::MarginBottom
387 | PropertyId::MarginLeft => PropertyValue::Length(Length::ZERO),
388
389 PropertyId::Margin => PropertyValue::Auto,
391
392 PropertyId::PaddingTop
394 | PropertyId::PaddingRight
395 | PropertyId::PaddingBottom
396 | PropertyId::PaddingLeft
397 | PropertyId::PaddingBefore
398 | PropertyId::PaddingAfter
399 | PropertyId::PaddingStart
400 | PropertyId::PaddingEnd => PropertyValue::Length(Length::ZERO),
401
402 PropertyId::Padding => PropertyValue::Auto,
404
405 PropertyId::BorderTopWidth
407 | PropertyId::BorderRightWidth
408 | PropertyId::BorderBottomWidth
409 | PropertyId::BorderLeftWidth
410 | PropertyId::BorderBeforeWidth
411 | PropertyId::BorderAfterWidth
412 | PropertyId::BorderStartWidth
413 | PropertyId::BorderEndWidth => {
414 PropertyValue::Length(Length::from_pt(1.0))
416 }
417
418 PropertyId::BorderWidth => PropertyValue::Auto,
420
421 PropertyId::BorderTopStyle
423 | PropertyId::BorderRightStyle
424 | PropertyId::BorderBottomStyle
425 | PropertyId::BorderLeftStyle
426 | PropertyId::BorderBeforeStyle
427 | PropertyId::BorderAfterStyle
428 | PropertyId::BorderStartStyle
429 | PropertyId::BorderEndStyle => PropertyValue::Enum(EN_NONE),
430
431 PropertyId::BorderStyle => PropertyValue::Auto,
433
434 PropertyId::BorderTopColor
436 | PropertyId::BorderRightColor
437 | PropertyId::BorderBottomColor
438 | PropertyId::BorderLeftColor
439 | PropertyId::BorderBeforeColor
440 | PropertyId::BorderAfterColor
441 | PropertyId::BorderStartColor
442 | PropertyId::BorderEndColor => {
443 PropertyValue::Color(Color::BLACK)
445 }
446
447 PropertyId::BorderColor => PropertyValue::Auto,
449
450 PropertyId::Border
452 | PropertyId::BorderTop
453 | PropertyId::BorderRight
454 | PropertyId::BorderBottom
455 | PropertyId::BorderLeft => PropertyValue::Auto,
456
457 PropertyId::BorderBeforePrecedence
459 | PropertyId::BorderAfterPrecedence
460 | PropertyId::BorderStartPrecedence
461 | PropertyId::BorderEndPrecedence => PropertyValue::Enum(EN_NONE),
462
463 PropertyId::XBorderBeforeRadiusStart
465 | PropertyId::XBorderBeforeRadiusEnd
466 | PropertyId::XBorderAfterRadiusStart
467 | PropertyId::XBorderAfterRadiusEnd
468 | PropertyId::XBorderStartRadiusBefore
469 | PropertyId::XBorderStartRadiusAfter
470 | PropertyId::XBorderEndRadiusBefore
471 | PropertyId::XBorderEndRadiusAfter
472 | PropertyId::XBorderBeforeStartRadius
473 | PropertyId::XBorderBeforeEndRadius
474 | PropertyId::XBorderAfterStartRadius
475 | PropertyId::XBorderAfterEndRadius => PropertyValue::Length(Length::ZERO),
476
477 PropertyId::XBorderRadius => PropertyValue::Auto,
478
479 PropertyId::SpaceBefore
481 | PropertyId::SpaceAfter
482 | PropertyId::SpaceStart
483 | PropertyId::SpaceEnd => {
484 PropertyValue::Length(Length::ZERO)
486 }
487
488 PropertyId::StartIndent => PropertyValue::Length(Length::ZERO),
492
493 PropertyId::EndIndent => PropertyValue::Length(Length::ZERO),
495
496 PropertyId::LastLineEndIndent => PropertyValue::Length(Length::ZERO),
498
499 PropertyId::Position => PropertyValue::Enum(EN_STATIC),
503
504 PropertyId::AbsolutePosition => PropertyValue::Enum(EN_AUTO),
506
507 PropertyId::RelativePosition => PropertyValue::Enum(EN_STATIC),
509
510 PropertyId::Top | PropertyId::Right | PropertyId::Bottom | PropertyId::Left => {
512 PropertyValue::Auto
513 }
514
515 PropertyId::Width => PropertyValue::Auto,
519
520 PropertyId::Height => PropertyValue::Auto,
522
523 PropertyId::MinWidth => PropertyValue::Length(Length::ZERO),
525
526 PropertyId::MinHeight => PropertyValue::Length(Length::ZERO),
528
529 PropertyId::MaxWidth => PropertyValue::None,
531
532 PropertyId::MaxHeight => PropertyValue::None,
534
535 PropertyId::InlineProgressionDimension => PropertyValue::Auto,
537
538 PropertyId::BlockProgressionDimension => PropertyValue::Auto,
540
541 PropertyId::ContentWidth => PropertyValue::Auto,
543
544 PropertyId::ContentHeight => PropertyValue::Auto,
546
547 PropertyId::TableLayout => PropertyValue::Enum(EN_AUTO),
551
552 PropertyId::BorderCollapse => PropertyValue::Enum(EN_SEPARATE),
554
555 PropertyId::BorderSpacing => PropertyValue::Length(Length::ZERO),
557
558 PropertyId::BorderSeparation => PropertyValue::Length(Length::ZERO),
560
561 PropertyId::CaptionSide => PropertyValue::Enum(EN_BEFORE),
563
564 PropertyId::EmptyCells => PropertyValue::Enum(EN_SHOW),
566
567 PropertyId::TableOmitFooterAtBreak => PropertyValue::Enum(EN_FALSE),
569
570 PropertyId::TableOmitHeaderAtBreak => PropertyValue::Enum(EN_FALSE),
572
573 PropertyId::ColumnWidth => PropertyValue::Auto,
575
576 PropertyId::ColumnNumber => PropertyValue::Auto,
578
579 PropertyId::ColumnCount => PropertyValue::Integer(1),
581
582 PropertyId::ColumnGap => PropertyValue::Length(Length::from_pt(12.0)),
584
585 PropertyId::NumberColumnsRepeated => PropertyValue::Integer(1),
587
588 PropertyId::NumberColumnsSpanned => PropertyValue::Integer(1),
590
591 PropertyId::NumberRowsSpanned => PropertyValue::Integer(1),
593
594 PropertyId::StartsRow => PropertyValue::Enum(EN_FALSE),
596
597 PropertyId::EndsRow => PropertyValue::Enum(EN_FALSE),
599
600 PropertyId::PageWidth => PropertyValue::Auto,
604
605 PropertyId::PageHeight => PropertyValue::Auto,
607
608 PropertyId::Extent => PropertyValue::Length(Length::ZERO),
610
611 PropertyId::Precedence => PropertyValue::Enum(EN_FALSE),
613
614 PropertyId::RegionName => PropertyValue::String(Cow::Borrowed("")),
616
617 PropertyId::RegionNameReference => PropertyValue::String(Cow::Borrowed("")),
619
620 PropertyId::FlowName => PropertyValue::String(Cow::Borrowed("")),
622
623 PropertyId::FlowNameReference => PropertyValue::String(Cow::Borrowed("")),
625
626 PropertyId::FlowMapName => PropertyValue::String(Cow::Borrowed("")),
628
629 PropertyId::FlowMapReference => PropertyValue::String(Cow::Borrowed("")),
631
632 PropertyId::MasterName => PropertyValue::String(Cow::Borrowed("")),
634
635 PropertyId::MasterReference => PropertyValue::String(Cow::Borrowed("")),
637
638 PropertyId::ReferenceOrientation => PropertyValue::Integer(0),
640
641 PropertyId::WritingMode => PropertyValue::Enum(EN_LR_TB),
643
644 PropertyId::KeepTogether => PropertyValue::Enum(EN_AUTO),
648
649 PropertyId::KeepWithNext => PropertyValue::Enum(EN_AUTO),
651
652 PropertyId::KeepWithPrevious => PropertyValue::Enum(EN_AUTO),
654
655 PropertyId::BreakBefore => PropertyValue::Enum(EN_AUTO),
657
658 PropertyId::BreakAfter => PropertyValue::Enum(EN_AUTO),
660
661 PropertyId::PageBreakBefore => PropertyValue::Enum(EN_AUTO),
663
664 PropertyId::PageBreakAfter => PropertyValue::Enum(EN_AUTO),
666
667 PropertyId::PageBreakInside => PropertyValue::Enum(EN_AUTO),
669
670 PropertyId::Orphans => PropertyValue::Integer(2),
672
673 PropertyId::Widows => PropertyValue::Integer(2),
675
676 PropertyId::BackgroundColor => PropertyValue::Color(Color::TRANSPARENT),
680
681 PropertyId::BackgroundImage => PropertyValue::None,
683
684 PropertyId::BackgroundRepeat => PropertyValue::Enum(EN_NORMAL),
686
687 PropertyId::BackgroundAttachment => PropertyValue::Enum(EN_SCROLL),
689
690 PropertyId::BackgroundPosition => PropertyValue::Auto,
692
693 PropertyId::BackgroundPositionHorizontal => PropertyValue::Length(Length::ZERO),
695
696 PropertyId::BackgroundPositionVertical => PropertyValue::Length(Length::ZERO),
698
699 PropertyId::Background => PropertyValue::Auto,
701
702 PropertyId::Visibility => PropertyValue::Enum(EN_VISIBLE),
706
707 PropertyId::Overflow => PropertyValue::Enum(EN_VISIBLE),
709
710 PropertyId::Clip => PropertyValue::Auto,
712
713 PropertyId::DisplayAlign => PropertyValue::Enum(EN_AUTO),
715
716 PropertyId::BaselineShift => PropertyValue::Enum(EN_BASELINE),
720
721 PropertyId::DominantBaseline => PropertyValue::Enum(EN_AUTO),
723
724 PropertyId::AlignmentBaseline => PropertyValue::Enum(EN_BASELINE),
726
727 PropertyId::AlignmentAdjust => PropertyValue::Enum(EN_AUTO),
729
730 PropertyId::VerticalAlign => PropertyValue::Enum(EN_BASELINE),
732
733 PropertyId::LineHeightShiftAdjustment => PropertyValue::Enum(EN_CONSIDER_SHIFTS),
737
738 PropertyId::LineStackingStrategy => PropertyValue::Enum(EN_LINE_HEIGHT),
740
741 PropertyId::TextAltitude => PropertyValue::Enum(EN_AUTO),
743
744 PropertyId::TextDepth => PropertyValue::Enum(EN_AUTO),
746
747 PropertyId::Direction => PropertyValue::Enum(EN_LTR),
751
752 PropertyId::UnicodeBidi => PropertyValue::Enum(EN_NORMAL),
754
755 PropertyId::Hyphenate => PropertyValue::Enum(EN_FALSE),
759
760 PropertyId::HyphenationCharacter => PropertyValue::String(Cow::Borrowed("-")),
762
763 PropertyId::HyphenationPushCharacterCount => PropertyValue::Integer(2),
765
766 PropertyId::HyphenationRemainCharacterCount => PropertyValue::Integer(2),
768
769 PropertyId::HyphenationLadderCount => PropertyValue::Enum(EN_AUTO),
771
772 PropertyId::HyphenationKeep => PropertyValue::Enum(EN_AUTO),
774
775 PropertyId::LeaderPattern => PropertyValue::Enum(EN_SPACE),
779
780 PropertyId::LeaderPatternWidth => PropertyValue::Enum(EN_AUTO),
782
783 PropertyId::LeaderLength => PropertyValue::Length(Length::ZERO),
785
786 PropertyId::LeaderAlignment => PropertyValue::Enum(EN_NONE),
788
789 PropertyId::RuleStyle => PropertyValue::Enum(EN_SOLID),
791
792 PropertyId::RuleThickness => PropertyValue::Length(Length::from_pt(1.0)),
794
795 PropertyId::Float => PropertyValue::Enum(EN_NONE),
799
800 PropertyId::Clear => PropertyValue::Enum(EN_NONE),
802
803 PropertyId::IntrusionDisplace => PropertyValue::Enum(EN_NONE),
805
806 PropertyId::ProvisionalDistanceBetweenStarts => {
810 PropertyValue::Length(Length::from_pt(24.0))
811 }
812
813 PropertyId::ProvisionalLabelSeparation => PropertyValue::Length(Length::from_pt(6.0)),
815
816 PropertyId::MarkerClassName => PropertyValue::String(Cow::Borrowed("")),
820
821 PropertyId::RetrieveClassName => PropertyValue::String(Cow::Borrowed("")),
823
824 PropertyId::RetrievePosition => PropertyValue::Enum(EN_FIRST_STARTING_WITHIN_PAGE),
826
827 PropertyId::RetrieveBoundary => PropertyValue::Enum(EN_PAGE_SEQUENCE),
829
830 PropertyId::RetrievePositionWithinTable => PropertyValue::Enum(EN_FIRST),
832
833 PropertyId::RetrieveBoundaryWithinTable => PropertyValue::Enum(EN_AUTO),
835
836 PropertyId::InitialPageNumber => PropertyValue::Enum(EN_AUTO),
840
841 PropertyId::ForcePageCount => PropertyValue::Enum(EN_AUTO),
843
844 PropertyId::Format => PropertyValue::String(Cow::Borrowed("1")),
846
847 PropertyId::LetterValue => PropertyValue::Enum(EN_AUTO),
849
850 PropertyId::GroupingSeparator => PropertyValue::String(Cow::Borrowed("")),
852
853 PropertyId::GroupingSize => PropertyValue::Integer(0),
855
856 PropertyId::PagePosition => PropertyValue::Enum(EN_ANY),
858
859 PropertyId::OddOrEven => PropertyValue::Enum(EN_ANY),
861
862 PropertyId::BlankOrNotBlank => PropertyValue::Enum(EN_ANY),
864
865 PropertyId::ExternalDestination => PropertyValue::String(Cow::Borrowed("")),
869
870 PropertyId::InternalDestination => PropertyValue::String(Cow::Borrowed("")),
872
873 PropertyId::IndicateDestination => PropertyValue::Enum(EN_FALSE),
875
876 PropertyId::ShowDestination => PropertyValue::Enum(EN_REPLACE),
878
879 PropertyId::DestinationPlacementOffset => PropertyValue::Length(Length::ZERO),
881
882 PropertyId::TargetPresentationContext => {
884 PropertyValue::Enum(EN_USE_TARGET_PROCESSING_CONTEXT)
885 }
886
887 PropertyId::TargetProcessingContext => PropertyValue::Enum(EN_DOCUMENT_ROOT),
889
890 PropertyId::TargetStylesheet => PropertyValue::Enum(EN_AUTO),
892
893 PropertyId::Id => PropertyValue::String(Cow::Borrowed("")),
897
898 PropertyId::RefId => PropertyValue::String(Cow::Borrowed("")),
900
901 PropertyId::RefIndexKey => PropertyValue::String(Cow::Borrowed("")),
903
904 PropertyId::IndexClass => PropertyValue::String(Cow::Borrowed("")),
908
909 PropertyId::IndexKey => PropertyValue::String(Cow::Borrowed("")),
911
912 PropertyId::MergePagesAcrossIndexKeyReferences => PropertyValue::Enum(EN_MERGE),
914
915 PropertyId::MergeRangesAcrossIndexKeyReferences => PropertyValue::Enum(EN_MERGE),
917
918 PropertyId::MergeSequentialPageNumbers => PropertyValue::Enum(EN_MERGE),
920
921 PropertyId::PageNumberTreatment => PropertyValue::Enum(EN_LINK),
923
924 PropertyId::PageCitationStrategy => PropertyValue::Enum(EN_NORMAL),
926
927 PropertyId::ChangeBarClass => PropertyValue::String(Cow::Borrowed("")),
931
932 PropertyId::ChangeBarColor => PropertyValue::Color(Color::BLACK),
934
935 PropertyId::ChangeBarOffset => PropertyValue::Length(Length::from_pt(6.0)),
937
938 PropertyId::ChangeBarPlacement => PropertyValue::Enum(EN_START),
940
941 PropertyId::ChangeBarStyle => PropertyValue::Enum(EN_SOLID),
943
944 PropertyId::ChangeBarWidth => PropertyValue::Length(Length::from_pt(1.0)),
946
947 PropertyId::ActiveState => PropertyValue::Enum(EN_LINK),
951
952 PropertyId::AutoRestore => PropertyValue::Enum(EN_FALSE),
954
955 PropertyId::CaseName => PropertyValue::String(Cow::Borrowed("")),
957
958 PropertyId::CaseTitle => PropertyValue::String(Cow::Borrowed("")),
960
961 PropertyId::StartingState => PropertyValue::Enum(EN_SHOW),
963
964 PropertyId::SwitchTo => PropertyValue::String(Cow::Borrowed("")),
966
967 PropertyId::MediaUsage => PropertyValue::Enum(EN_AUTO),
971
972 PropertyId::RenderingIntent => PropertyValue::Enum(EN_AUTO),
974
975 PropertyId::ColorProfileName => PropertyValue::String(Cow::Borrowed("")),
977
978 PropertyId::Scaling => PropertyValue::Enum(EN_UNIFORM),
982
983 PropertyId::ScalingMethod => PropertyValue::Enum(EN_AUTO),
985
986 PropertyId::IntrinsicScaleValue => PropertyValue::Integer(100),
988
989 PropertyId::GlyphOrientationHorizontal => PropertyValue::Integer(0),
993
994 PropertyId::GlyphOrientationVertical => PropertyValue::Enum(EN_AUTO),
996
997 PropertyId::ScoreSpaces => PropertyValue::Enum(EN_TRUE),
1001
1002 PropertyId::SuppressAtLineBreak => PropertyValue::Enum(EN_AUTO),
1004
1005 PropertyId::TreatAsWordSpace => PropertyValue::Enum(EN_AUTO),
1007
1008 PropertyId::Span => PropertyValue::Enum(EN_NONE),
1012
1013 PropertyId::RelativeAlign => PropertyValue::Enum(EN_BEFORE),
1015
1016 PropertyId::Azimuth => PropertyValue::Enum(EN_CENTER),
1020
1021 PropertyId::CueAfter => PropertyValue::None,
1023
1024 PropertyId::CueBefore => PropertyValue::None,
1026
1027 PropertyId::Cue => PropertyValue::Auto,
1029
1030 PropertyId::Elevation => PropertyValue::Enum(EN_AUTO),
1032
1033 PropertyId::PauseAfter => PropertyValue::Length(Length::ZERO),
1035
1036 PropertyId::PauseBefore => PropertyValue::Length(Length::ZERO),
1038
1039 PropertyId::Pause => PropertyValue::Auto,
1041
1042 PropertyId::Pitch => PropertyValue::Enum(EN_AUTO),
1044
1045 PropertyId::PitchRange => PropertyValue::Integer(50),
1047
1048 PropertyId::PlayDuring => PropertyValue::Enum(EN_AUTO),
1050
1051 PropertyId::Richness => PropertyValue::Integer(50),
1053
1054 PropertyId::Speak => PropertyValue::Enum(EN_NORMAL),
1056
1057 PropertyId::SpeakHeader => PropertyValue::Enum(EN_AUTO),
1059
1060 PropertyId::SpeakNumeral => PropertyValue::Enum(EN_AUTO),
1062
1063 PropertyId::SpeakPunctuation => PropertyValue::Enum(EN_NONE),
1065
1066 PropertyId::SpeechRate => PropertyValue::Enum(EN_AUTO),
1068
1069 PropertyId::Stress => PropertyValue::Integer(50),
1071
1072 PropertyId::VoiceFamily => PropertyValue::String(Cow::Borrowed("")),
1074
1075 PropertyId::Volume => PropertyValue::Enum(EN_AUTO),
1077
1078 PropertyId::Character => PropertyValue::String(Cow::Borrowed("")),
1082
1083 PropertyId::ContentType => PropertyValue::Enum(EN_AUTO),
1085
1086 PropertyId::Country => PropertyValue::None,
1088
1089 PropertyId::Language => PropertyValue::None,
1091
1092 PropertyId::Script => PropertyValue::None,
1094
1095 PropertyId::Src => PropertyValue::String(Cow::Borrowed("")),
1097
1098 PropertyId::SourceDocument => PropertyValue::String(Cow::Borrowed("")),
1100
1101 PropertyId::Role => PropertyValue::String(Cow::Borrowed("")),
1103
1104 PropertyId::XmlLang => PropertyValue::String(Cow::Borrowed("")),
1106
1107 PropertyId::ZIndex => PropertyValue::Auto,
1111
1112 PropertyId::Opacity => PropertyValue::Number(1.0),
1114
1115 PropertyId::Size => PropertyValue::Enum(EN_AUTO),
1119
1120 PropertyId::MaximumRepeats => PropertyValue::Enum(EN_AUTO),
1124
1125 PropertyId::XWidowContentLimit => PropertyValue::Length(Length::ZERO),
1129
1130 PropertyId::XOrphanContentLimit => PropertyValue::Length(Length::ZERO),
1132
1133 PropertyId::XDisableColumnBalancing => PropertyValue::Enum(EN_FALSE),
1135
1136 PropertyId::XAltText => PropertyValue::String(Cow::Borrowed("")),
1138
1139 PropertyId::XXmlBase => PropertyValue::String(Cow::Borrowed("")),
1141
1142 PropertyId::XNumberConversionFeatures => PropertyValue::String(Cow::Borrowed("")),
1144
1145 PropertyId::XHeaderColumn => PropertyValue::Enum(EN_FALSE),
1147
1148 PropertyId::XLayer => PropertyValue::String(Cow::Borrowed("")),
1150
1151 PropertyId::XAutoToggle => PropertyValue::Enum(EN_AUTO),
1153
1154 PropertyId::XBackgroundImageWidth => PropertyValue::Auto,
1156
1157 PropertyId::XBackgroundImageHeight => PropertyValue::Auto,
1159
1160 PropertyId::XAbbreviation => PropertyValue::String(Cow::Borrowed("")),
1162 }
1163}
1164
1165#[cfg(test)]
1166mod tests {
1167 use super::*;
1168
1169 #[test]
1170 fn test_initial_color() {
1171 let value = get_initial_value(PropertyId::Color);
1172 assert_eq!(value.as_color(), Some(Color::BLACK));
1173 }
1174
1175 #[test]
1176 fn test_initial_font_family() {
1177 let value = get_initial_value(PropertyId::FontFamily);
1178 assert_eq!(value.as_string(), Some("serif"));
1179 }
1180
1181 #[test]
1182 fn test_initial_font_size() {
1183 let value = get_initial_value(PropertyId::FontSize);
1184 assert_eq!(value.as_length(), Some(Length::from_pt(12.0)));
1185 }
1186
1187 #[test]
1188 fn test_initial_margin_zero() {
1189 let value = get_initial_value(PropertyId::MarginTop);
1190 assert_eq!(value.as_length(), Some(Length::ZERO));
1191
1192 let value = get_initial_value(PropertyId::MarginLeft);
1193 assert_eq!(value.as_length(), Some(Length::ZERO));
1194 }
1195
1196 #[test]
1197 fn test_initial_padding_zero() {
1198 let value = get_initial_value(PropertyId::PaddingTop);
1199 assert_eq!(value.as_length(), Some(Length::ZERO));
1200
1201 let value = get_initial_value(PropertyId::PaddingLeft);
1202 assert_eq!(value.as_length(), Some(Length::ZERO));
1203 }
1204
1205 #[test]
1206 fn test_initial_border_style_none() {
1207 let value = get_initial_value(PropertyId::BorderTopStyle);
1208 assert_eq!(value.as_enum(), Some(EN_NONE));
1209 }
1210
1211 #[test]
1212 fn test_initial_border_width_medium() {
1213 let value = get_initial_value(PropertyId::BorderTopWidth);
1214 assert_eq!(value.as_length(), Some(Length::from_pt(1.0)));
1215 }
1216
1217 #[test]
1218 fn test_initial_border_color() {
1219 let value = get_initial_value(PropertyId::BorderTopColor);
1220 assert_eq!(value.as_color(), Some(Color::BLACK));
1221 }
1222
1223 #[test]
1224 fn test_initial_text_align() {
1225 let value = get_initial_value(PropertyId::TextAlign);
1226 assert_eq!(value.as_enum(), Some(EN_START));
1227 }
1228
1229 #[test]
1230 fn test_initial_text_indent() {
1231 let value = get_initial_value(PropertyId::TextIndent);
1232 assert_eq!(value.as_length(), Some(Length::ZERO));
1233 }
1234
1235 #[test]
1236 fn test_initial_line_height() {
1237 let value = get_initial_value(PropertyId::LineHeight);
1238 assert_eq!(value.as_enum(), Some(EN_NORMAL));
1239 }
1240
1241 #[test]
1242 fn test_initial_width_auto() {
1243 let value = get_initial_value(PropertyId::Width);
1244 assert!(value.is_auto());
1245 }
1246
1247 #[test]
1248 fn test_initial_height_auto() {
1249 let value = get_initial_value(PropertyId::Height);
1250 assert!(value.is_auto());
1251 }
1252
1253 #[test]
1254 fn test_initial_table_layout() {
1255 let value = get_initial_value(PropertyId::TableLayout);
1256 assert_eq!(value.as_enum(), Some(EN_AUTO));
1257 }
1258
1259 #[test]
1260 fn test_initial_border_collapse() {
1261 let value = get_initial_value(PropertyId::BorderCollapse);
1262 assert_eq!(value.as_enum(), Some(EN_SEPARATE));
1263 }
1264
1265 #[test]
1266 fn test_initial_empty_cells() {
1267 let value = get_initial_value(PropertyId::EmptyCells);
1268 assert_eq!(value.as_enum(), Some(EN_SHOW));
1269 }
1270
1271 #[test]
1272 fn test_initial_visibility() {
1273 let value = get_initial_value(PropertyId::Visibility);
1274 assert_eq!(value.as_enum(), Some(EN_VISIBLE));
1275 }
1276
1277 #[test]
1278 fn test_initial_overflow() {
1279 let value = get_initial_value(PropertyId::Overflow);
1280 assert_eq!(value.as_enum(), Some(EN_VISIBLE));
1281 }
1282
1283 #[test]
1284 fn test_initial_background_color() {
1285 let value = get_initial_value(PropertyId::BackgroundColor);
1286 assert_eq!(value.as_color(), Some(Color::TRANSPARENT));
1287 }
1288
1289 #[test]
1290 fn test_initial_orphans() {
1291 let value = get_initial_value(PropertyId::Orphans);
1292 assert_eq!(value.as_integer(), Some(2));
1293 }
1294
1295 #[test]
1296 fn test_initial_widows() {
1297 let value = get_initial_value(PropertyId::Widows);
1298 assert_eq!(value.as_integer(), Some(2));
1299 }
1300
1301 #[test]
1302 fn test_initial_direction() {
1303 let value = get_initial_value(PropertyId::Direction);
1304 assert_eq!(value.as_enum(), Some(EN_LTR));
1305 }
1306
1307 #[test]
1308 fn test_initial_writing_mode() {
1309 let value = get_initial_value(PropertyId::WritingMode);
1310 assert_eq!(value.as_enum(), Some(EN_LR_TB));
1311 }
1312
1313 #[test]
1314 fn test_initial_hyphenate() {
1315 let value = get_initial_value(PropertyId::Hyphenate);
1316 assert_eq!(value.as_enum(), Some(EN_FALSE));
1317 }
1318
1319 #[test]
1320 fn test_initial_hyphenation_character() {
1321 let value = get_initial_value(PropertyId::HyphenationCharacter);
1322 assert_eq!(value.as_string(), Some("-"));
1323 }
1324
1325 #[test]
1326 fn test_initial_opacity() {
1327 let value = get_initial_value(PropertyId::Opacity);
1328 assert_eq!(value.as_number(), Some(1.0));
1329 }
1330
1331 #[test]
1332 fn test_initial_column_count() {
1333 let value = get_initial_value(PropertyId::ColumnCount);
1334 assert_eq!(value.as_integer(), Some(1));
1335 }
1336
1337 #[test]
1338 fn test_initial_z_index() {
1339 let value = get_initial_value(PropertyId::ZIndex);
1340 assert!(value.is_auto());
1341 }
1342
1343 #[test]
1344 fn test_all_properties_have_initial_values() {
1345 let property_ids = [
1348 PropertyId::AbsolutePosition,
1349 PropertyId::ActiveState,
1350 PropertyId::AlignmentAdjust,
1351 PropertyId::AlignmentBaseline,
1352 PropertyId::AutoRestore,
1353 PropertyId::Azimuth,
1354 PropertyId::Background,
1355 PropertyId::BackgroundAttachment,
1356 PropertyId::BackgroundColor,
1357 PropertyId::BackgroundImage,
1358 PropertyId::Color,
1360 PropertyId::FontFamily,
1361 PropertyId::FontSize,
1362 PropertyId::MarginTop,
1363 PropertyId::PaddingLeft,
1364 PropertyId::BorderTopStyle,
1365 PropertyId::Width,
1366 PropertyId::Height,
1367 PropertyId::TextAlign,
1368 PropertyId::Visibility,
1369 PropertyId::Opacity,
1370 ];
1371
1372 for prop_id in &property_ids {
1373 let value = get_initial_value(*prop_id);
1374 assert!(
1376 !matches!(value, PropertyValue::Inherit),
1377 "Initial value should not be Inherit for {:?}",
1378 prop_id
1379 );
1380 }
1381 }
1382
1383 #[test]
1384 fn test_all_295_properties_have_initial_values() {
1385 for id_num in 1..=295 {
1388 let property_id: PropertyId = unsafe { std::mem::transmute(id_num as u16) };
1389 let initial_value = get_initial_value(property_id);
1390
1391 assert!(
1394 !matches!(initial_value, PropertyValue::Inherit),
1395 "Property {:?} (ID {}) has Inherit as initial value, which is invalid",
1396 property_id,
1397 id_num
1398 );
1399
1400 let _ = format!("{:?}", initial_value);
1402 }
1403 }
1404
1405 #[test]
1406 fn test_comprehensive_initial_values() {
1407 assert_eq!(
1411 get_initial_value(PropertyId::MarginRight).as_length(),
1412 Some(Length::ZERO)
1413 );
1414 assert_eq!(
1415 get_initial_value(PropertyId::MarginBottom).as_length(),
1416 Some(Length::ZERO)
1417 );
1418
1419 assert_eq!(
1421 get_initial_value(PropertyId::PaddingRight).as_length(),
1422 Some(Length::ZERO)
1423 );
1424 assert_eq!(
1425 get_initial_value(PropertyId::PaddingBottom).as_length(),
1426 Some(Length::ZERO)
1427 );
1428 assert_eq!(
1429 get_initial_value(PropertyId::PaddingBefore).as_length(),
1430 Some(Length::ZERO)
1431 );
1432 assert_eq!(
1433 get_initial_value(PropertyId::PaddingAfter).as_length(),
1434 Some(Length::ZERO)
1435 );
1436
1437 assert_eq!(
1439 get_initial_value(PropertyId::BorderRightWidth).as_length(),
1440 Some(Length::from_pt(1.0))
1441 );
1442 assert_eq!(
1443 get_initial_value(PropertyId::BorderBeforeWidth).as_length(),
1444 Some(Length::from_pt(1.0))
1445 );
1446
1447 assert_eq!(
1449 get_initial_value(PropertyId::BorderRightStyle).as_enum(),
1450 Some(EN_NONE)
1451 );
1452 assert_eq!(
1453 get_initial_value(PropertyId::BorderBottomStyle).as_enum(),
1454 Some(EN_NONE)
1455 );
1456
1457 assert_eq!(
1459 get_initial_value(PropertyId::BorderRightColor).as_color(),
1460 Some(Color::BLACK)
1461 );
1462 assert_eq!(
1463 get_initial_value(PropertyId::BorderLeftColor).as_color(),
1464 Some(Color::BLACK)
1465 );
1466
1467 assert!(get_initial_value(PropertyId::MinWidth)
1469 .as_length()
1470 .is_some());
1471 assert!(get_initial_value(PropertyId::MinHeight)
1472 .as_length()
1473 .is_some());
1474 assert!(get_initial_value(PropertyId::MaxWidth).is_none());
1475 assert!(get_initial_value(PropertyId::MaxHeight).is_none());
1476
1477 assert!(get_initial_value(PropertyId::KeepWithNext)
1479 .as_enum()
1480 .is_some());
1481 assert!(get_initial_value(PropertyId::KeepWithPrevious)
1482 .as_enum()
1483 .is_some());
1484 assert!(get_initial_value(PropertyId::BreakAfter)
1485 .as_enum()
1486 .is_some());
1487
1488 assert_eq!(
1490 get_initial_value(PropertyId::NumberColumnsSpanned).as_integer(),
1491 Some(1)
1492 );
1493 assert_eq!(
1494 get_initial_value(PropertyId::NumberRowsSpanned).as_integer(),
1495 Some(1)
1496 );
1497
1498 assert_eq!(
1500 get_initial_value(PropertyId::LetterSpacing).as_enum(),
1501 Some(EN_NORMAL)
1502 );
1503 assert_eq!(
1504 get_initial_value(PropertyId::WordSpacing).as_enum(),
1505 Some(EN_NORMAL)
1506 );
1507
1508 assert_eq!(
1510 get_initial_value(PropertyId::HyphenationPushCharacterCount).as_integer(),
1511 Some(2)
1512 );
1513 assert_eq!(
1514 get_initial_value(PropertyId::HyphenationRemainCharacterCount).as_integer(),
1515 Some(2)
1516 );
1517 }
1518}
1519
1520#[cfg(test)]
1522mod additional_tests {
1523 use super::*;
1524
1525 #[test]
1526 fn test_initial_font_weight_is_normal() {
1527 let v = get_initial_value(PropertyId::FontWeight);
1528 assert_eq!(v.as_enum(), Some(EN_NORMAL));
1530 }
1531
1532 #[test]
1533 fn test_initial_font_style_is_normal() {
1534 let v = get_initial_value(PropertyId::FontStyle);
1535 assert_eq!(v.as_enum(), Some(EN_NORMAL));
1536 }
1537
1538 #[test]
1539 fn test_initial_letter_spacing_is_normal() {
1540 let v = get_initial_value(PropertyId::LetterSpacing);
1541 assert_eq!(v.as_enum(), Some(EN_NORMAL));
1542 }
1543
1544 #[test]
1545 fn test_initial_word_spacing_is_normal() {
1546 let v = get_initial_value(PropertyId::WordSpacing);
1547 assert_eq!(v.as_enum(), Some(EN_NORMAL));
1548 }
1549
1550 #[test]
1551 fn test_initial_direction_is_ltr() {
1552 let v = get_initial_value(PropertyId::Direction);
1553 assert_eq!(v.as_enum(), Some(EN_LTR));
1554 }
1555
1556 #[test]
1557 fn test_initial_writing_mode_is_lr_tb() {
1558 let v = get_initial_value(PropertyId::WritingMode);
1559 assert_eq!(v.as_enum(), Some(EN_LR_TB));
1560 }
1561
1562 #[test]
1563 fn test_initial_background_color_is_transparent() {
1564 let v = get_initial_value(PropertyId::BackgroundColor);
1565 assert!(v.as_color().is_some() || v.is_none() || v.is_auto());
1568 }
1569
1570 #[test]
1571 fn test_initial_border_top_style_is_none() {
1572 let v = get_initial_value(PropertyId::BorderTopStyle);
1573 assert_eq!(v.as_enum(), Some(EN_NONE));
1574 }
1575
1576 #[test]
1577 fn test_initial_border_bottom_style_is_none() {
1578 let v = get_initial_value(PropertyId::BorderBottomStyle);
1579 assert_eq!(v.as_enum(), Some(EN_NONE));
1580 }
1581
1582 #[test]
1583 fn test_initial_border_left_style_is_none() {
1584 let v = get_initial_value(PropertyId::BorderLeftStyle);
1585 assert_eq!(v.as_enum(), Some(EN_NONE));
1586 }
1587
1588 #[test]
1589 fn test_initial_border_right_style_is_none() {
1590 let v = get_initial_value(PropertyId::BorderRightStyle);
1591 assert_eq!(v.as_enum(), Some(EN_NONE));
1592 }
1593
1594 #[test]
1595 fn test_initial_padding_top_is_zero() {
1596 let v = get_initial_value(PropertyId::PaddingTop);
1597 assert_eq!(v.as_length(), Some(Length::ZERO));
1598 }
1599
1600 #[test]
1601 fn test_initial_padding_bottom_is_zero() {
1602 let v = get_initial_value(PropertyId::PaddingBottom);
1603 assert_eq!(v.as_length(), Some(Length::ZERO));
1604 }
1605
1606 #[test]
1607 fn test_initial_padding_left_is_zero() {
1608 let v = get_initial_value(PropertyId::PaddingLeft);
1609 assert_eq!(v.as_length(), Some(Length::ZERO));
1610 }
1611
1612 #[test]
1613 fn test_initial_padding_right_is_zero() {
1614 let v = get_initial_value(PropertyId::PaddingRight);
1615 assert_eq!(v.as_length(), Some(Length::ZERO));
1616 }
1617
1618 #[test]
1619 fn test_initial_margin_top_is_zero() {
1620 let v = get_initial_value(PropertyId::MarginTop);
1621 assert_eq!(v.as_length(), Some(Length::ZERO));
1622 }
1623
1624 #[test]
1625 fn test_initial_margin_bottom_is_zero() {
1626 let v = get_initial_value(PropertyId::MarginBottom);
1627 assert_eq!(v.as_length(), Some(Length::ZERO));
1628 }
1629
1630 #[test]
1631 fn test_initial_margin_left_is_zero() {
1632 let v = get_initial_value(PropertyId::MarginLeft);
1633 assert_eq!(v.as_length(), Some(Length::ZERO));
1634 }
1635
1636 #[test]
1637 fn test_initial_margin_right_is_zero() {
1638 let v = get_initial_value(PropertyId::MarginRight);
1639 assert_eq!(v.as_length(), Some(Length::ZERO));
1640 }
1641
1642 #[test]
1643 fn test_initial_visibility_is_visible() {
1644 let v = get_initial_value(PropertyId::Visibility);
1645 assert_eq!(v.as_enum(), Some(EN_VISIBLE));
1646 }
1647
1648 #[test]
1649 fn test_initial_overflow_is_visible() {
1650 let v = get_initial_value(PropertyId::Overflow);
1651 assert_eq!(v.as_enum(), Some(EN_VISIBLE));
1652 }
1653
1654 #[test]
1655 fn test_initial_column_count_is_one() {
1656 let v = get_initial_value(PropertyId::ColumnCount);
1657 assert_eq!(v.as_integer(), Some(1));
1658 }
1659
1660 #[test]
1661 fn test_initial_orphans_is_two() {
1662 let v = get_initial_value(PropertyId::Orphans);
1663 assert_eq!(v.as_integer(), Some(2));
1664 }
1665
1666 #[test]
1667 fn test_initial_widows_is_two() {
1668 let v = get_initial_value(PropertyId::Widows);
1669 assert_eq!(v.as_integer(), Some(2));
1670 }
1671
1672 #[test]
1673 fn test_initial_opacity_is_one() {
1674 let v = get_initial_value(PropertyId::Opacity);
1675 assert_eq!(v.as_number(), Some(1.0));
1676 }
1677
1678 #[test]
1679 fn test_initial_z_index_is_auto() {
1680 let v = get_initial_value(PropertyId::ZIndex);
1681 assert!(v.is_auto() || v.as_integer().is_some());
1683 }
1684
1685 #[test]
1686 fn test_initial_text_indent_is_zero() {
1687 let v = get_initial_value(PropertyId::TextIndent);
1688 assert_eq!(v.as_length(), Some(Length::ZERO));
1689 }
1690
1691 #[test]
1692 fn test_initial_line_height_is_normal() {
1693 let v = get_initial_value(PropertyId::LineHeight);
1694 assert_eq!(v.as_enum(), Some(EN_NORMAL));
1695 }
1696
1697 #[test]
1698 fn test_initial_width_is_auto() {
1699 let v = get_initial_value(PropertyId::Width);
1700 assert!(v.is_auto());
1701 }
1702
1703 #[test]
1704 fn test_initial_height_is_auto() {
1705 let v = get_initial_value(PropertyId::Height);
1706 assert!(v.is_auto());
1707 }
1708
1709 #[test]
1710 fn test_initial_text_align_is_start() {
1711 let v = get_initial_value(PropertyId::TextAlign);
1712 assert_eq!(v.as_enum(), Some(EN_START));
1713 }
1714
1715 #[test]
1716 fn test_initial_border_collapse_is_separate() {
1717 let v = get_initial_value(PropertyId::BorderCollapse);
1718 assert_eq!(v.as_enum(), Some(EN_SEPARATE));
1719 }
1720
1721 #[test]
1722 fn test_get_initial_value_does_not_panic_for_all_ids() {
1723 let ids = [
1725 PropertyId::AbsolutePosition,
1726 PropertyId::BackgroundColor,
1727 PropertyId::BorderTopStyle,
1728 PropertyId::Color,
1729 PropertyId::Direction,
1730 PropertyId::FontFamily,
1731 PropertyId::FontSize,
1732 PropertyId::FontStyle,
1733 PropertyId::FontWeight,
1734 PropertyId::Height,
1735 PropertyId::LineHeight,
1736 PropertyId::MarginTop,
1737 PropertyId::Opacity,
1738 PropertyId::Overflow,
1739 PropertyId::PaddingTop,
1740 PropertyId::TextAlign,
1741 PropertyId::TextIndent,
1742 PropertyId::Visibility,
1743 PropertyId::WhiteSpace,
1744 PropertyId::Width,
1745 PropertyId::WritingMode,
1746 PropertyId::ZIndex,
1747 ];
1748 for id in &ids {
1749 let _ = get_initial_value(*id); }
1751 }
1752}