Shuai Meng : vbscript: Implemented Fix.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 15 13:53:12 CDT 2014


Module: wine
Branch: master
Commit: a3fe7269e2f2df1727260d66336d46752b5811b0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a3fe7269e2f2df1727260d66336d46752b5811b0

Author: Shuai Meng <mengshuaicalendr at gmail.com>
Date:   Thu Aug 14 22:46:51 2014 +0800

vbscript: Implemented Fix.

---

 dlls/vbscript/global.c      | 19 +++++++++++++++++--
 dlls/vbscript/tests/api.vbs | 25 +++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 933ec08..2b67f4e 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -1277,8 +1277,23 @@ static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
 
 static HRESULT Global_Fix(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    HRESULT hres;
+    VARIANT dst;
+
+    TRACE("(%s)\n", debugstr_variant(arg));
+
+    assert(args_cnt == 1);
+
+    hres = VarFix(arg, &dst);
+    if(FAILED(hres))
+        return hres;
+
+    if (res)
+        *res = dst;
+    else
+        VariantClear(&dst);
+
+    return S_OK;
 }
 
 static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs
index c52422f..27cf3e0 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -993,4 +993,29 @@ Call ok(getVT(ScriptEngineMajorVersion) = "VT_I4", "getVT(ScriptEngineMajorVersi
 
 Call ok(getVT(ScriptEngineMinorVersion) = "VT_I4", "getVT(ScriptEngineMinorVersion) = " & getVT(ScriptEngineMinorVersion))
 
+Call ok(Fix(Empty) = 0, "Fix(Empty) = " & Fix(Empty))
+Call ok(getVT(Fix(Empty)) = "VT_I2", "getVT(Fix(Empty)) = " & getVT(Fix(Empty)))
+Call ok(Fix(CCur(-0.99)) = 0, "Fix(CCur(-0.99)) = " & Fix(CCur(-0.99)))
+Call ok(getVT(Fix(CCur(-0.99))) = "VT_CY", "getVT(Fix(CCur(-0.99))) = " & getVT(Fix(CCur(-0.99))))
+Call ok(Fix(1.99) = 1, "Fix(1.99) = " & Fix(1.99))
+Call ok(getVT(Fix(1.99)) = "VT_R8", "getVT(Fix(1.99)) = " & getVT(Fix(1.99)))
+Call ok(Fix(-1.99) = -1, "Fix(-1.99) = " & Fix(-1.99))
+Call ok(getVT(Fix(-1.99)) = "VT_R8", "getVT(Fix(-1.99)) = " & getVT(Fix(-1.99)))
+If isEnglishLang Then
+    Call ok(Fix("1.99") = 1, "Fix(""1.99"") = " & Fix("1.99"))
+    Call ok(getVT(Fix("1.99")) = "VT_R8", "getVT(Fix(""1.99"")) = " & getVT(Fix("1.99")))
+    Call ok(Fix("-1.99") = -1, "Fix(""-1.99"") = " & Fix("-1.99"))
+    Call ok(getVT(Fix("-1.99")) = "VT_R8", "getVT(Fix(""-1.99"")) = " & getVT(Fix("-1.99")))
+End If
+Call ok(Fix(True) = -1, "Fix(True) = " & Fix(True))
+Call ok(getVT(Fix(True)) = "VT_I2", "getVT(Fix(True)) = " & getVT(Fix(True)))
+Call ok(Fix(False) = 0, "Fix(False) = " & Fix(False))
+Call ok(getVT(Fix(False)) = "VT_I2", "getVT(Fix(False)) = " & getVT(Fix(False)))
+MyObject.myval = 2.5
+Call ok(Fix(MyObject) = 2, "Fix(MyObject) = " & Fix(MyObject))
+Call ok(getVT(Fix(MyObject)) = "VT_R8", "getVT(Fix(MyObject)) = " & getVT(Fix(MyObject)))
+MyObject.myval = -2.5
+Call ok(Fix(MyObject) = -2, "Fix(MyObject) = " & Fix(MyObject))
+Call ok(getVT(Fix(MyObject)) = "VT_R8", "getVT(Fix(MyObject)) = " & getVT(Fix(MyObject)))
+
 Call reportSuccess()




More information about the wine-cvs mailing list