Exemplo n.º 1
0
void TestText::testDropUnicodeAfterSMUFLwhenCursorSetToSymbol()
      {
      Text* text = new Text(score);
      text->initSubStyle(SubStyle::DYNAMICS);
      text->setPlainText(QString(""));
      text->layout();
      text->startEdit(editData);

      Symbol* symbolSMUFL = new Symbol(score); // create a new element, as Measure::drop() will eventually delete it
      symbolSMUFL->setSym(SymId::noteheadWhole);

      EditData dropSMUFL;
      dropSMUFL.dropElement = symbolSMUFL;
      text->drop(dropSMUFL);

      // the bug happened when cursor is in symbol mode
      CharFormat* cf = text->cursor()->format();
      cf->setType(CharFormatType::SYMBOL);

      EditData dropFSymbol;
      FSymbol* fsymbol = new FSymbol(score);
      fsymbol->setCode(0x0001D10E); // unicode hex code for '𝄎'
      dropFSymbol.dropElement = fsymbol;
      text->drop(dropFSymbol);

      text->endEdit(editData);
      QCOMPARE(text->xmlText(), QString("<sym>noteheadWhole</sym>𝄎"));
      }
Exemplo n.º 2
0
static QString charFormat2QString(const CharFormat& f)
      {
      return QString("b %1 i %2 u %3 va %4 fs %5 fam %6")
            .arg(f.bold())
            .arg(f.italic())
            .arg(f.underline())
            .arg(static_cast<int>(f.valign()))
            .arg(f.fontSize())
            .arg(f.fontFamily())
                 ;
      }
Exemplo n.º 3
0
void TextTools::updateTools(EditData& ed)
      {
      text   = toText(ed.element);
      cursor = text->cursor(ed);
      blockAllSignals(true);
      CharFormat* format = cursor->format();

      QFont f(format->fontFamily());
      typefaceFamily->setCurrentFont(f);
      typefaceFamily->setEnabled(true);
      typefaceSize->setValue(format->fontSize());

      typefaceItalic->setChecked(format->italic());
      typefaceBold->setChecked(format->bold());
      typefaceUnderline->setChecked(format->underline());
      typefaceSubscript->setChecked(format->valign() == VerticalAlignment::AlignSubScript);
      typefaceSuperscript->setChecked(format->valign() == VerticalAlignment::AlignSuperScript);

      blockAllSignals(false);
      }
Exemplo n.º 4
0
void TextTools::updateTools()
      {
      if (!_textElement->editMode())
            qFatal("TextTools::updateTools(): not in edit mode");
      blockAllSignals(true);
      TextCursor* cursor = _textElement->cursor();
      CharFormat* format = cursor->format();

      QFont f(format->fontFamily());
      typefaceFamily->setCurrentFont(f);
      typefaceFamily->setEnabled(cursor->format()->type() == CharFormatType::TEXT);
      typefaceSize->setValue(format->fontSize());

      typefaceItalic->setChecked(format->italic());
      typefaceBold->setChecked(format->bold());
      typefaceUnderline->setChecked(format->underline());
      typefaceSubscript->setChecked(format->valign() == VerticalAlignment::AlignSubScript);
      typefaceSuperscript->setChecked(format->valign() == VerticalAlignment::AlignSuperScript);

      blockAllSignals(false);
      }