small regression fix.

This commit is contained in:
Jeff Hutchinson 2021-09-04 22:00:32 -04:00
parent c16b88d709
commit 9b2f4976c9
2 changed files with 20 additions and 2 deletions

View file

@ -2002,7 +2002,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
break;
}
stack[_STK + 1].setInt(result);
stack[_STK + 1].setFloat(result);
_STK++;
break;
}
@ -2139,7 +2139,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
{
bool isGlobal = code[ip];
U32 failIp = code[ip + isGlobal ? 3 : 2];
U32 failIp = code[ip + (isGlobal ? 3 : 2)];
IterStackRecord& iter = iterStack[_ITER];
iter.mIsGlobalVariable = isGlobal;

View file

@ -950,6 +950,24 @@ TEST(Script, MiscRegressions)
)");
ASSERT_STREQ(regression3.getString(), "120 20");
ConsoleValue regression4 = RunScript(R"(
function doTest()
{
%slider = new GuiSliderCtrl()
{
range = "0 2";
ticks = 5;
active = true;
};
%slider.setValue(0.5);
return %slider.getValue();
}
return doTest();
)");
ASSERT_EQ(regression4.getFloat(), 0.5);
}
#endif