convert to markdown

This commit is contained in:
Miguel Jacq 2025-11-08 17:29:36 +11:00
parent 31604a0cd2
commit 6a9d2c4bcc
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
54 changed files with 1616 additions and 4012 deletions

44
tests/test_toolbar.py Normal file
View file

@ -0,0 +1,44 @@
import pytest
from PySide6.QtWidgets import QWidget
from bouquin.markdown_editor import MarkdownEditor
from bouquin.theme import ThemeManager, ThemeConfig, Theme
@pytest.fixture
def editor(app, qtbot):
themes = ThemeManager(app, ThemeConfig(theme=Theme.LIGHT))
ed = MarkdownEditor(themes)
qtbot.addWidget(ed)
ed.show()
return ed
from bouquin.toolbar import ToolBar
@pytest.mark.gui
def test_toolbar_signals_and_styling(qtbot, editor):
host = QWidget()
qtbot.addWidget(host)
host.show()
tb = ToolBar(parent=host)
qtbot.addWidget(tb)
tb.show()
tb.boldRequested.connect(editor.apply_weight)
tb.italicRequested.connect(editor.apply_italic)
tb.strikeRequested.connect(editor.apply_strikethrough)
tb.codeRequested.connect(lambda: editor.apply_code())
tb.headingRequested.connect(lambda s: editor.apply_heading(s))
tb.bulletsRequested.connect(lambda: editor.toggle_bullets())
tb.numbersRequested.connect(lambda: editor.toggle_numbers())
tb.checkboxesRequested.connect(lambda: editor.toggle_checkboxes())
editor.from_markdown("hello")
editor.selectAll()
tb.boldRequested.emit()
tb.italicRequested.emit()
tb.strikeRequested.emit()
tb.headingRequested.emit(24)
assert editor.to_markdown()