File: TextLabelTest.cpp

package info (click to toggle)
labplot 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 70,348 kB
  • sloc: cpp: 145,806; ansic: 4,534; python: 881; yacc: 540; xml: 357; sh: 185; awk: 35; makefile: 7
file content (46 lines) | stat: -rw-r--r-- 1,254 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
	File                 : TextLabelTest.cpp
	Project              : LabPlot
	Description          : Tests for TextLabel
	--------------------------------------------------------------------
	SPDX-FileCopyrightText: 2022 Stefan Gerlach <stefan.gerlach@uni.kn>

	SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "TextLabelTest.h"
#include "backend/worksheet/TextLabel.h"
#include "backend/worksheet/TextLabelPrivate.h"
#include "backend/core/Project.h"
#include "backend/lib/trace.h"

void TextLabelTest::addPlot() {
	Project project;
	auto* ws = new Worksheet("worksheet");
	QVERIFY(ws != nullptr);
	project.addChild(ws);

	auto* p = new CartesianPlot("plot");
	QVERIFY(p != nullptr);
	ws->addChild(p);

	auto *l = new TextLabel("Label");
	QVERIFY(l != nullptr);
	l->setText(QString("TextLabelText"));
	ws->addChild(l);

	QCOMPARE(l->text().mode, TextLabel::Mode::Text);
	QCOMPARE(l->text().text.contains(QLatin1String("Text")), true);
	QCOMPARE(l->text().text.contains(QLatin1String(" color:")), true);
	QCOMPARE(l->text().text.contains(QLatin1String(" background-color:")), true);

	QCOMPARE(l->fontColor(), Qt::black);
	QCOMPARE(l->backgroundColor(), Qt::white);

	// add title?
	
	// add axes?
	// check axis label
}

QTEST_MAIN(TextLabelTest)