38DEFINE_GUID(
GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
40static const WCHAR sysW[] = {
'S',
'y',
's',
't',
'e',
'm',0};
42#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
47 rc = IUnknown_Release(
obj);
48 ok_(__FILE__,
line)(rc ==
ref,
"expected refcount %d, got %d\n",
ref, rc);
95 IRichEditOle_QueryInterface(*reOle, &IID_ITextDocument,
97 ITextDocument_GetSelection(*txtDoc, txtSel);
104 ITextSelection_Release(*txtSel);
105 ITextDocument_Release(*txtDoc);
106 IRichEditOle_Release(*reOle);
112 IUnknown_AddRef(iface);
113 return IUnknown_Release(iface);
116#define CHECK_TYPEINFO(disp,expected_riid) _check_typeinfo((IDispatch *)disp, expected_riid, __LINE__)
125 hr = IDispatch_GetTypeInfoCount(disp, &
count);
126 ok_(__FILE__,
line)(
hr ==
S_OK,
"IDispatch_GetTypeInfoCount failed: 0x%08x.\n",
hr);
130 ok_(__FILE__,
line)(
hr ==
S_OK,
"IDispatch_GetTypeInfo failed: 0x%08x.\n",
hr);
132 hr = ITypeInfo_GetTypeAttr(
typeinfo, &typeattr);
133 ok_(__FILE__,
line)(
hr ==
S_OK,
"ITypeInfo_GetTypeAttr failed: 0x%08x.\n",
hr);
137 ITypeInfo_ReleaseTypeAttr(
typeinfo, typeattr);
155 skip(
"Couldn't create window\n");
160 ok(
res,
"SendMessage\n");
161 ok(reOle !=
NULL,
"EM_GETOLEINTERFACE\n");
165 ok(
res == 1,
"SendMessage\n");
166 ok(reOle1 == reOle,
"Should not return a new IRichEditOle interface\n");
169 hres = IRichEditOle_QueryInterface(reOle, &IID_ITextDocument,
171 ok(
hres ==
S_OK,
"IRichEditOle_QueryInterface\n");
172 ok(txtDoc !=
NULL,
"IRichEditOle_QueryInterface\n");
175 hres = ITextDocument_GetSelection(txtDoc,
NULL);
180 hres = ITextDocument_GetSelection(txtDoc, &txtSel);
186 hres = ITextDocument_GetSelection(txtDoc, &txtSel2);
188 ok(txtSel2 == txtSel,
"got %p, %p\n", txtSel, txtSel2);
193 ITextSelection_Release(txtSel2);
196 hres = ITextSelection_QueryInterface(txtSel, &IID_ITextSelection, (
void **) &punk);
197 ok(
hres ==
S_OK,
"ITextSelection_QueryInterface\n");
198 ok(punk !=
NULL,
"ITextSelection_QueryInterface\n");
199 IUnknown_Release(punk);
202 hres = ITextSelection_QueryInterface(txtSel, &IID_ITextRange, (
void **) &punk);
203 ok(
hres ==
S_OK,
"ITextSelection_QueryInterface\n");
204 ok(punk !=
NULL,
"ITextSelection_QueryInterface\n");
205 IUnknown_Release(punk);
209 ok(
hres ==
S_OK,
"ITextSelection_QueryInterface\n");
210 ok(punk !=
NULL,
"ITextSelection_QueryInterface\n");
211 IUnknown_Release(punk);
225 hres = IRichEditOle_QueryInterface(reOle, &IID_ITextDocument2Old, (
void **)&txtDoc2Old);
226 ok(
hres ==
S_OK,
"IRichEditOle_QueryInterface\n");
227 ok(txtDoc2Old !=
NULL,
"IRichEditOle_QueryInterface\n");
228 ok((
ITextDocument *)txtDoc2Old == txtDoc,
"interface pointer isn't equal.\n");
233 ITextDocument2Old_Release(txtDoc2Old);
235 ITextDocument_Release(txtDoc);
236 IRichEditOle_Release(reOle);
237 refcount = IRichEditOle_Release(reOle);
238 ok(refcount == 1,
"got wrong ref count: %d\n", refcount);
243 hres = ITextSelection_CanEdit(txtSel,
NULL);
246 ITextSelection_Release(txtSel);
250 ok(
res,
"SendMessage\n");
251 ok(reOle !=
NULL,
"EM_GETOLEINTERFACE\n");
253 hres = IRichEditOle_QueryInterface(reOle, &IID_ITextDocument2Old, (
void **)&txtDoc2Old);
254 ok(
hres ==
S_OK,
"IRichEditOle_QueryInterface failed: 0x%08x.\n",
hres);
255 ok(txtDoc2Old !=
NULL,
"IRichEditOle_QueryInterface\n");
257 ITextDocument2Old_Release(txtDoc2Old);
258 IRichEditOle_Release(reOle);
274 static const CHAR chACP[] =
"TestSomeText";
275 static const CHAR chUTF8[] =
"\xef\xbb\xbfTextWithUTF8BOM";
276 static const WCHAR chUTF16[] = {0xfeff,
'T',
'e',
's',
't',
'S',
'o',
'm',
277 'e',
'T',
'e',
'x',
't', 0};
279#define MAX_BUF_LEN 1024
283 static const int tomConstantsSingle[] =
290 static const int tomConstantsMulti[] =
300 int tomNumSingle =
ARRAY_SIZE(tomConstantsSingle);
301 int tomNumMulti =
ARRAY_SIZE(tomConstantsMulti);
307 for(
i=0;
i < tomNumSingle;
i++)
311 hres = ITextDocument_Open(txtDoc, &testfile, tomConstantsSingle[
i],
CP_ACP);
312 todo_wine ok(
hres ==
S_OK,
"ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_ACP hres:0x%x\n",
313 tomConstantsSingle[
i],
hres);
319 hres = ITextDocument_Open(txtDoc, &testfile, tomConstantsSingle[
i],
CP_UTF8);
320 todo_wine ok(
hres ==
S_OK,
"ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_UTF8 hres:0x%x\n",
321 tomConstantsSingle[
i],
hres);
326 for(
i=0;
i < tomNumMulti;
i++)
330 hres = ITextDocument_Open(txtDoc, &testfile, tomConstantsMulti[
i],
CP_ACP);
331 todo_wine ok(
hres ==
S_OK,
"ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_ACP hres:0x%x\n",
332 tomConstantsMulti[
i],
hres);
338 hres = ITextDocument_Open(txtDoc, &testfile, tomConstantsMulti[
i],
CP_UTF8);
339 todo_wine ok(
hres ==
S_OK,
"ITextDocument_Open: Filename:test.txt Flags:0x%x Codepage:CP_UTF8 hres:0x%x\n",
340 tomConstantsMulti[
i],
hres);
473 todo_wine ok(
result == 0,
"ITextDocument_Open: Test ASCII set wrong text: Result: %s\n", bufACP);
488 todo_wine ok(
result == 0,
"ITextDocument_Open: Test UTF-8 set wrong text: Result: %s\n", bufACP);
519 static const CHAR test_text1[] =
"TestSomeText";
520 static const WCHAR bufW1[] = {
'T',
'e',
's',
't', 0};
521 static const WCHAR bufW2[] = {
'T',
'e',
'x',
't',
'\r', 0};
522 static const WCHAR bufW3[] = {
'T',
'e',
'x',
't', 0};
523 static const WCHAR bufW4[] = {
'T',
'e',
's',
't',
'S',
'o',
'm',
524 'e',
'T',
'e',
'x',
't',
'\r', 0};
525 static const WCHAR bufW5[] = {
'\r', 0};
526 static const WCHAR bufW6[] = {
'T',
'e',
's',
't',
'S',
'o',
'm',
'e',
'T',0};
527 BOOL is64bit =
sizeof(
void *) >
sizeof(
int);
536 hres = ITextSelection_GetText(txtSel, &bstr);
543 hres = ITextSelection_GetText(txtSel, &bstr);
550 hres = ITextSelection_GetText(txtSel, &bstr);
556 hres = ITextSelection_GetText(txtSel,
NULL);
562 hres = ITextSelection_GetText(txtSel, &bstr);
569 hres = ITextSelection_GetText(txtSel, &bstr);
574 first = 12; lim = 13;
576 hres = ITextSelection_GetText(txtSel, &bstr);
583 hres = ITextSelection_GetText(txtSel, &bstr);
590 hres = ITextSelection_GetText(txtSel, &bstr);
595 hres = ITextDocument_Range(txtDoc, 0, 4, &
range);
602 ITextRange_Release(
range);
604 hres = ITextDocument_Range(txtDoc, 4, 0, &
range);
611 ITextRange_Release(
range);
613 hres = ITextDocument_Range(txtDoc, 1, 1, &
range);
623 ITextRange_Release(
range);
625 hres = ITextDocument_Range(txtDoc, 8, 12, &
range);
632 ITextRange_Release(
range);
634 hres = ITextDocument_Range(txtDoc, 8, 13, &
range);
641 ITextRange_Release(
range);
643 hres = ITextDocument_Range(txtDoc, 12, 13, &
range);
650 ITextRange_Release(
range);
652 hres = ITextDocument_Range(txtDoc, 0, -1, &
range);
657 ITextRange_Release(
range);
659 hres = ITextDocument_Range(txtDoc, -1, 9, &
range);
671 bstr = (
void*)0xdeadbeef;
672 hres = ITextSelection_GetText(txtSel, &bstr);
675 ok(bstr ==
NULL,
"got %p\n", bstr);
677 bstr = (
void*)0xdeadbeef;
681 ok(bstr ==
NULL,
"got %p\n", bstr);
684 hres = ITextSelection_GetText(txtSel,
NULL);
691 ITextRange_Release(
range);
692 ITextSelection_Release(txtSel);
697 static const CHAR test_text1[] =
"TestSomeText";
706 hres = ITextDocument_Range(txtDoc, 0, 0, &txtRge);
710 hres = ITextDocument_Range(txtDoc, 0, 0, &range2);
712 ok(range2 != txtRge,
"A new pointer should be returned\n");
713 ITextRange_Release(range2);
715 hres = ITextDocument_Range(txtDoc, 0, 0,
NULL);
720 hres = ITextDocument_Range(txtDoc, 8, 30, &range2);
722 hres = ITextRange_GetStart(range2, &
value);
726 hres = ITextRange_GetEnd(range2, &
value);
729 ITextRange_Release(range2);
732 hres = ITextRange_CanEdit(txtRge,
NULL);
734 ITextRange_Release(txtRge);
746 static const CHAR test_text1[] =
"TestSomeText";
751 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
754 hres = ITextRange_GetChar(txtRge, &
pch);
756 ok(
pch ==
'T',
"got wrong char: %c\n",
pch);
757 ITextRange_Release(txtRge);
763 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
766 hres = ITextRange_GetChar(txtRge, &
pch);
768 ok(
pch ==
'T',
"got wrong char: %c\n",
pch);
769 ITextRange_Release(txtRge);
772 first = 12; lim = 12;
775 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
778 hres = ITextRange_GetChar(txtRge, &
pch);
780 ok(
pch ==
'\r',
"got wrong char: %c\n",
pch);
781 ITextRange_Release(txtRge);
784 first = 13; lim = 13;
787 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
790 hres = ITextRange_GetChar(txtRge, &
pch);
792 ok(
pch ==
'\r',
"got wrong char: %c\n",
pch);
793 ITextRange_Release(txtRge);
798 first = 12; lim = 12;
799 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
801 hres = ITextRange_GetChar(txtRge,
NULL);
806 hres = ITextRange_GetChar(txtRge,
NULL);
809 hres = ITextRange_GetChar(txtRge, &
pch);
812 ITextRange_Release(txtRge);
817 LONG bStart,
int expected_nonzero)
826 hres = ITextDocument_Range(doc,
first, lim, &txtRge);
828 hres = ITextRange_ScrollIntoView(txtRge, bStart);
831 if (expected_nonzero) {
833 "Scrollbar at 0, should be >0. (TextRange %d-%d, scroll range %d-%d.)\n",
837 "Scrollbar at %d, should be 0. (TextRange %d-%d, scroll range %d-%d.)\n",
849 static const CHAR test_text1[] =
"1\n2\n3\n4\n5\n6\n7\n8\n9\n10";
870 hres = ITextDocument_Range(txtDoc, 0, 0, &txtRge);
875 ITextRange_Release(txtRge);
887 static const CHAR test_text1[] =
"TestSomeText";
895 hres = ITextSelection_GetChar(txtSel, &
pch);
897 ok(
pch ==
'T',
"got wrong char: %c\n",
pch);
902 hres = ITextSelection_GetChar(txtSel, &
pch);
904 ok(
pch ==
'T',
"got wrong char: %c\n",
pch);
906 first = 12; lim = 12;
909 hres = ITextSelection_GetChar(txtSel, &
pch);
911 ok(
pch ==
'\r',
"got wrong char: %c\n",
pch);
913 first = 13; lim = 13;
916 hres = ITextSelection_GetChar(txtSel, &
pch);
918 ok(
pch ==
'\r',
"got wrong char: %c\n",
pch);
920 hres = ITextSelection_GetChar(txtSel,
NULL);
925 hres = ITextSelection_GetChar(txtSel,
NULL);
928 hres = ITextSelection_GetChar(txtSel, &
pch);
931 ITextSelection_Release(txtSel);
942 static const CHAR test_text1[] =
"TestSomeText";
948 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
951 hres = ITextRange_GetStart(txtRge, &
start);
955 hres = ITextRange_GetEnd(txtRge, &
end);
957 ok(
end == 6,
"got wrong end value: %d\n",
end);
958 ITextRange_Release(txtRge);
961 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
964 hres = ITextRange_GetStart(txtRge, &
start);
968 hres = ITextRange_GetEnd(txtRge, &
end);
970 ok(
end == 6,
"got wrong end value: %d\n",
end);
971 ITextRange_Release(txtRge);
973 first = -1; lim = 13;
974 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
977 hres = ITextRange_GetStart(txtRge, &
start);
981 hres = ITextRange_GetEnd(txtRge, &
end);
983 ok(
end == 13,
"got wrong end value: %d\n",
end);
984 ITextRange_Release(txtRge);
986 first = 13; lim = 13;
987 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
990 hres = ITextRange_GetStart(txtRge, &
start);
994 hres = ITextRange_GetEnd(txtRge, &
end);
996 ok(
end == 12,
"got wrong end value: %d\n",
end);
999 hres = ITextRange_SetStart(txtRge, 0);
1003 hres = ITextRange_SetStart(txtRge, 0);
1006 hres = ITextRange_SetStart(txtRge, 1);
1011 hres = ITextRange_SetStart(txtRge, -1);
1014 hres = ITextRange_SetStart(txtRge, -1);
1017 hres = ITextRange_SetStart(txtRge, 0);
1021 hres = ITextRange_GetStart(txtRge, &
start);
1026 hres = ITextRange_SetStart(txtRge, 1);
1029 hres = ITextRange_SetEnd(txtRge, 3);
1032 hres = ITextRange_SetStart(txtRge, 10);
1036 hres = ITextRange_GetStart(txtRge, &
start);
1041 hres = ITextRange_GetEnd(txtRge, &
end);
1046 hres = ITextRange_SetStart(txtRge, 50);
1050 hres = ITextRange_GetStart(txtRge, &
start);
1055 hres = ITextRange_GetEnd(txtRge, &
end);
1060 hres = ITextRange_SetStart(txtRge, 0);
1064 hres = ITextRange_SetEnd(txtRge, 5);
1067 hres = ITextRange_SetEnd(txtRge, 5);
1071 hres = ITextRange_SetEnd(txtRge, -1);
1075 hres = ITextRange_GetEnd(txtRge, &
end);
1080 hres = ITextRange_GetStart(txtRge, &
start);
1085 hres = ITextRange_SetStart(txtRge, 3);
1088 hres = ITextRange_SetEnd(txtRge, 1);
1092 hres = ITextRange_GetStart(txtRge, &
start);
1097 hres = ITextRange_GetEnd(txtRge, &
end);
1102 hres = ITextRange_SetEnd(txtRge, 50);
1106 hres = ITextRange_GetStart(txtRge, &
start);
1111 hres = ITextRange_GetEnd(txtRge, &
end);
1116 hres = ITextRange_SetEnd(txtRge, 0);
1120 hres = ITextRange_GetStart(txtRge, &
start);
1125 hres = ITextRange_GetEnd(txtRge, &
end);
1132 hres = ITextRange_SetStart(txtRge, 0);
1135 hres = ITextRange_SetEnd(txtRge, 3);
1138 hres = ITextRange_GetStart(txtRge, &
start);
1141 hres = ITextRange_GetStart(txtRge,
NULL);
1144 hres = ITextRange_GetEnd(txtRge, &
end);
1147 hres = ITextRange_GetEnd(txtRge,
NULL);
1150 ITextRange_Release(txtRge);
1161 static const CHAR test_text1[] =
"TestSomeText";
1169 hres = ITextSelection_GetStart(txtSel, &
start);
1170 ok(
hres ==
S_OK,
"ITextSelection_GetStart\n");
1173 hres = ITextSelection_GetEnd(txtSel, &
end);
1175 ok(
end == 5,
"got wrong end value: %d\n",
end);
1180 hres = ITextSelection_GetStart(txtSel, &
start);
1181 ok(
hres ==
S_OK,
"ITextSelection_GetStart\n");
1184 hres = ITextSelection_GetEnd(txtSel, &
end);
1186 ok(
end == 5,
"got wrong end value: %d\n",
end);
1188 first = 0; lim = -1;
1191 hres = ITextSelection_GetStart(txtSel, &
start);
1192 ok(
hres ==
S_OK,
"ITextSelection_GetStart\n");
1195 hres = ITextSelection_GetEnd(txtSel, &
end);
1197 ok(
end == 13,
"got wrong end value: %d\n",
end);
1199 first = 13; lim = 13;
1202 hres = ITextSelection_GetStart(txtSel, &
start);
1203 ok(
hres ==
S_OK,
"ITextSelection_GetStart\n");
1206 hres = ITextSelection_GetEnd(txtSel, &
end);
1208 ok(
end == 12,
"got wrong end value: %d\n",
end);
1211 hres = ITextSelection_SetStart(txtSel, 0);
1215 hres = ITextSelection_SetStart(txtSel, 0);
1218 hres = ITextSelection_SetStart(txtSel, 1);
1223 hres = ITextSelection_SetStart(txtSel, -1);
1226 hres = ITextSelection_SetStart(txtSel, -1);
1229 hres = ITextSelection_SetStart(txtSel, 0);
1233 hres = ITextSelection_GetStart(txtSel, &
start);
1238 hres = ITextSelection_SetStart(txtSel, 1);
1241 hres = ITextSelection_SetEnd(txtSel, 3);
1244 hres = ITextSelection_SetStart(txtSel, 10);
1248 hres = ITextSelection_GetStart(txtSel, &
start);
1253 hres = ITextSelection_GetEnd(txtSel, &
end);
1258 hres = ITextSelection_SetStart(txtSel, 50);
1262 hres = ITextSelection_GetStart(txtSel, &
start);
1267 hres = ITextSelection_GetEnd(txtSel, &
end);
1272 hres = ITextSelection_SetStart(txtSel, 0);
1276 hres = ITextSelection_SetEnd(txtSel, 5);
1279 hres = ITextSelection_SetEnd(txtSel, 5);
1283 hres = ITextSelection_SetEnd(txtSel, -1);
1287 hres = ITextSelection_GetEnd(txtSel, &
end);
1292 hres = ITextSelection_GetStart(txtSel, &
start);
1297 hres = ITextSelection_SetStart(txtSel, 3);
1300 hres = ITextSelection_SetEnd(txtSel, 1);
1304 hres = ITextSelection_GetStart(txtSel, &
start);
1309 hres = ITextSelection_GetEnd(txtSel, &
end);
1314 hres = ITextSelection_SetEnd(txtSel, 50);
1318 hres = ITextSelection_GetStart(txtSel, &
start);
1323 hres = ITextSelection_GetEnd(txtSel, &
end);
1328 hres = ITextSelection_SetEnd(txtSel, 0);
1332 hres = ITextSelection_GetStart(txtSel, &
start);
1337 hres = ITextSelection_GetEnd(txtSel, &
end);
1344 hres = ITextSelection_GetStart(txtSel,
NULL);
1347 hres = ITextSelection_GetStart(txtSel, &
start);
1350 hres = ITextSelection_GetEnd(txtSel,
NULL);
1353 hres = ITextSelection_GetEnd(txtSel, &
end);
1356 ITextSelection_Release(txtSel);
1368 static const CHAR test_text1[] =
"TestSomeText";
1373 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
1376 hres = ITextRange_GetDuplicate(txtRge, &txtRgeDup);
1377 ok(
hres ==
S_OK,
"ITextRange_GetDuplicate\n");
1378 ok(txtRgeDup != txtRge,
"A new pointer should be returned\n");
1379 hres = ITextRange_GetStart(txtRgeDup, &
start);
1382 hres = ITextRange_GetEnd(txtRgeDup, &
end);
1384 ok(
end == lim,
"got wrong value: %d\n",
end);
1386 ITextRange_Release(txtRgeDup);
1388 hres = ITextRange_GetDuplicate(txtRge,
NULL);
1393 hres = ITextRange_GetDuplicate(txtRge,
NULL);
1396 hres = ITextRange_GetDuplicate(txtRge, &txtRgeDup);
1399 ITextRange_Release(txtRge);
1410 static const CHAR test_text1[] =
"TestSomeText";
1416 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
1420 hres = ITextRange_GetStart(txtRge, &
start);
1423 hres = ITextRange_GetEnd(txtRge, &
end);
1425 ok(
end == 4,
"got wrong end value: %d\n",
end);
1426 ITextRange_Release(txtRge);
1428 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
1432 hres = ITextRange_GetStart(txtRge, &
start);
1435 hres = ITextRange_GetEnd(txtRge, &
end);
1437 ok(
end == 4,
"got wrong end value: %d\n",
end);
1438 ITextRange_Release(txtRge);
1440 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
1444 hres = ITextRange_GetStart(txtRge, &
start);
1447 hres = ITextRange_GetEnd(txtRge, &
end);
1449 ok(
end == 8,
"got wrong end value: %d\n",
end);
1450 ITextRange_Release(txtRge);
1452 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
1456 hres = ITextRange_GetStart(txtRge, &
start);
1459 hres = ITextRange_GetEnd(txtRge, &
end);
1461 ok(
end == 8,
"got wrong end value: %d\n",
end);
1462 ITextRange_Release(txtRge);
1465 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
1467 hres = ITextRange_Collapse(txtRge, 256);
1469 hres = ITextRange_GetStart(txtRge, &
start);
1472 hres = ITextRange_GetEnd(txtRge, &
end);
1474 ok(
end == 4,
"got wrong end value: %d\n",
end);
1475 ITextRange_Release(txtRge);
1478 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
1482 hres = ITextRange_GetStart(txtRge, &
start);
1485 hres = ITextRange_GetEnd(txtRge, &
end);
1487 ok(
end == 6,
"got wrong end value: %d\n",
end);
1488 ITextRange_Release(txtRge);
1491 hres = ITextDocument_Range(txtDoc,
first, lim, &txtRge);
1495 hres = ITextRange_GetStart(txtRge, &
start);
1498 hres = ITextRange_GetEnd(txtRge, &
end);
1500 ok(
end == 8,
"got wrong end value: %d\n",
end);
1510 ITextRange_Release(txtRge);
1521 static const CHAR test_text1[] =
"TestSomeText";
1529 ok(
hres ==
S_OK,
"ITextSelection_Collapse\n");
1532 ok(
end == 4,
"got wrong end value: %d\n",
end);
1536 ok(
hres ==
S_OK,
"ITextSelection_Collapse\n");
1539 ok(
end == 4,
"got wrong end value: %d\n",
end);
1543 ok(
hres ==
S_OK,
"ITextSelection_Collapse\n");
1546 ok(
end == 8,
"got wrong end value: %d\n",
end);
1549 hres = ITextSelection_Collapse(txtSel,
tomEnd);
1550 ok(
hres ==
S_OK,
"ITextSelection_Collapse\n");
1553 ok(
end == 8,
"got wrong end value: %d\n",
end);
1557 hres = ITextSelection_Collapse(txtSel, 256);
1558 ok(
hres ==
S_OK,
"ITextSelection_Collapse\n");
1561 ok(
end == 4,
"got wrong end value: %d\n",
end);
1565 hres = ITextSelection_Collapse(txtSel,
tomEnd);
1569 ok(
end == 6,
"got wrong end value: %d\n",
end);
1577 ok(
end == 8,
"got wrong end value: %d\n",
end);
1587 ITextSelection_Release(txtSel);
1599 LONG refcount1, refcount2;
1602 hres = IRichEditOle_GetClientSite(reOle, &clientSite);
1606 hres = IOleClientSite_QueryInterface(clientSite, &IID_IRichEditOle, (
void **)&reOle1);
1609 hres = IRichEditOle_GetClientSite(reOle, &clientSite1);
1611 ok(clientSite != clientSite1,
"got %p, %p\n", clientSite, clientSite1);
1612 IOleClientSite_Release(clientSite1);
1615 ok(
hres ==
S_OK,
"IOleClientSite_QueryInterface: 0x%08x\n",
hres);
1616 ok(clientSite == clientSite1,
"Should not return a new pointer.\n");
1621 ok(
hres ==
S_OK,
"IOleClientSite_QueryInterface: 0x%08x\n",
hres);
1624 ok(refcount1 == refcount2,
"got wrong ref count.\n");
1626 hres = IOleClientSite_QueryInterface(clientSite, &
IID_IOleWindow, (
void **)&oleWin1);
1627 ok(
hres ==
S_OK,
"IOleClientSite_QueryInterface: 0x%08x\n",
hres);
1628 ok(oleWin == oleWin1,
"Should not return a new pointer.\n");
1631 ok(refcount1 == refcount2,
"got wrong ref count.\n");
1635 ok(clientSite2 == clientSite1,
"got wrong pointer\n");
1639 ok(
hres ==
S_OK,
"IOleClientSite_QueryInterface: 0x%08x\n",
hres);
1642 ok(refcount1 == refcount2,
"got wrong ref count.\n");
1645 ok(
hres ==
S_OK,
"IOleClientSite_QueryInterface: 0x%08x\n",
hres);
1646 ok(olePlace == olePlace1,
"Should not return a new pointer.\n");
1647 IOleInPlaceSite_Release(olePlace1);
1653 ok(refcount1 == refcount2,
"got wrong ref count.\n");
1655 IOleInPlaceSite_Release(olePlace1);
1656 IOleInPlaceSite_Release(olePlace);
1657 IOleWindow_Release(oleWin1);
1658 IOleWindow_Release(oleWin);
1659 IOleClientSite_Release(clientSite2);
1660 IOleClientSite_Release(clientSite1);
1661 IOleClientSite_Release(clientSite);
1676 hres = IRichEditOle_GetClientSite(reOle, &clientSite);
1680 ok(
hres ==
S_OK,
"IOleClientSite_QueryInterface: 0x%08x\n",
hres);
1681 hres = IOleWindow_GetWindow(oleWin, &
hwnd);
1683 ok(
w ==
hwnd,
"got wrong pointer\n");
1685 hres = IOleWindow_GetWindow(oleWin,
NULL);
1688 IOleWindow_Release(oleWin);
1689 IOleClientSite_Release(clientSite);
1704 hres = IRichEditOle_GetClientSite(reOle, &clientSite);
1708 ok(
hres ==
S_OK,
"IOleClientSite_QueryInterface: 0x%08x\n",
hres);
1709 hres = IOleInPlaceSite_GetWindow(olePlace, &
hwnd);
1711 ok(
w ==
hwnd,
"got wrong pointer.\n");
1713 hres = IOleInPlaceSite_GetWindow(olePlace,
NULL);
1716 IOleInPlaceSite_Release(olePlace);
1717 IOleClientSite_Release(clientSite);
1723 static const CHAR test_text1[] =
"TestSomeText";
1745 ok(
font != font2,
"got %p, %p\n",
font, font2);
1746 ITextFont_Release(font2);
1747 ITextFont_Release(
font);
1753 hr = ITextDocument_Range(doc, 0, 4, &
range);
1771 hr = ITextRange_GetFont(
range, &font2);
1773 ok(
font != font2,
"got %p, %p\n",
font, font2);
1781 ITextFont_Release(font2);
1827 ITextFont_Release(
font);
1833 hr = ITextRange_GetFont(
range, &font2);
1836 ITextRange_Release(
range);
1841 static const CHAR test_text1[] =
"TestSomeText";
1856 hr = ITextDocument_Range(doc, 0, 4, &
range);
1866 hr = ITextRange_GetPara(
range, ¶);
1874 hr = ITextRange_GetPara(
range, ¶2);
1876 ok(para != para2,
"got %p, %p\n", para, para2);
1884 ITextPara_Release(para);
1885 ITextPara_Release(para2);
1901 ok(para != para2,
"got %p, %p\n", para, para2);
1903 ITextPara_Release(para);
1904 ITextPara_Release(para2);
1910 hr = ITextRange_GetPara(
range, ¶);
1920 ITextRange_Release(
range);
1925 static const WCHAR testnameW[] = {
'G',
'e',
't',
'T',
'e',
'x',
't',0};
1926 static const WCHAR testname2W[] = {
'T',
'e',
'x',
't',0};
1939 hr = ITextDocument_Range(doc, 0, 0, &
range);
1947 ok(dispid == DISPID_UNKNOWN,
"got %d\n", dispid);
1953 ok(dispid == DISPID_VALUE,
"got %d\n", dispid);
1965 ok(dispid == DISPID_VALUE,
"got %d\n", dispid);
1967 ITextRange_Release(
range);
1981 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
1987 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
1993 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
1999 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
2005 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
2011 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
2017 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
2023 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
2029 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
2035 ok(
hr == hrexp,
"got 0x%08x\n",
hr);
2091 hr = ITextFont_GetKerning(
font, &valuef);
2093 ok(valuef == 0.0,
"got %.2f\n", valuef);
2112 hr = ITextFont_GetPosition(
font, &valuef);
2114 ok(valuef == 0.0,
"got %.2f\n", valuef);
2127 hr = ITextFont_GetSize(
font, &valuef);
2129 ok(valuef >= 0.0,
"got %.2f\n", valuef);
2137 hr = ITextFont_GetSpacing(
font, &valuef);
2139 ok(valuef == 0.0,
"got %.2f\n", valuef);
2219 hr = ITextFont_GetKerning(
font, &valuef);
2234 hr = ITextFont_GetPosition(
font, &valuef);
2249 hr = ITextFont_GetSize(
font, &valuef);
2259 hr = ITextFont_GetSpacing(
font, &valuef);
2291 return value * 72.0 / 1440;
2296 static const WCHAR arialW[] = {
'A',
'r',
'i',
'a',
'l',0};
2297 static const CHAR test_text1[] =
"TestSomeText";
2313 hr = ITextDocument_Range(doc, 0, 10, &
range);
2334 hr = ITextFont_SetPosition(
font, 20.0);
2337 hr = ITextFont_SetKerning(
font, 10.0);
2341 hr = ITextFont_GetPosition(
font, &position);
2349 cf.cbSize =
sizeof(
cf);
2357 ok(position ==
twips_to_points(
cf.yOffset),
"got yOffset %d, position %.2f\n",
cf.yOffset, position);
2366 hr = ITextFont_GetDuplicate(
font, &font2);
2375 ITextFont_Release(font2);
2386 cf.cbSize =
sizeof(
cf);
2428 hr = ITextFont_GetDuplicate(
font, &font2);
2448 hr = ITextFont_GetItalic(font2, &
value);
2453 hr = ITextFont_GetDuplicate(font2, &font3);
2455 ITextFont_Release(font3);
2457 ITextRange_Release(
range);
2467 hr = ITextFont_GetDuplicate(font2, &font3);
2469 ITextFont_Release(font3);
2473 hr = ITextFont_GetBold(font2, &
value);
2487 hr = ITextFont_GetDuplicate(font2, &font3);
2506 hr = ITextFont_GetItalic(font2, &
value);
2514 ITextFont_Release(font3);
2515 ITextFont_Release(font2);
2517 font2 = (
void*)0xdeadbeef;
2518 hr = ITextFont_GetDuplicate(
font, &font2);
2520 ok(font2 ==
NULL,
"got %p\n", font2);
2525 ITextFont_Release(
font);
2531 hr = ITextDocument_Range(doc, 0, 10, &
range);
2630 ITextRange_Release(
range);
2631 ITextFont_Release(
font);
2637 static const CHAR test_text1[] =
"TestSomeText";
2648 hr = ITextDocument_Range(doc, 0, 4, &
range);
2651 hr = ITextDocument_Range(doc, 1, 2, &range2);
2676 hr = ITextRange_GetStart(range2, &
value);
2680 hr = ITextRange_GetEnd(range2, &
value);
2685 ITextRange_Release(
range);
2686 ITextRange_Release(range2);
2692 static const CHAR test_text1[] =
"TestSomeText";
2693 static const WCHAR textW[] = {
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',0};
2705 hr = ITextDocument_Range(doc, 0, 4, &
range);
2708 hr = ITextDocument_Range(doc, 0, 4, &range2);
2712 hr = ITextRange_GetStart(range2, &
value);
2717 hr = ITextRange_GetEnd(range2, &
value);
2725 hr = ITextRange_GetEnd(range2, &
value);
2745 hr = ITextRange_GetStart(range2, &
value);
2750 hr = ITextRange_GetEnd(range2, &
value);
2763 ITextRange_Release(range2);
2774 ITextRange_Release(
range);
2779 static const CHAR test_text1[] =
"TestSomeText";
2792 hr = ITextDocument_Range(doc, 0, 4, &
range);
2795 hr = ITextDocument_Range(doc, 0, 4, &range2);
2799 hr = ITextDocument_Range(doc, 1, 2, &range3);
2881 ITextRange_Release(
range);
2882 ITextRange_Release(range2);
2883 ITextRange_Release(range3);
2889 static const CHAR test_text1[] =
"TestSomeText";
2902 hr = ITextDocument_Range(doc, 0, 4, &
range);
2905 hr = ITextDocument_Range(doc, 0, 4, &range2);
2909 hr = ITextDocument_Range(doc, 1, 2, &range3);
2996 ITextRange_Release(
range);
2997 ITextRange_Release(range2);
2998 ITextRange_Release(range3);
3004 static const CHAR test_text1[] =
"TestSomeText";
3017 hr = ITextDocument_Range(doc, 0, 4, &
range);
3020 hr = ITextRange_Select(
range);
3028 hr = ITextRange_Select(