msscript.ocx: Implement IScriptError::get_Line.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4a588d3943
commit
00b4d3687d
|
@ -130,9 +130,11 @@ typedef struct {
|
|||
BSTR desc;
|
||||
BSTR help_file;
|
||||
DWORD help_context;
|
||||
ULONG line;
|
||||
|
||||
BOOLEAN info_filled;
|
||||
BOOLEAN text_filled;
|
||||
BOOLEAN pos_filled;
|
||||
} ScriptError;
|
||||
|
||||
struct ScriptHost {
|
||||
|
@ -2151,6 +2153,23 @@ static void fill_error_text(ScriptError *error)
|
|||
IActiveScriptError_GetSourceLineText(error->object, &error->text);
|
||||
}
|
||||
|
||||
static void fill_error_pos(ScriptError *error)
|
||||
{
|
||||
DWORD context;
|
||||
LONG column;
|
||||
ULONG line;
|
||||
|
||||
if (error->pos_filled) return;
|
||||
error->pos_filled = TRUE;
|
||||
|
||||
if (!error->object)
|
||||
return;
|
||||
if (FAILED(IActiveScriptError_GetSourcePosition(error->object, &context, &line, &column)))
|
||||
return;
|
||||
|
||||
error->line = line;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ScriptError_QueryInterface(IScriptError *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
ScriptError *This = impl_from_IScriptError(iface);
|
||||
|
@ -2328,9 +2347,11 @@ static HRESULT WINAPI ScriptError_get_Line(IScriptError *iface, LONG *plLine)
|
|||
{
|
||||
ScriptError *This = impl_from_IScriptError(iface);
|
||||
|
||||
FIXME("(%p)->(%p)\n", This, plLine);
|
||||
TRACE("(%p)->(%p)\n", This, plLine);
|
||||
|
||||
return E_NOTIMPL;
|
||||
fill_error_pos(This);
|
||||
*plLine = This->line;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ScriptError_get_Column(IScriptError *iface, LONG *plColumn)
|
||||
|
@ -2364,9 +2385,11 @@ static HRESULT WINAPI ScriptError_Clear(IScriptError *iface)
|
|||
This->desc = NULL;
|
||||
This->help_file = NULL;
|
||||
This->help_context = 0;
|
||||
This->line = 0;
|
||||
|
||||
This->info_filled = FALSE;
|
||||
This->text_filled = FALSE;
|
||||
This->pos_filled = FALSE;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -3351,6 +3351,9 @@ static void test_IScriptControl_get_Error(void)
|
|||
hr = IScriptError_get_Text(error, &str);
|
||||
ok(hr == S_OK, "IScriptError_get_Text failed: 0x%08x.\n", hr);
|
||||
ok(str == NULL, "Error Text is not (null), got %s.\n", wine_dbgstr_w(str));
|
||||
hr = IScriptError_get_Line(error, &x);
|
||||
ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
ok(x == 0, "Error Line is not 0, got %d.\n", x);
|
||||
|
||||
str = SysAllocString(L"jscript");
|
||||
hr = IScriptControl_put_Language(sc, str);
|
||||
|
@ -3381,6 +3384,9 @@ static void test_IScriptControl_get_Error(void)
|
|||
ok(hr == S_OK, "IScriptError_get_Text failed: 0x%08x.\n", hr);
|
||||
ok(!lstrcmpW(str, L"this is an invalid line"), "Error Text is wrong, got %s.\n", wine_dbgstr_w(str));
|
||||
SysFreeString(str);
|
||||
hr = IScriptError_get_Line(error, &x);
|
||||
ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
ok(x == 3, "Error Line is not 3, got %d.\n", x);
|
||||
|
||||
hr = IScriptError_Clear(error);
|
||||
ok(hr == S_OK, "IScriptError_Clear failed: 0x%08x.\n", hr);
|
||||
|
@ -3403,6 +3409,9 @@ static void test_IScriptControl_get_Error(void)
|
|||
hr = IScriptError_get_Text(error, &str);
|
||||
ok(hr == S_OK, "IScriptError_get_Text failed: 0x%08x.\n", hr);
|
||||
ok(str == NULL, "Error Text is not (null), got %s.\n", wine_dbgstr_w(str));
|
||||
hr = IScriptError_get_Line(error, &x);
|
||||
ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
ok(x == 0, "Error Line is not 0, got %d.\n", x);
|
||||
|
||||
hr = IScriptControl_get_Error(sc, &error2);
|
||||
ok(hr == S_OK, "IScriptControl_get_Error failed: 0x%08x.\n", hr);
|
||||
|
@ -3475,8 +3484,9 @@ static void test_IScriptControl_get_Error(void)
|
|||
|
||||
SET_EXPECT(GetSourcePosition);
|
||||
hr = IScriptError_get_Line(error, &x);
|
||||
todo_wine ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
todo_wine CHECK_CALLED(GetSourcePosition);
|
||||
ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
ok(x == 0, "Error Line is not 0, got %d.\n", x);
|
||||
CHECK_CALLED(GetSourcePosition);
|
||||
hr = IScriptError_get_Column(error, &x);
|
||||
todo_wine ok(hr == S_OK, "IScriptError_get_Column failed: 0x%08x.\n", hr);
|
||||
|
||||
|
@ -3511,9 +3521,9 @@ static void test_IScriptControl_get_Error(void)
|
|||
|
||||
SET_EXPECT(GetSourcePosition);
|
||||
hr = IScriptError_get_Line(error, &x);
|
||||
todo_wine ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
todo_wine ok(x == 42, "Error Line is not 42, got %d.\n", x);
|
||||
todo_wine CHECK_CALLED(GetSourcePosition);
|
||||
ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
ok(x == 42, "Error Line is not 42, got %d.\n", x);
|
||||
CHECK_CALLED(GetSourcePosition);
|
||||
hr = IScriptError_get_Column(error, &x);
|
||||
todo_wine ok(hr == S_OK, "IScriptError_get_Column failed: 0x%08x.\n", hr);
|
||||
todo_wine ok(x == 10, "Error Column is not 10, got %d.\n", x);
|
||||
|
@ -3546,9 +3556,9 @@ static void test_IScriptControl_get_Error(void)
|
|||
|
||||
SET_EXPECT(GetSourcePosition);
|
||||
hr = IScriptError_get_Line(error, &x);
|
||||
todo_wine ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
todo_wine ok(x == 42, "Error Line is not 42, got %d.\n", x);
|
||||
todo_wine CHECK_CALLED(GetSourcePosition);
|
||||
ok(hr == S_OK, "IScriptError_get_Line failed: 0x%08x.\n", hr);
|
||||
ok(x == 42, "Error Line is not 42, got %d.\n", x);
|
||||
CHECK_CALLED(GetSourcePosition);
|
||||
hr = IScriptError_get_Column(error, &x);
|
||||
todo_wine ok(hr == S_OK, "IScriptError_get_Column failed: 0x%08x.\n", hr);
|
||||
todo_wine ok(x == 10, "Error Column is not 10, got %d.\n", x);
|
||||
|
|
Loading…
Reference in New Issue