test-bz131804.c revision 953daeba
1/*
2 * fontconfig/test/test-bz89617.c
3 *
4 * Copyright © 2000 Keith Packard
5 * Copyright © 2015 Akira TAGOH
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of the author(s) not be used in
12 * advertising or publicity pertaining to distribution of the software without
13 * specific, written prior permission.  The authors make no
14 * representations about the suitability of this software for any purpose.  It
15 * is provided "as is" without express or implied warranty.
16 *
17 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23 * PERFORMANCE OF THIS SOFTWARE.
24 */
25#include <stdio.h>
26#include <fontconfig/fontconfig.h>
27
28FcLangResult
29comp(const FcChar8 *l1, const FcChar8 *l2)
30{
31    FcLangSet *ls1, *ls2;
32    FcLangResult result;
33
34    ls1 = FcLangSetCreate();
35    ls2 = FcLangSetCreate();
36    FcLangSetAdd(ls1, l1);
37    FcLangSetAdd(ls2, l2);
38
39    result = FcLangSetCompare(ls1, ls2);
40    FcLangSetDestroy(ls1);
41    FcLangSetDestroy(ls2);
42
43    return result;
44}
45
46int
47main(void)
48{
49    FcLangResult result;
50    int i = 1;
51
52    /* 1 */
53    if (comp((const FcChar8 *)"ku-am", (const FcChar8 *)"ku-iq") != FcLangDifferentTerritory)
54	return i;
55    i++;
56    /* 2 */
57    if (comp((const FcChar8 *)"ku-am", (const FcChar8 *)"ku-ir") != FcLangDifferentTerritory)
58	return i;
59    i++;
60    /* 3 */
61    if (comp((const FcChar8 *)"ku-am", (const FcChar8 *)"ku-tr") != FcLangDifferentTerritory)
62	return i;
63    i++;
64    /* 4 */
65    if (comp((const FcChar8 *)"ku-iq", (const FcChar8 *)"ku-ir") != FcLangDifferentTerritory)
66	return i;
67    i++;
68    /* 5 */
69    if (comp((const FcChar8 *)"ku-iq", (const FcChar8 *)"ku-tr") != FcLangDifferentTerritory)
70	return i;
71    i++;
72    /* 6 */
73    if (comp((const FcChar8 *)"ku-ir", (const FcChar8 *)"ku-tr") != FcLangDifferentTerritory)
74	return i;
75    i++;
76    /* 7 */
77    if (comp((const FcChar8 *)"ps-af", (const FcChar8 *)"ps-pk") != FcLangDifferentTerritory)
78	return i;
79    i++;
80    /* 8 */
81    if (comp((const FcChar8 *)"ti-er", (const FcChar8 *)"ti-et") != FcLangDifferentTerritory)
82	return i;
83    i++;
84    /* 9 */
85    if (comp((const FcChar8 *)"zh-cn", (const FcChar8 *)"zh-hk") != FcLangDifferentTerritory)
86	return i;
87    i++;
88    /* 10 */
89    if (comp((const FcChar8 *)"zh-cn", (const FcChar8 *)"zh-mo") != FcLangDifferentTerritory)
90	return i;
91    i++;
92    /* 11 */
93    if (comp((const FcChar8 *)"zh-cn", (const FcChar8 *)"zh-sg") != FcLangDifferentTerritory)
94	return i;
95    i++;
96    /* 12 */
97    if (comp((const FcChar8 *)"zh-cn", (const FcChar8 *)"zh-tw") != FcLangDifferentTerritory)
98	return i;
99    i++;
100    /* 13 */
101    if (comp((const FcChar8 *)"zh-hk", (const FcChar8 *)"zh-mo") != FcLangDifferentTerritory)
102	return i;
103    i++;
104    /* 14 */
105    if (comp((const FcChar8 *)"zh-hk", (const FcChar8 *)"zh-sg") != FcLangDifferentTerritory)
106	return i;
107    i++;
108    /* 15 */
109    if (comp((const FcChar8 *)"zh-hk", (const FcChar8 *)"zh-tw") != FcLangDifferentTerritory)
110	return i;
111    i++;
112    /* 16 */
113    if (comp((const FcChar8 *)"zh-mo", (const FcChar8 *)"zh-sg") != FcLangDifferentTerritory)
114	return i;
115    i++;
116    /* 17 */
117    if (comp((const FcChar8 *)"zh-mo", (const FcChar8 *)"zh-tw") != FcLangDifferentTerritory)
118	return i;
119    i++;
120    /* 18 */
121    if (comp((const FcChar8 *)"zh-sg", (const FcChar8 *)"zh-tw") != FcLangDifferentTerritory)
122	return i;
123    i++;
124    /* 19 */
125    if (comp((const FcChar8 *)"mn-mn", (const FcChar8 *)"mn-cn") != FcLangDifferentTerritory)
126	return i;
127    i++;
128    /* 20 */
129    if (comp((const FcChar8 *)"pap-an", (const FcChar8 *)"pap-aw") != FcLangDifferentTerritory)
130	return i;
131    i++;
132
133    return 0;
134}
135
136
137