Clicked text on its baseline, live text on the Move tool's double click, SVG import (12.11c)
This commit is contained in:
1 parent
008493b0a3
commit
8fbb104c48
34 files changed
+572
-47
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "SelectionCanvasFixtures.h"
|
||||
#include "Rendering/TextLayout.h"
|
||||
#include <QInputMethodEvent>
|
||||
|
||||
// Shared by the inline editor's key and input tests.
|
||||
@@ -11,7 +12,7 @@ struct TextCanvas : Canvas {
|
||||
QObject::connect(&session, &EditorSession::changed, canvas, [this] { canvas->synchronizeDisplay(); });
|
||||
session.addBlankLayer();
|
||||
session.selectTool(NavigationTool::type);
|
||||
session.beginText(QPointF(20, 30), true);
|
||||
beginTextAt(session, QPointF(20, 30));
|
||||
}
|
||||
InlineTextEditor &editor() const
|
||||
{
|
||||
@@ -20,6 +21,12 @@ struct TextCanvas : Canvas {
|
||||
return *canvas->inlineTextEditor();
|
||||
}
|
||||
QString content() const { return session.textDraft().value().style.content; }
|
||||
// Where a click puts new text's corner: baseline at it.
|
||||
QPointF clickedCorner(QPointF point) const
|
||||
{
|
||||
const double padding = LayerTextStyle::padding;
|
||||
return point - QPointF(padding, padding + TextLines(session.textDraft().value().style, QSizeF(100'000, 100'000)).baseline(0));
|
||||
}
|
||||
int caret() const { return editor().caretPosition(); }
|
||||
void key(Qt::Key key, Qt::KeyboardModifiers modifiers = Qt::NoModifier) { QTest::keyClick(canvas, key, modifiers); }
|
||||
void type(const QString &text) { QTest::keyClicks(canvas, text); }
|
||||
|
||||
Reference in new issue
Block a user