@@ -67,6 +67,19 @@ public function formattedValueDataProvider(): \Iterator
67
67
yield ['10.23 V (9 V ... 11 V) [Test] ' , 9 , 10.23 , 11 , 'V ' , 'Test ' ];
68
68
}
69
69
70
+ public function formattedValueWithLatexDataProvider (): \Iterator
71
+ {
72
+ yield ['Text Test ' , null , null , null , 'V ' , 'Text Test ' ];
73
+ yield ['10.23 $\mathrm{V}$ ' , null , 10.23 , null , 'V ' , '' ];
74
+ yield ['10.23 $\mathrm{V}$ [Text] ' , null , 10.23 , null , 'V ' , 'Text ' ];
75
+ yield ['max. 10.23 $\mathrm{V}$ ' , null , null , 10.23 , 'V ' , '' ];
76
+ yield ['max. 10.23 [Text] ' , null , null , 10.23 , '' , 'Text ' ];
77
+ yield ['min. 10.23 $\mathrm{V}$ ' , 10.23 , null , null , 'V ' , '' ];
78
+ yield ['10.23 $\mathrm{V}$ ... 11 $\mathrm{V}$ ' , 10.23 , null , 11 , 'V ' , '' ];
79
+ yield ['10.23 $\mathrm{V}$ (9 $\mathrm{V}$ ... 11 $\mathrm{V}$) ' , 9 , 10.23 , 11 , 'V ' , '' ];
80
+ yield ['10.23 $\mathrm{V}$ (9 $\mathrm{V}$ ... 11 $\mathrm{V}$) [Test] ' , 9 , 10.23 , 11 , 'V ' , 'Test ' ];
81
+ }
82
+
70
83
/**
71
84
* @dataProvider valueWithUnitDataProvider
72
85
*/
@@ -117,4 +130,22 @@ public function testGetFormattedValue(string $expected, ?float $min, ?float $typ
117
130
$ param ->setValueText ($ text );
118
131
$ this ->assertSame ($ expected , $ param ->getFormattedValue ());
119
132
}
133
+
134
+ /**
135
+ * @dataProvider formattedValueWithLatexDataProvider
136
+ *
137
+ * @param float $min
138
+ * @param float $typical
139
+ * @param float $max
140
+ */
141
+ public function testGetFormattedValueWithLatex (string $ expected , ?float $ min , ?float $ typical , ?float $ max , string $ unit , string $ text ): void
142
+ {
143
+ $ param = new PartParameter ();
144
+ $ param ->setUnit ($ unit );
145
+ $ param ->setValueMin ($ min );
146
+ $ param ->setValueTypical ($ typical );
147
+ $ param ->setValueMax ($ max );
148
+ $ param ->setValueText ($ text );
149
+ $ this ->assertSame ($ expected , $ param ->getFormattedValue (true ));
150
+ }
120
151
}
0 commit comments