File: test_textutils.cpp

package info (click to toggle)
fritzing 0.9.6%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,128 kB
  • sloc: cpp: 103,072; ansic: 2,615; xml: 2,067; python: 803; sh: 253; makefile: 21
file content (35 lines) | stat: -rw-r--r-- 1,242 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
#define BOOST_TEST_MODULE SVG Tests
#include <boost/test/included/unit_test.hpp>

//#include <QStringList>

#define private public
#include "textutils.h"

BOOST_AUTO_TEST_CASE( test_removeFontFamilySingleQuotes )
{
    QString input1 = R"(g-text-style=“font-family:Droid Sans;text-anchor:middle;”)";
    QString input2 = R"(g-text-font-family=“Droid Sans”)";
    QString input3 = R"(style="font-family:‘Droid Sans’")";
    QString input4 = R"(style="font-family:'Droid Sans'")";
    QString input5 = R"x(<text transform="matrix(1 0 0 1 62.9226 29.5)" fill="#8C8C8C" font-family="'DroidSans'" font-size="3.5">echo</text>)x";

    bool changed;
    changed = TextUtils::removeFontFamilySingleQuotes(input1);
    BOOST_REQUIRE(!changed);

    changed = TextUtils::removeFontFamilySingleQuotes(input2);
    BOOST_REQUIRE(!changed);

    // We can probably not process opening and closing single quotes, but
    // I don't think they are valid svg anyhow.
    changed = TextUtils::removeFontFamilySingleQuotes(input3);
    BOOST_REQUIRE(!changed);

    changed = TextUtils::removeFontFamilySingleQuotes(input4);
    BOOST_REQUIRE(changed);

    changed = TextUtils::removeFontFamilySingleQuotes(input5);
    BOOST_REQUIRE(changed);

}