def test_rtl_nested_inline(assert_pixels):
    assert_pixels('''
        RRRRR________________BBBBB___________RRRRR___________BBBBB
        RRRRR________________BBBBB___________RRRRR___________BBBBB
        RRRRR________________BBBBB___________RRRRR___________BBBBB
        RRRRR________________BBBBB___________RRRRR___________BBBBB
        RRRRRRRRRR______BBBBBBBBBB______RRRRRRRRRR______BBBBBBBBBB
        ______________________________________BBBBB__________RRRRR
        ______________________________________BBBBB__________RRRRR
        ______________________________________BBBBB__________RRRRR
        ______________________________________BBBBB__________RRRRR
        _________________________________BBBBBBBBBB_____RRRRRRRRRR
    ''', '''
      <style>
        @page { size: 58px 10px }
        body { font-family: weasyprint; color: blue; font-size: 5px; line-height: 1 }
        span { color: red }
      </style>
      <div style="direction: rtl; text-align: justify">
        اب <span>اب</span> اب <span>با اب</span> اب
      </div>
    ''')
,
tests/draw/test_text.py