~ubuntu-branches/debian/jessie/liblouis/jessie

« back to all changes in this revision

Viewing changes to tests/present_progressive.c

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Thibault
  • Date: 2010-01-12 23:48:47 UTC
  • mto: (1.1.4 upstream) (5.2.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100112234847-ph9xdk3lrjdox6ks
ImportĀ upstreamĀ versionĀ 1.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <string.h>
 
3
#include <stdlib.h>
 
4
#include "brl_checks.h"
 
5
 
 
6
/* Note that this test used to fail worse than it does now. The
 
7
   current situation isn't hugely critical, though probably still
 
8
   incorrect.
 
9
 
 
10
   There are two key portions of the string: the "ing" (which gets
 
11
   contracted to one character) and the double space at the end. When
 
12
   translated, you get: "greetings " -> "greet+s " Notice that the
 
13
   translation also contracts the double space into a single space.
 
14
 
 
15
   With regard to cursor position, compbrlAtCursor is set, which means
 
16
   that the word encompassed by the cursor will be uncontracted
 
17
   (computer braille). This means that if the cursor is anywhere
 
18
   within "greetings", the translated output will also be "greetings",
 
19
   so the cursor positions are identical up to the end of the s
 
20
   (position 8).
 
21
 
 
22
   It gets more interesting at position 9 (the first space). Now,
 
23
   greetings gets contracted, so the output cursor position becomes 7.
 
24
   Still correct so far.
 
25
 
 
26
   Position 10 (the second space) is the problem. Because
 
27
   compbrlAtCursor is set, the current word should probably be
 
28
   expanded. In this case, it is just a space. However, the two spaces
 
29
   are still compressed into one, even though the second should have
 
30
   been expanded. The translation has still contracted the second
 
31
   space, even though it should have stopped contracting at the
 
32
   cursor.
 
33
 
 
34
   See also the description in
 
35
   http://code.google.com/p/liblouis/issues/detail?id=4
 
36
*/
 
37
 
 
38
int
 
39
main (int argc, char **argv)
 
40
{
 
41
        const char *str2 = "greetings  ";
 
42
        const int expected_pos2[]={0,1,2,3,4,5,6,7,8,7,8};
 
43
 
 
44
        return check_cursor_pos(str2, expected_pos2);      
 
45
}