MCPcopy Create free account
hub / github.com/KDE/labplot / multiLabelEditTextChange

Method multiLabelEditTextChange

tests/backend/TextLabel/TextLabelTest.cpp:173–213  ·  view source on GitHub ↗

! * \brief TextLabelTest::multiLabelEditTextChange * Changing the text of two labels changes the text content and more text related * properties */

Source from the content-addressed store, hash-verified

171 * properties
172 */
173void TextLabelTest::multiLabelEditTextChange() {
174 Project project;
175 auto* ws = new Worksheet(QStringLiteral("worksheet"));
176 QVERIFY(ws != nullptr);
177 project.addChild(ws);
178
179 auto* p = new CartesianPlot(QStringLiteral("plot"));
180 QVERIFY(p != nullptr);
181 ws->addChild(p);
182
183 auto* l1 = new TextLabel(QStringLiteral("Label"));
184 QVERIFY(l1 != nullptr);
185 l1->setText(QStringLiteral("Text1"));
186 ws->addChild(l1);
187
188 auto* l2 = new TextLabel(QStringLiteral("Label"));
189 QVERIFY(l2 != nullptr);
190 l2->setText(QStringLiteral("Text2"));
191 ws->addChild(l2);
192
193 LabelWidget w(nullptr);
194 w.setLabels({l1}); // change only one textlabel
195 w.fontColorChanged(Qt::red);
196 w.backgroundColorChanged(Qt::blue);
197 w.fontSuperScriptChanged(true);
198 w.fontStrikeOutChanged(true);
199 w.fontUnderlineChanged(true);
200 w.fontItalicChanged(true);
201 w.fontBoldChanged(true);
202 w.fontChanged(QFont(QStringLiteral("AkrutiTml2")));
203
204 STORETEXTPROPERTIES(l1, l1InitProperties);
205
206 w.setLabels({l1, l2});
207 w.ui.teLabel->setText(QStringLiteral("New text"));
208
209 TextProperties l1p = l1InitProperties;
210 l1p.plainText = QStringLiteral("New text");
211 COMPARETEXTPROPERTIESLABEL(l1, l1p);
212 COMPARETEXTPROPERTIESLABEL(l2, l1p); // textlabel2 received all properties of the first label, because the text content changes
213}
214
215void TextLabelTest::multiLabelEditColorChangeSelection() {
216 Project project;

Callers

nothing calls this directly

Calls 12

setLabelsMethod · 0.80
fontColorChangedMethod · 0.80
fontStrikeOutChangedMethod · 0.80
fontUnderlineChangedMethod · 0.80
fontItalicChangedMethod · 0.80
fontBoldChangedMethod · 0.80
QFontClass · 0.50
addChildMethod · 0.45
setTextMethod · 0.45
fontChangedMethod · 0.45

Tested by

no test coverage detected