Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

PSD text: disbale txt2 saving, add test files, fix up some small issues.

Wolthera van Hövell tot Westerflierd55a5c392744
diff --git a/libs/flake/text/KoSvgTextShapeMarkupConverter.cpp b/libs/flake/text/KoSvgTextShapeMarkupConverter.cpp
index a6c142b525..472fc07629 100644
--- a/libs/flake/text/KoSvgTextShapeMarkupConverter.cpp
+++ b/libs/flake/text/KoSvgTextShapeMarkupConverter.cpp
@@ -1124,7 +1124,7 @@ bool KoSvgTextShapeMarkupConverter::convertSvgToDocument(const QString &svgText,
return true;
}
-QColor colorFromPSDStyleSheet(QVariantHash color) {
+QColor colorFromPSDStyleSheet(QVariantHash color, const KoColorSpace *imageCs) {
QColor c(Qt::black);
if (color.keys().contains("/Color")) {
color = color["/Color"].toHash();
@@ -1153,6 +1153,9 @@ QColor colorFromPSDStyleSheet(QVariantHash color) {
root.setAttribute("b", values.value(3).toDouble());
}
KoColor final = KoColor::fromXML(root, "U8");
+ if (final.colorSpace()->colorModelId() == imageCs->colorModelId()) {
+ final.setProfile(imageCs->profile());
+ }
final.toQColor(&c);
return c;
}
@@ -1202,7 +1205,7 @@ static QHash <int, QString> psdLanguageMap {
{28, "hu"}, // Hungarian
};
-QString stylesForPSDStyleSheet(QString &lang, QVariantHash PSDStyleSheet, QMap<int, font_info_psd> fontNames, QTransform scale) {
+QString stylesForPSDStyleSheet(QString &lang, QVariantHash PSDStyleSheet, QMap<int, font_info_psd> fontNames, QTransform scale, const KoColorSpace *imageCs) {
QStringList styles;
QStringList unsupportedStyles;
@@ -1525,14 +1528,16 @@ QString stylesForPSDStyleSheet(QString &lang, QVariantHash PSDStyleSheet, QMap<i
// vertical kana - 'vkna'
// vert alt+rot - vrt2, or vert + vrtr
int val = PSDStyleSheet.value(key).toInt();
- if (val == 1) { // japanese traditional - 'tnam'/'trad'
+ if (val == 0) {
+ continue;
+ } else if (val == 1) { // japanese traditional - 'tnam'/'trad'
fontVariantEastAsian.append("traditional");
} else if (val == 2) { // japanese expert - 'expt'
fontFeatureSettings.append("'expt' 1");
} else if (val == 3) { // Japanese 78 - jis78
fontVariantEastAsian.append("jis78");
} else {
- qDebug() << key << PSDStyleSheet.value(key);
+ qDebug() << QString("Unknown value for %1:").arg(key) << PSDStyleSheet.value(key);
}
continue;
} else if (key == "/NoBreak") {
@@ -1555,7 +1560,7 @@ QString stylesForPSDStyleSheet(QString &lang, QVariantHash PSDStyleSheet, QMap<i
}
if (fill) {
QVariantHash color = PSDStyleSheet.value(key).toHash();
- styles.append("fill:"+colorFromPSDStyleSheet(color).name());
+ styles.append("fill:"+colorFromPSDStyleSheet(color, imageCs).name());
} else {
styles.append("fill:none");
}
@@ -1566,7 +1571,7 @@ QString stylesForPSDStyleSheet(QString &lang, QVariantHash PSDStyleSheet, QMap<i
}
if (fill) {
QVariantHash color = PSDStyleSheet.value(key).toHash();
- styles.append("stroke:"+colorFromPSDStyleSheet(color).name());
+ styles.append("stroke:"+colorFromPSDStyleSheet(color, imageCs).name());
} else {
styles.append("stroke:none");
}
@@ -1676,7 +1681,7 @@ QString stylesForPSDStyleSheet(QString &lang, QVariantHash PSDStyleSheet, QMap<i
continue;
} else {
if (key != "/FillFlag" && key != "/StrokeFlag" && key != "/AutoLeading") {
- qWarning() << "Unknown PSD character stylesheet style key" << key << PSDStyleSheet.value(key);
+ debugFlake << "Unknown PSD character stylesheet style key" << key << PSDStyleSheet.value(key);
}
}
}
@@ -1710,11 +1715,11 @@ QString stylesForPSDStyleSheet(QString &lang, QVariantHash PSDStyleSheet, QMap<i
if (!underlinePos.isEmpty()) {
styles.append("text-decoration-position:"+underlinePos);
}
- qWarning() << "Unsupported styles" << unsupportedStyles;
+ debugFlake << "Unsupported styles" << unsupportedStyles;
return styles.join("; ");
}
-QString stylesForPSDParagraphSheet(QVariantHash PSDParagraphSheet, QString &lang, QMap<int, font_info_psd> fontNames, QTransform scaleToPt) {
+QString stylesForPSDParagraphSheet(QVariantHash PSDParagraphSheet, QString &lang, QMap<int, font_info_psd> fontNames, QTransform scaleToPt, const KoColorSpace *imageCs) {
QStringList styles;
QStringList unsupportedStyles;
@@ -1892,18 +1897,19 @@ QString stylesForPSDParagraphSheet(QVariantHash PSDParagraphSheet, QString &lang
unsupportedStyles << key;
continue;
} else if (key == "/DefaultStyle") {
- styles.append(stylesForPSDStyleSheet(lang, PSDParagraphSheet.value(key).toHash(), fontNames, scaleToPt));
+ styles.append(stylesForPSDStyleSheet(lang, PSDParagraphSheet.value(key).toHash(), fontNames, scaleToPt, imageCs));
} else {
- qWarning() << "Unknown PSD paragraph style key" << key << PSDParagraphSheet.value(key);
+ debugFlake << "Unknown PSD paragraph style key" << key << PSDParagraphSheet.value(key);
}
}
- qWarning() << "Unsupported paragraph styles" << unsupportedStyles;
+ debugFlake << "Unsupported paragraph styles" << unsupportedStyles;
return styles.join("; ");
}
bool KoSvgTextShapeMarkupConverter::convertPSDTextEngineDataToSVG(const QVariantHash tySh,
const QVariantHash txt2,
+ const KoColorSpace *imageCs,
const int textIndex,
QString *svgText,
QString *svgStyles,
@@ -2120,7 +2126,8 @@ bool KoSvgTextShapeMarkupConverter::convertPSDTextEngineDataToSVG(const QVariant
return false;
} else {
text = editor.value("/Text").toString();
- text.replace("\r", "\n");
+ text.replace("\r", "\n"); // return, used for paragraph hard breaks.
+ text.replace(0x03, "\n"); // end of text character, used for non-paragraph hard breaks.
}
int antiAliasing = 0;
@@ -2144,7 +2151,7 @@ bool KoSvgTextShapeMarkupConverter::convertPSDTextEngineDataToSVG(const QVariant
QVariantHash styleSheet = parasheet[features].toHash();
QString lang;
- QString styleString = stylesForPSDParagraphSheet(styleSheet, lang, fontNames, scaleToPt);
+ QString styleString = stylesForPSDParagraphSheet(styleSheet, lang, fontNames, scaleToPt, imageCs);
if (!lang.isEmpty()) {
svgWriter.writeAttribute("xml:lang", lang);
}
@@ -2215,7 +2222,7 @@ bool KoSvgTextShapeMarkupConverter::convertPSDTextEngineDataToSVG(const QVariant
} else {
svgWriter.writeStartElement("tspan");
QString lang;
- svgWriter.writeAttribute("style", stylesForPSDStyleSheet(lang, styleSheet, fontNames, scaleToPt));
+ svgWriter.writeAttribute("style", stylesForPSDStyleSheet(lang, styleSheet, fontNames, scaleToPt, imageCs));
if (!lang.isEmpty()) {
svgWriter.writeAttribute("xml:lang", lang);
}
@@ -2228,7 +2235,7 @@ bool KoSvgTextShapeMarkupConverter::convertPSDTextEngineDataToSVG(const QVariant
}
svgWriter.writeStartElement("tspan");
QString lang;
- svgWriter.writeAttribute("style", stylesForPSDStyleSheet(lang, styleSheet, fontNames, scaleToPt));
+ svgWriter.writeAttribute("style", stylesForPSDStyleSheet(lang, styleSheet, fontNames, scaleToPt, imageCs));
if (!lang.isEmpty()) {
svgWriter.writeAttribute("xml:lang", lang);
}
diff --git a/libs/flake/text/KoSvgTextShapeMarkupConverter.h b/libs/flake/text/KoSvgTextShapeMarkupConverter.h
index cd6b7831c3..ce84c8aa07 100644
--- a/libs/flake/text/KoSvgTextShapeMarkupConverter.h
+++ b/libs/flake/text/KoSvgTextShapeMarkupConverter.h
@@ -18,6 +18,7 @@
class QRectF;
class KoSvgTextShape;
class KoShape;
+class KoColorSpace;
/**
* KoSvgTextShapeMarkupConverter is a utility class for converting a
@@ -87,6 +88,7 @@ public:
bool convertPSDTextEngineDataToSVG(const QVariantHash tySh,
const QVariantHash txt2,
+ const KoColorSpace *imageCs,
const int textIndex,
QString *svgText,
QString *svgStyles,
diff --git a/libs/psd/psd_layer_section.cpp b/libs/psd/psd_layer_section.cpp
index 2d95cc2c27..61dc873e5e 100644
--- a/libs/psd/psd_layer_section.cpp
+++ b/libs/psd/psd_layer_section.cpp
@@ -887,9 +887,30 @@ void PSDLayerMaskSection::writePsdImpl(QIODevice &io, KisNodeSP rootLayer, psd_c
}
globalInfoSection.writePattBlockEx(io, mergedPatternsXmlDoc);
+
+#if 0
+ /**
+ * We're currently not writing the Txt2 data itself as it doesn't
+ * result in correct PSDs. There's three possible culprits for this:
+ *
+ * 1. PSD perhaps requires the data to be stored in a specific order.
+ * The 'uncompressKeys' function in kis_txt2_utls gives an indication of this order.
+ * 2. PSD requires the Strikes for each text object to be written.
+ * This is the most likely cause. The strikes object however consists of data for
+ * every line, segment, and character, with positioning, bounding boxes and even
+ * precise font glyph indices for each character. This is more or less a cached
+ * version of the layout data of the text shape, and we don't have that kind of access
+ * of the text shape data right now.
+ * 3. Something else. The Txt2 data is huge and therefore it is hard to figure out
+ * where things might be going wrong.
+ *
+ * In practice, this means Krita won't be able to store OpenType feature data as well
+ * as path shapes for either text-in-shape or text-on-path.
+ */
if (textCount > 0) {
globalInfoSection.writeTxt2BlockEx(io, globalInfoSection.txt2Data);
}
+#endif
}
}
diff --git a/libs/psdutils/cos/kis_cos_writer.cpp b/libs/psdutils/cos/kis_cos_writer.cpp
index 06267e22f5..500368b3f3 100644
--- a/libs/psdutils/cos/kis_cos_writer.cpp
+++ b/libs/psdutils/cos/kis_cos_writer.cpp
@@ -13,11 +13,12 @@
#include <QBuffer>
const QMap<char, char> escape = {
- {0x0a, 'n'},
- {0x0d, 'r'},
- {0x09, 't'},
- {0x08, 'b'}, // backspace
- {0x0c, 'f'},
+ // Turns out, Adobe text engine data only really escapes ( and ).
+ //{0x0a, 'n'},
+ //{0x0d, 'r'},
+ //{0x09, 't'},
+ //{0x08, 'b'}, // backspace
+ //{0x0c, 'f'},
{0x28, '('},
{0x29, ')'},
{0x5c, '\\'} // reverse solidus/backslash
@@ -163,5 +164,8 @@ QByteArray KisCosWriter::writeTxt2FromVariantHash(const QVariantHash doc)
} else {
qDebug() << dev.errorString();
}
+ if (ba.endsWith(' ')) {
+ ba.chop(1);
+ }
return ba;
}
diff --git a/libs/psdutils/cos/kis_txt2_utls.cpp b/libs/psdutils/cos/kis_txt2_utls.cpp
index 23794113cb..0b4ef15b0e 100644
--- a/libs/psdutils/cos/kis_txt2_utls.cpp
+++ b/libs/psdutils/cos/kis_txt2_utls.cpp
@@ -599,17 +599,117 @@ QVariantHash uncompressKeysTextModel(const QVariantHash object) {
return newObject;
}
-QVariantHash uncompressStrikeDef(const QVariantHash object) {
- //qDebug() << Q_FUNC_INFO;
+QVariantHash uncompressGlyphStrikeDef(const QVariantHash object) {
+ QVariantHash newObject;
+
+ Q_FOREACH(QString key, object.keys()) {
+ QVariant val = object.value(key);
+ // bounds,
+ if (key == "/99") {
+ newObject.insert("/StreamTag", val);
+ } else if (key == "/1") {
+ newObject.insert("/Bounds", val);
+ } else if (key == "/5") {
+ newObject.insert("/Glyphs", val);
+ } else if (key == "/10") {
+ newObject.insert("/GlyphAdjustments", val);
+ } else if (key == "/8") {
+ newObject.insert("/VisualBounds", val);
+ } else if (key == "/9") {
+ newObject.insert("/RenderedBounds", val);
+ } else if (key == "/15") {
+ newObject.insert("/Invalidation", val);
+ } else if (key == "/14") {
+ newObject.insert("/EndsInCR", val);
+ } else if (key == "/12") {
+ newObject.insert("/SelectionAscent", val);
+ } else if (key == "/13") {
+ newObject.insert("/SelectionDescent", val);
+ } else {
+ newObject.insert(key, val);
+ }
+ }
+ return newObject;
+}
+
+QVariantHash uncompressSegmentDef(const QVariantHash object) {
QVariantHash newObject;
+
Q_FOREACH(QString key, object.keys()) {
QVariant val = object.value(key);
if (key == "/99") {
newObject.insert("/StreamTag", val);
- } else if (key == "/0") {
+ } else if (key == "/1") {
newObject.insert("/Bounds", val);
+ } else if (key == "/5") {
+ newObject.insert("/ChildProcession", val);
+ } else if (key == "/6") {
+ QVariantList array = val.toList();
+ QVariantList newArray;
+ Q_FOREACH(QVariant entry, array) {
+ newArray.append(uncompressGlyphStrikeDef(entry.toHash()));
+ }
+ newObject.insert("/Children", newArray);
+ } else if (key == "/15") {
+ newObject.insert("/Mapping", val);
+ } else if (key == "/20") {
+ newObject.insert("/FirstCharacterIndexInSegment", val);
+ } else {
+ newObject.insert(key, val);
+ }
+ }
+ return newObject;
+}
+
+QVariantHash uncompressLineDef(const QVariantHash object) {
+ QVariantHash newObject;
+
+ Q_FOREACH(QString key, object.keys()) {
+ QVariant val = object.value(key);
+
+ if (key == "/99") {
+ newObject.insert("/StreamTag", val);
+ } else if (key == "/0") {
+ newObject.insert("/Transform", val);
} else if (key == "/1") {
+ newObject.insert("/Bounds", val);
+ } else if (key == "/5") {
+ newObject.insert("/ChildProcession", val);
+ } else if (key == "/6") {
+ QVariantList array = val.toList();
+ QVariantList newArray;
+ Q_FOREACH(QVariant entry, array) {
+ newArray.append(uncompressSegmentDef(entry.toHash()));
+ }
+ newObject.insert("/Children", newArray);
+ } else if (key == "/10") {
+ newObject.insert("/Baseline", val);
+ } else if (key == "/14") {
+ newObject.insert("/SelectionAscent", val);
+ } else if (key == "/15") {
+ newObject.insert("/SelectionDescent", val);
+ } else {
+ newObject.insert(key, val);
+ }
+ }
+ return newObject;
+}
+
+QVariantHash uncompressStrikeDef(const QVariantHash object, bool flip = false) {
+ //qDebug() << Q_FUNC_INFO;
+ QVariantHash newObject;
+ QString tag = object.contains("/99")? object.value("/99").toString()
+ : object.value("/StreamTag").toString();
+
+ Q_FOREACH(QString key, object.keys()) {
+ QVariant val = object.value(key);
+
+ if (key == "/99") {
+ newObject.insert("/StreamTag", val);
+ } else if ((key == "/0" && !flip) || (key == "/1" && flip)) {
+ newObject.insert("/Bounds", val);
+ } else if ((key == "/1" && !flip) || (key == "/0" && flip)) {
newObject.insert("/Transform", val);
} else if (key == "/5") {
newObject.insert("/ChildProcession", val);
@@ -617,9 +717,18 @@ QVariantHash uncompressStrikeDef(const QVariantHash object) {
QVariantList array = val.toList();
QVariantList newArray;
Q_FOREACH(QVariant entry, array) {
- newArray.append(uncompressStrikeDef(entry.toHash()));
+ QString streamTag = entry.toHash().keys().contains("/99")? entry.toHash().value("/99").toString()
+ : entry.toHash().value("/StreamTag").toString();
+ if (streamTag == "/PC" || streamTag == "/PathSelectGroupCharacter"
+ || streamTag == "/F" || streamTag == "/FrameStrike" || streamTag == "/RowColStrike" || streamTag == "/R") {
+ newArray.append(uncompressStrikeDef(entry.toHash(), true));
+ } else if (streamTag == "/L" || streamTag == "/LineStrike") {
+ newArray.append(uncompressLineDef(entry.toHash()));
+ }
}
newObject.insert("/Children", newArray);
+ } else if (key == "/10" && (tag == "/F" || tag == "/FrameStrike")) { // only for frame strike.
+ newObject.insert("/Frame", val);
} else {
newObject.insert(key, val);
}
@@ -1355,7 +1464,7 @@ QVariantHash KisTxt2Utils::tyShFromTxt2(const QVariantHash Txt2, const QRectF bo
QVariantHash rendered;
int shapeType = textFrameData.value("/Type", QVariant(0)).toInt(); // 0 point, 1 paragraph, 2, text on path
int writingDirection = textFrameData.value("/LineOrientation", QVariant(0)).toInt();
- QVariantHash photoshop = QVariantHash {{"/ShapeType", shapeType},
+ QVariantHash photoshop = QVariantHash {{"/ShapeType", qMax(1, shapeType)},
{"/TransformPoint0", QVariantList({1.0, 0.0})},
{"/TransformPoint1", QVariantList({0.0, 1.0})},
{"/TransformPoint2", QVariantList({0.0, 0.0})}};
diff --git a/plugins/impex/psd/psd_loader.cpp b/plugins/impex/psd/psd_loader.cpp
index 9b82175e21..e8fbbb8b86 100644
--- a/plugins/impex/psd/psd_loader.cpp
+++ b/plugins/impex/psd/psd_loader.cpp
@@ -431,6 +431,7 @@ KisImportExportErrorCode PSDLoader::decode(QIODevice &io)
QTransform scaleToPt = QTransform::fromScale(m_image->xRes(), m_image->yRes()).inverted();
bool res = converter.convertPSDTextEngineDataToSVG(text.engineData,
layerSection.globalInfoSection.txt2Data,
+ m_image->colorSpace(),
text.textIndex,
&svg, &styles,
offset1, offsetByAscent,
diff --git a/plugins/impex/psd/tests/data/sources/cmyk-text-in-shape.psd b/plugins/impex/psd/tests/data/sources/cmyk-text-in-shape.psd
new file mode 100644
index 0000000000..30e21c4fd8
Binary files /dev/null and b/plugins/impex/psd/tests/data/sources/cmyk-text-in-shape.psd differ
diff --git a/plugins/impex/psd/tests/data/sources/gray-text-on-path.psd b/plugins/impex/psd/tests/data/sources/gray-text-on-path.psd
new file mode 100644
index 0000000000..0df6a6d2a3
Binary files /dev/null and b/plugins/impex/psd/tests/data/sources/gray-text-on-path.psd differ
diff --git a/plugins/impex/psd/tests/data/sources/lab-vertical-point-text.psd b/plugins/impex/psd/tests/data/sources/lab-vertical-point-text.psd
new file mode 100644
index 0000000000..6806fdcdfe
Binary files /dev/null and b/plugins/impex/psd/tests/data/sources/lab-vertical-point-text.psd differ
diff --git a/plugins/impex/psd/tests/data/sources/rgb-paragraph-text.psd b/plugins/impex/psd/tests/data/sources/rgb-paragraph-text.psd
new file mode 100644
index 0000000000..e360d2ff85
Binary files /dev/null and b/plugins/impex/psd/tests/data/sources/rgb-paragraph-text.psd differ
diff --git a/plugins/impex/psd/tests/data/sources/vector_mask.psd b/plugins/impex/psd/tests/data/sources/vector_mask.psd
new file mode 100644
index 0000000000..7a10cb356b
Binary files /dev/null and b/plugins/impex/psd/tests/data/sources/vector_mask.psd differ
diff --git a/plugins/impex/psd/tests/kis_psd_test.cpp b/plugins/impex/psd/tests/kis_psd_test.cpp
index e3ebf14669..31d4012045 100644
--- a/plugins/impex/psd/tests/kis_psd_test.cpp
+++ b/plugins/impex/psd/tests/kis_psd_test.cpp
@@ -25,6 +25,11 @@
#include <KisImportExportErrorCode.h>
#include <kis_generator_layer.h>
#include <kis_filter_configuration.h>
+#include <kis_transparency_mask.h>
+#include <kis_selection.h>
+#include <kis_shape_layer.h>
+#include <KoShape.h>
+#include <KoSvgTextShape.h>
#include <KisGlobalResourcesInterface.h>
@@ -48,6 +53,11 @@ void KisPSDTest::testFiles()
exclusions << "cmyk8-pantone_solid_coated_688c-L51_a33_b-8.psd";
exclusions << "pattern2_uncompressed.psd";
exclusions << "pattern4_rle.psd";
+ exclusions << "vector_mask.psd";
+ exclusions << "rgb-paragraph-text.psd";
+ exclusions << "cmyk-text-in-shape.psd";
+ exclusions << "lab-vertical-point-text.psd";
+ exclusions << "gray-text-on-path.psd";
TestUtil::testFiles(QString(FILES_DATA_DIR) + "/sources", exclusions, QString(), 2);
@@ -253,6 +263,97 @@ void KisPSDTest::testOpenFillLayers()
}
}
+void KisPSDTest::testLoadVectorMasks()
+{
+ QFileInfo sourceFileInfo(QString(FILES_DATA_DIR) + '/' + "sources/vector_mask.psd");
+ Q_ASSERT(sourceFileInfo.exists());
+
+ QSharedPointer<KisDocument> doc = openPsdDocument(sourceFileInfo);
+ QVERIFY(doc->image());
+
+ KisLayerSP layer = qobject_cast<KisLayer*>(doc->image()->root()->lastChild().data());
+ QVERIFY(layer);
+ QVERIFY(layer->firstChild());
+ QVERIFY(layer->firstChild()->inherits("KisTransparencyMask"));
+ KisTransparencyMaskSP mask = dynamic_cast<KisTransparencyMask*>(layer->firstChild().data());
+ QVERIFY(mask);
+ QVERIFY(mask->selection()->hasShapeSelection());
+}
+
+void KisPSDTest::testLoadText()
+{
+ qDebug() << "test rgb-paragraph-text.psd";
+ QFileInfo sourceFileInfo(QString(FILES_DATA_DIR) + '/' + "sources/rgb-paragraph-text.psd");
+ Q_ASSERT(sourceFileInfo.exists());
+
+ QSharedPointer<KisDocument> doc = openPsdDocument(sourceFileInfo);
+ QVERIFY(doc->image());
+ KisShapeLayerSP layer = qobject_cast<KisShapeLayer*>(doc->image()->root()->lastChild().data());
+ QVERIFY(layer);
+ QVERIFY(layer->shapes().size() == 1);
+ KoSvgTextShape *textShape = dynamic_cast<KoSvgTextShape*>(layer->shapes().first());
+ QVERIFY(textShape);
+ QVERIFY(textShape->shapesInside().size() > 0);
+
+ //TODO: Plain text contains (, \ and ), escaped, test salt.
+
+ //------ cmyk --------//
+
+ qDebug() << "test cmyk-text-in-shape.psd";
+
+ QFileInfo sourceFileInfo2(QString(FILES_DATA_DIR) + '/' + "sources/cmyk-text-in-shape.psd");
+ Q_ASSERT(sourceFileInfo2.exists());
+
+ doc = openPsdDocument(sourceFileInfo2);
+ QVERIFY(doc->image());
+ layer = qobject_cast<KisShapeLayer*>(doc->image()->root()->lastChild().data());
+ QVERIFY(layer);
+ QVERIFY(layer->shapes().size() == 1);
+ textShape = dynamic_cast<KoSvgTextShape*>(layer->shapes().first());
+ QVERIFY(textShape);
+ QVERIFY(textShape->shapesInside().size() > 0);
+
+ //TODO: test color, test shape, test text-transform:upper-case, test baseline-shift.
+
+ //------ lab --------//
+
+ // for some reason the lab one won't load, probably caused by 'incorrect profile?'
+ /*
+ qDebug() << "test lab-vertical-point-text.psd";
+
+ QFileInfo sourceFileInfo3(QString(FILES_DATA_DIR) + '/' + "sources/lab-vertical-point-text.psd");
+ Q_ASSERT(sourceFileInfo3.exists());
+
+ doc = openPsdDocument(sourceFileInfo3);
+ QVERIFY(doc->image());
+ layer = qobject_cast<KisShapeLayer*>(doc->image()->root()->lastChild().data());
+ QVERIFY(layer);
+ QVERIFY(layer->shapes().size() == 1);
+ textShape = dynamic_cast<KoSvgTextShape*>(layer->shapes().first());
+ QVERIFY(textShape);
+ QVERIFY(textShape->shapesInside().isEmpty());
+
+ //TODO: test vertical text, text-orientation and text-combine-upright as well as alignment baseline.
+ */
+ //----- gray -----//
+
+ qDebug() << "test gray-text-on-path.psd";
+
+ QFileInfo sourceFileInfo4(QString(FILES_DATA_DIR) + '/' + "sources/gray-text-on-path.psd");
+ Q_ASSERT(sourceFileInfo4.exists());
+
+ doc = openPsdDocument(sourceFileInfo4);
+ QVERIFY(doc->image());
+ layer = qobject_cast<KisShapeLayer*>(doc->image()->root()->lastChild().data());
+ QVERIFY(layer);
+ QVERIFY(layer->shapes().size() == 1);
+ textShape = dynamic_cast<KoSvgTextShape*>(layer->shapes().first());
+ QVERIFY(textShape);
+ QVERIFY(textShape->shapesInside().isEmpty());
+
+ //TODO: test text on path, color.
+}
+
void KisPSDTest::testOpenLayerStylesWithPattern()
{
QFileInfo sourceFileInfo(QString(FILES_DATA_DIR) + '/' + "test_ls_pattern.psd");
diff --git a/plugins/impex/psd/tests/kis_psd_test.h b/plugins/impex/psd/tests/kis_psd_test.h
index 287e0ba4fe..83d28fdb68 100644
--- a/plugins/impex/psd/tests/kis_psd_test.h
+++ b/plugins/impex/psd/tests/kis_psd_test.h
@@ -22,6 +22,9 @@ private Q_SLOTS:
void testOpenFillLayers();
+ void testLoadVectorMasks();
+ void testLoadText();
+
void testOpenLayerStylesWithPattern();
void testOpenLayerStylesWithPatternMulti();