Пример #1
0
def test_simple(qilinguist_action, record_messages):
    """ Test Simple """
    build_worktree = TestBuildWorkTree()
    build_worktree.add_test_project("translateme/qt")
    qilinguist_action("list")
    assert record_messages.find("\\*\\s+helloqt")
    assert record_messages.find("\\*\\s+translate")
Пример #2
0
def test_qt(qilinguist_action):
    build_worktree = TestBuildWorkTree()
    project = build_worktree.add_test_project("translateme/qt")
    try:
        project.configure()
    except Exception:
        print "Qt not installed, skipping"
        return
    project.build()
    qilinguist_action("update", "helloqt")
    # Translate in French:
    fr_ts = os.path.join(project.path, "po", "fr_FR.ts")
    tree = qisys.qixml.read(fr_ts)
    root = tree.getroot()
    tr_elem = root.find("context/message/translation")
    assert tr_elem is not None
    tr_elem.attrib.clear()
    tr_elem.text = "Bonjour, monde"
    qisys.qixml.write(root, fr_ts)
    qilinguist_action("release", "helloqt")
    translateme = qibuild.find.find([project.sdk_directory], "translateme")
    cmd = [translateme,
           os.path.join(project.path, "po"),
           "fr_FR"]
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    (out, _) = process.communicate()

    assert "Bonjour, monde" in out
Пример #3
0
def test_qt(qilinguist_action):
    """ Test Qt """
    build_worktree = TestBuildWorkTree()
    project = build_worktree.add_test_project("translateme/qt")
    try:
        project.configure()
    except Exception:
        print("Qt not installed, skipping")
        return
    project.build()
    qilinguist_action("update", "helloqt")
    # Translate in French:
    fr_ts = os.path.join(project.path, "po", "fr_FR.ts")
    tree = qisys.qixml.read(fr_ts)
    root = tree.getroot()
    tr_elem = root.find("context/message/translation")
    assert tr_elem is not None
    tr_elem.attrib.clear()
    tr_elem.text = "Bonjour, monde"
    qisys.qixml.write(root, fr_ts)
    qilinguist_action("release", "helloqt")
    translateme = qibuild.find.find([project.sdk_directory], "translateme")
    cmd = [translateme, os.path.join(project.path, "po"), "fr_FR"]
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    (out, _) = process.communicate()
    assert "Bonjour, monde" in out
def test_non_translated_messages_qt(qilinguist_action):
    """ Test Non Translated Massages Qt """
    build_worktree = TestBuildWorkTree()
    _project = build_worktree.add_test_project("translateme/qt")
    qilinguist_action("update", "helloqt")
    qilinguist_action("release", "helloqt", raises=True)
Пример #5
0
def test_non_translated_messages_qt(qilinguist_action):
    build_worktree = TestBuildWorkTree()
    project = build_worktree.add_test_project("translateme/qt")
    qilinguist_action("update", "helloqt")
    qilinguist_action("release", "helloqt", raises=True)