本文整理汇总了C++中KateView::action方法的典型用法代码示例。如果您正苦于以下问题:C++ KateView::action方法的具体用法?C++ KateView::action怎么用?C++ KateView::action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KateView
的用法示例。
在下文中一共展示了KateView::action方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testFolding_py_lang
void KateFoldingTest::testFolding_py_lang()
{
KTemporaryFile file;
file.setSuffix(".py");
file.open();
QTextStream stream(&file);
stream << "if customerName == x\n"
<< " print x\n"
<< "elif customerName == y\n"
<< " print y\n"
<< "else print z\n";
stream << flush;
file.close();
KateDocument doc(false, false, false);
QVERIFY(doc.openUrl(KUrl(file.fileName())));
KateView* view = new KateView(&doc, 0);
// is set to allow kate's hl to be called
view->config()->setDynWordWrap(true);
QCOMPARE(doc.visibleLines(), 6u);
QAction* action = view->action("folding_toplevel");
QVERIFY(action);
action->trigger();
QCOMPARE(doc.visibleLines(), 4u);
action = view->action("folding_expandtoplevel");
QVERIFY(action);
action->trigger();
QCOMPARE(doc.visibleLines(), 6u);
}
示例2: testFolding_collapse_expand_local
void KateFoldingTest::testFolding_collapse_expand_local()
{
KTemporaryFile file;
file.setSuffix(".c");
file.open();
QTextStream stream(&file);
stream << "if () {\n"
<< " if () {\n"
<< " if () {\n"
<< " if () {\n"
<< " }\n"
<< " }\n"
<< " }\n"
<< " if () {\n"
<< " foo()\n"
<< " }\n"
<< " }\n";
stream << flush;
file.close();
KateDocument doc(false, false, false);
QVERIFY(doc.openUrl(KUrl(file.fileName())));
KateView* view = new KateView(&doc, 0);
// is set to allow kate's hl to be called
view->config()->setDynWordWrap(true);
QCOMPARE(doc.visibleLines(), 12u);
view->setCursorPosition(KTextEditor::Cursor(2,12));
QAction* action = view->action("folding_collapselocal");
QVERIFY(action);
action->trigger();
QCOMPARE(doc.visibleLines(), 9u);
view->setCursorPosition(KTextEditor::Cursor(2,11));
action = view->action("folding_collapselocal");
QVERIFY(action);
action->trigger();
QCOMPARE(doc.visibleLines(), 7u);
view->setCursorPosition(KTextEditor::Cursor(1,9));
action = view->action("folding_expandlocal");
QVERIFY(action);
action->trigger();
QCOMPARE(doc.visibleLines(), 9u);
}
示例3: testFolding_collapse_dsComments_XML
void KateFoldingTest::testFolding_collapse_dsComments_XML()
{
KTemporaryFile file;
file.setSuffix(".xml");
file.open();
QTextStream stream(&file);
stream << "<test1>\n"
<< "</test1>\n"
<< "<!--\n"
<< "<test2>\n"
<< "</test2>\n"
<< "-->\n"
<< "<!--\n"
<< "-->\n";
stream << flush;
file.close();
KateDocument doc(false, false, false);
QVERIFY(doc.openUrl(KUrl(file.fileName())));
KateView* view = new KateView(&doc, 0);
// is set to allow kate's hl to be called
view->config()->setDynWordWrap(true);
QCOMPARE(doc.visibleLines(), 9u);
QAction* action = view->action("folding_collapse_dsComment");
QVERIFY(action);
action->trigger();
QCOMPARE(doc.visibleLines(), 5u);
}
示例4: testFolding
void KateFoldingTest::testFolding()
{
QFETCH(QString, text);
QFETCH(QString, fileExt);
QFETCH(QString, firstActionName);
QFETCH(QString, secondActionName);
QFETCH(unsigned int, initValue);
QFETCH(unsigned int, firstResult);
QFETCH(unsigned int, secondResult);
KTemporaryFile file;
file.setSuffix("." + fileExt);
file.open();
QTextStream stream(&file);
stream << text;
stream << flush;
file.close();
KateDocument doc(false, false, false);
QVERIFY(doc.openUrl(KUrl(file.fileName())));
KateView* view = new KateView(&doc, 0);
QAction* firstAction = view->action(qPrintable(firstActionName));
QVERIFY(firstAction);
QAction* secondAction = view->action(qPrintable(secondActionName));
QVERIFY(secondAction);
// is set to allow kate's hl to be called
view->config()->setDynWordWrap(true);
QCOMPARE(doc.visibleLines(), initValue);
firstAction->trigger();
QCOMPARE(doc.visibleLines(), firstResult);
secondAction->trigger();
QCOMPARE(doc.visibleLines(), secondResult);
}
示例5: testFoldingReload
void KateFoldingTest::testFoldingReload()
{
KTemporaryFile file;
file.setSuffix(".cpp");
file.open();
QTextStream stream(&file);
stream << "int main() {\n"
<< " asdf;\n"
<< "}\n";
stream << flush;
file.close();
KateDocument doc(false, false, false);
QVERIFY(doc.openUrl(KUrl(file.fileName())));
KateView* view = new KateView(&doc, 0);
// is set to allow kate's hl to be called
view->config()->setDynWordWrap(true);
QCOMPARE(doc.visibleLines(), 4u);
QAction* action = view->action("folding_toplevel");
QVERIFY(action);
action->trigger();
doc.foldingTree()->saveFoldingState();
QList<int> hiddenLines(doc.foldingTree()->m_hiddenLines);
QList<int> hiddenColumns(doc.foldingTree()->m_hiddenColumns);
QCOMPARE(doc.visibleLines(), 2u);
action = view->action("file_reload");
QVERIFY(action);
action->trigger();
QCOMPARE(doc.visibleLines(), 2u);
QCOMPARE(hiddenLines,doc.foldingTree()->m_hiddenLines);
QCOMPARE(hiddenColumns,doc.foldingTree()->m_hiddenColumns);
}