mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-16 04:27:04 +00:00
riched20/tests: Test for ITextDocument::Freeze and ITextDocument::Unfreeze.
This commit is contained in:
parent
63a781de1d
commit
3105fad82b
|
@ -31,6 +31,8 @@
|
|||
#include <richedit.h>
|
||||
#include <richole.h>
|
||||
#include <tom.h>
|
||||
#include <imm.h>
|
||||
#include <textserv.h>
|
||||
#include <wine/test.h>
|
||||
|
||||
#define EXPECT_TODO_WINE 0x80000000UL
|
||||
|
@ -605,6 +607,7 @@ static HRESULT testoleobj_Create( struct testoleobj **objptr )
|
|||
static HMODULE hmoduleRichEdit;
|
||||
|
||||
DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
DEFINE_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
|
||||
|
||||
static const WCHAR sysW[] = {'S','y','s','t','e','m',0};
|
||||
|
||||
|
@ -5496,6 +5499,88 @@ static void test_undo_control(void)
|
|||
release_interfaces(&inst.hwnd, &reole, &inst.doc, &selection);
|
||||
}
|
||||
|
||||
static void test_freeze(void)
|
||||
{
|
||||
ITextSelection *selection = NULL;
|
||||
DWORD lasterr, style1, style2;
|
||||
IRichEditOle *reole = NULL;
|
||||
ITextDocument *doc = NULL;
|
||||
HRESULT hr;
|
||||
LONG count;
|
||||
HWND hwnd;
|
||||
|
||||
create_interfaces(&hwnd, &reole, &doc, &selection);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
style1 = GetWindowLongW(hwnd, GWL_STYLE);
|
||||
lasterr = GetLastError();
|
||||
ok(lasterr == 0xdeadbeefUL, "GetLastError() returned %#lx\n", lasterr);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 1, "expected count to be %d, got %ld\n", 1, count);
|
||||
|
||||
style2 = GetWindowLongW(hwnd, GWL_STYLE);
|
||||
ok(style2 == style1, "expected window style to not change from %#lx, got %#lx\n", style1, style2);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 2, "expected count to be %d, got %ld\n", 2, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_FALSE, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 1, "expected count to be %d, got %ld\n", 1, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 0, "expected count to be %d, got %ld\n", 0, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 0, "expected count to be %d, got %ld\n", 0, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 1, "expected count to be %d, got %ld\n", 1, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, &count);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
todo_wine
|
||||
ok(count == 0, "expected count to be %d, got %ld\n", 0, count);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze(doc, NULL);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr);
|
||||
|
||||
count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze(doc, NULL);
|
||||
todo_wine
|
||||
ok(hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr);
|
||||
|
||||
release_interfaces(&hwnd, &reole, &doc, &selection);
|
||||
}
|
||||
|
||||
START_TEST(richole)
|
||||
{
|
||||
/* Must explicitly LoadLibrary(). The test has no references to functions in
|
||||
|
@ -5539,4 +5624,5 @@ START_TEST(richole)
|
|||
test_clipboard();
|
||||
test_undo();
|
||||
test_undo_control();
|
||||
test_freeze();
|
||||
}
|
||||
|
|
|
@ -815,15 +815,20 @@ static void test_TxGetNaturalSize(void)
|
|||
static void test_TxDraw(void)
|
||||
{
|
||||
ITextServices *txtserv;
|
||||
ITextDocument *txtdoc;
|
||||
ITextHost *host;
|
||||
HRESULT hr;
|
||||
RECT client = {0, 0, 100, 100};
|
||||
ITextHostTestImpl *host_impl;
|
||||
LONG freeze_count;
|
||||
HDC hdc;
|
||||
|
||||
if (!init_texthost(&txtserv, &host))
|
||||
return;
|
||||
|
||||
hr = ITextServices_QueryInterface( txtserv, &IID_ITextDocument, (void **)&txtdoc );
|
||||
ok( hr == S_OK, "ITextServices_QueryInterface (ITextDocument) returned %#lx\n", hr );
|
||||
|
||||
host_impl = impl_from_ITextHost( host );
|
||||
host_impl->window = CreateWindowExA( 0, "static", NULL, WS_POPUP | WS_VISIBLE,
|
||||
0, 0, 400, 400, 0, 0, 0, NULL );
|
||||
|
@ -856,9 +861,32 @@ static void test_TxDraw(void)
|
|||
NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
|
||||
freeze_count = 0xdeadbeef;
|
||||
hr = ITextDocument_Freeze( txtdoc, &freeze_count );
|
||||
todo_wine
|
||||
ok( hr == S_OK, "ITextDocument_Freeze returned %#lx\n", hr );
|
||||
todo_wine
|
||||
ok( freeze_count == 1, "expected count to be %d, got %ld\n", 1, freeze_count );
|
||||
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_INACTIVE );
|
||||
ok( hr == S_OK, "got %08lx\n", hr );
|
||||
hr = ITextServices_TxDraw( txtserv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, (RECTL *)&client, NULL,
|
||||
NULL, NULL, 0, TXTVIEW_ACTIVE );
|
||||
todo_wine
|
||||
ok( hr == E_UNEXPECTED, "got %08lx\n", hr );
|
||||
|
||||
freeze_count = 0xdeadbeef;
|
||||
hr = ITextDocument_Unfreeze( txtdoc, &freeze_count );
|
||||
todo_wine
|
||||
ok( hr == S_OK, "ITextDocument_Unfreeze returned %#lx\n", hr );
|
||||
todo_wine
|
||||
ok( freeze_count == 0, "expected count to be %d, got %ld\n", 0, freeze_count );
|
||||
|
||||
hr = ITextServices_OnTxInPlaceDeactivate( txtserv );
|
||||
|
||||
ReleaseDC( host_impl->window, hdc );
|
||||
ITextDocument_Release(txtdoc);
|
||||
ITextServices_Release(txtserv);
|
||||
DestroyWindow( host_impl->window );
|
||||
ITextHost_Release(host);
|
||||
|
|
Loading…
Reference in a new issue