From eff9c749b24b88cc685c5a3aea585c47c845daf7 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 29 Oct 2015 14:02:49 +0100 Subject: [PATCH] [test] Add tests for language selection --- test/test_compilation/languages.sb | 3 + test/test_compilation/languages.tex.control | 195 ++++++++++++++++++ .../languages_datadir/songs/language.sgc | 4 + .../songs/language_location.sgc | 4 + .../languages_datadir/songs/no_language.sgc | 3 + .../songs/wrong_language.sgc | 4 + .../songs/wrong_location.sgc | 4 + 7 files changed, 217 insertions(+) create mode 100644 test/test_compilation/languages.sb create mode 100644 test/test_compilation/languages.tex.control create mode 100644 test/test_compilation/languages_datadir/songs/language.sgc create mode 100644 test/test_compilation/languages_datadir/songs/language_location.sgc create mode 100644 test/test_compilation/languages_datadir/songs/no_language.sgc create mode 100644 test/test_compilation/languages_datadir/songs/wrong_language.sgc create mode 100644 test/test_compilation/languages_datadir/songs/wrong_location.sgc diff --git a/test/test_compilation/languages.sb b/test/test_compilation/languages.sb new file mode 100644 index 00000000..e0c55f92 --- /dev/null +++ b/test/test_compilation/languages.sb @@ -0,0 +1,3 @@ +{ +"datadir": ["languages_datadir"] +} diff --git a/test/test_compilation/languages.tex.control b/test/test_compilation/languages.tex.control new file mode 100644 index 00000000..ae172dae --- /dev/null +++ b/test/test_compilation/languages.tex.control @@ -0,0 +1,195 @@ + + + + + + +%% Automatically generated document. +%% You may edit this file but all changes will be overwritten. +%% If you want to change this document, have a look at +%% the templating system. +%% +%% Generated using Songbook + +\makeatletter +\def\input@path{ % + {/home/louis/projets/patacrep/patacrep/test/test_compilation/languages_datadir/latex/} % + {/home/louis/projets/patacrep/patacrep/test/test_compilation/latex/} % + {/home/louis/projets/patacrep/patacrep/patacrep/data/latex/} % +} +\makeatother + +\documentclass[ + ]{article} + +\usepackage[ + chorded, +diagram, +pictures, +guitar, + ]{patacrep} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern} + + +\PassOptionsToPackage{english}{babel} +\PassOptionsToPackage{spanish}{babel} +\PassOptionsToPackage{french}{babel} +\PassOptionsToPackage{english}{babel} +\usepackage[english]{babel} +\lang{english} + +\usepackage{graphicx} +\graphicspath{ % + {/home/louis/projets/patacrep/patacrep/test/test_compilation/languages_datadir/} % + {/home/louis/projets/patacrep/patacrep/test/test_compilation/} % + {/home/louis/projets/patacrep/patacrep/patacrep/data/} % +} + + +\makeatletter +\@ifpackageloaded{hyperref}{}{ + \usepackage{url} + \newcommand{\phantomsection}{} + \newcommand{\hyperlink}[2]{#2} + \newcommand{\href}[2]{\expandafter\url\expandafter{#1}} +} +\makeatother + + +\usepackage{chords} + +\title{Guitar songbook} +\author{The Patacrep Team} + +\newindex{titleidx}{languages_title} +\newauthorindex{authidx}{languages_auth} + + +\notenamesout{A}{B}{C}{D}{E}{F}{G} + + +\begin{document} + +\maketitle + + +\showindex{\songindexname}{titleidx} +\showindex{\authorindexname}{authidx} + +% list of chords +\ifchorded + \ifdiagram + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords + \fi +\fi + +\phantomsection +\addcontentsline{toc}{section}{\songlistname} + +\begin{songs}{titleidx,authidx} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% songs/./language.sgc + +\selectlanguage{english} + +\beginsong{Language only}[ + by={ + }, +] + + + + +\begin{verse} + Foo +\end{verse} + +\endsong + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% songs/./language_location.sgc + +\selectlanguage{french} + +\beginsong{Full language specification}[ + by={ + }, +] + + + + +\begin{verse} + Foo +\end{verse} + +\endsong + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% songs/./no_language.sgc + +\selectlanguage{english} + +\beginsong{No language}[ + by={ + }, +] + + + + +\begin{verse} + Foo +\end{verse} + +\endsong + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% songs/./wrong_language.sgc + +\selectlanguage{english} + +\beginsong{Wrong language}[ + by={ + }, +] + + + + +\begin{verse} + Foo +\end{verse} + +\endsong + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% songs/./wrong_location.sgc + +\selectlanguage{spanish} + +\beginsong{Wrong location}[ + by={ + }, +] + + + + +\begin{verse} + Foo +\end{verse} + +\endsong + +\end{songs} + + + + +\end{document} \ No newline at end of file diff --git a/test/test_compilation/languages_datadir/songs/language.sgc b/test/test_compilation/languages_datadir/songs/language.sgc new file mode 100644 index 00000000..88dc3b23 --- /dev/null +++ b/test/test_compilation/languages_datadir/songs/language.sgc @@ -0,0 +1,4 @@ +{title : Language only} +{lang: en} + +Foo diff --git a/test/test_compilation/languages_datadir/songs/language_location.sgc b/test/test_compilation/languages_datadir/songs/language_location.sgc new file mode 100644 index 00000000..93fa6b52 --- /dev/null +++ b/test/test_compilation/languages_datadir/songs/language_location.sgc @@ -0,0 +1,4 @@ +{title : Full language specification} +{lang: fr_FR} + +Foo diff --git a/test/test_compilation/languages_datadir/songs/no_language.sgc b/test/test_compilation/languages_datadir/songs/no_language.sgc new file mode 100644 index 00000000..1f996c6d --- /dev/null +++ b/test/test_compilation/languages_datadir/songs/no_language.sgc @@ -0,0 +1,3 @@ +{title : No language} + +Foo diff --git a/test/test_compilation/languages_datadir/songs/wrong_language.sgc b/test/test_compilation/languages_datadir/songs/wrong_language.sgc new file mode 100644 index 00000000..a196c14f --- /dev/null +++ b/test/test_compilation/languages_datadir/songs/wrong_language.sgc @@ -0,0 +1,4 @@ +{title : Wrong language} +{lang: xx_XX} + +Foo diff --git a/test/test_compilation/languages_datadir/songs/wrong_location.sgc b/test/test_compilation/languages_datadir/songs/wrong_location.sgc new file mode 100644 index 00000000..c0c3d9e9 --- /dev/null +++ b/test/test_compilation/languages_datadir/songs/wrong_location.sgc @@ -0,0 +1,4 @@ +{title : Wrong location} +{lang: es_XX} + +Foo