File: test_non_latin_font_size_increase.py

package info (click to toggle)
mnemosyne 2.7.3%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,804 kB
  • sloc: python: 34,077; ansic: 837; xml: 625; makefile: 249; sh: 63
file content (63 lines) | stat: -rwxr-xr-x 3,020 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
# test_non_latin_font_size_increase.py <Peter.Bienstman@UGent.be>
#

from mnemosyne_test import MnemosyneTest
from mnemosyne.libmnemosyne.filters.escape_to_html import EscapeToHtml

    
class TestNonLatinFontSizeIncrease(MnemosyneTest):

    def test_1(self):
        fact_data = {"f": "question " + chr(40960),
                     "b": "answer"}
        card_type = self.card_type_with_id("1")
        card = self.controller().create_new_cards(fact_data, card_type,
                                              grade=-1, tag_names=[])[0]

        self.config()["non_latin_font_size_increase"] = 2
        assert """<font style=\"font-size:14pt\">""" + chr(40960) + "</font>" in card.question()
        
    def test_2(self):
        fact_data = {"f": "<protect>question " + chr(40960) + "</protect>",
                     "b": "answer"}
        card_type = self.card_type_with_id("1")
        card = self.controller().create_new_cards(fact_data, card_type,
                                              grade=-1, tag_names=[])[0]

        self.config()["non_latin_font_size_increase"] = 2
        assert """<font style=\"font-size:14pt\">""" + chr(40960) + "</font>" not in card.question()

    def test_3(self):
        fact_data = {"f": "question " + chr(40960),
                     "p_1": "",
                     "m_1": "answer"}
        card_type = self.card_type_with_id("3")
        card = self.controller().create_new_cards(fact_data, card_type,
                                              grade=-1, tag_names=[])[0]
        self.config()["non_latin_font_size_increase"] = 2
        assert """<font style=\"font-size:14pt\">""" + chr(40960) + "</font>" not in card.question()
        assert """<font style=\"font-size:14pt\">""" + chr(40960) + "</font>" not in card.answer()
        
    def test_4(self):
        fact_data = {"f": "question " + chr(40960),
                     "m_1": "answer"}
        card_type = self.card_type_with_id("3")
        self.controller().clone_card_type(card_type, "my_3")
        card_type = self.card_type_with_id("3::my_3")
        card = self.controller().create_new_cards(fact_data, card_type,
                                              grade=-1, tag_names=[])[0]

        self.config()["non_latin_font_size_increase"] = 2
        assert """<font style=\"font-size:14pt\">""" + chr(40960) + "</font>" not in card.question()
        assert """<font style=\"font-size:14pt\">""" + chr(40960) + "</font>" not in card.answer()
        
    def test_5(self):
        fact_data = {"f": "question " + chr(40960) + "tail",
                     "b": "answer"}
        card_type = self.card_type_with_id("1")
        card = self.controller().create_new_cards(fact_data, card_type,
                                              grade=-1, tag_names=[])[0]

        self.config()["non_latin_font_size_increase"] = 2
        assert """<font style=\"font-size:14pt\">""" + chr(40960) + "</font>" in card.question()