Embind: Test and Fix out-param handling
(the types that are meant to be passed directly by pointer will need more thought, to make them actually work) Change-Id: Ia0f2e6f5335fad1140629477e89fc96121c2927e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166318 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
@@ -114,6 +114,10 @@ interface XTest {
|
||||
boolean isSequenceStruct([in] sequence<Struct> value);
|
||||
XTest getNull();
|
||||
boolean isNull([in] XTest value);
|
||||
void getOut(
|
||||
[out] boolean value1, [out] byte value2, [out] short value3, [out] unsigned short value4,
|
||||
[out] long value5, [out] unsigned long value6, [out] hyper value7,
|
||||
[out] unsigned hyper value8, [out] float value9, [out] double value10, [out] char value11);
|
||||
void throwRuntimeException();
|
||||
void passJob([in] com::sun::star::task::XJob object);
|
||||
void passJobExecutor([in] com::sun::star::task::XJobExecutor object);
|
||||
|
@@ -386,7 +386,7 @@ EMSCRIPTEN_BINDINGS(PrimaryBindings)
|
||||
};
|
||||
});
|
||||
|
||||
registerInOutParam<bool>("uno_InOutParam_boolean");
|
||||
registerInOutParam<sal_Bool>("uno_InOutParam_boolean");
|
||||
registerInOutParam<sal_Int8>("uno_InOutParam_byte");
|
||||
registerInOutParam<sal_Int16>("uno_InOutParam_short");
|
||||
registerInOutParam<sal_uInt16>("uno_InOutParam_unsigned_short");
|
||||
@@ -396,7 +396,7 @@ EMSCRIPTEN_BINDINGS(PrimaryBindings)
|
||||
registerInOutParam<sal_uInt64>("uno_InOutParam_unsigned_hyper");
|
||||
registerInOutParam<float>("uno_InOutParam_float");
|
||||
registerInOutParam<double>("uno_InOutParam_double");
|
||||
registerInOutParam<char16_t>("uno_InOutParam_char");
|
||||
registerInOutParam<sal_Unicode>("uno_InOutParam_char");
|
||||
|
||||
function("getCurrentModelFromViewSh", &getCurrentModelFromViewSh);
|
||||
function("getUnoComponentContext", &comphelper::getProcessComponentContext);
|
||||
|
@@ -512,6 +512,24 @@ class Test : public cppu::WeakImplHelper<org::libreoffice::embindtest::XTest>
|
||||
return !value;
|
||||
}
|
||||
|
||||
void SAL_CALL getOut(sal_Bool& value1, sal_Int8& value2, sal_Int16& value3, sal_uInt16& value4,
|
||||
sal_Int32& value5, sal_uInt32& value6, sal_Int64& value7,
|
||||
sal_uInt64& value8, float& value9, double& value10,
|
||||
sal_Unicode& value11) override
|
||||
{
|
||||
value1 = true;
|
||||
value2 = -12;
|
||||
value3 = -1234;
|
||||
value4 = 54321;
|
||||
value5 = -123456;
|
||||
value6 = 3456789012;
|
||||
value7 = -123456789;
|
||||
value8 = 9876543210;
|
||||
value9 = -10.25;
|
||||
value10 = 100.5;
|
||||
value11 = u'Ö';
|
||||
}
|
||||
|
||||
void SAL_CALL throwRuntimeException() override
|
||||
{
|
||||
throw css::uno::RuntimeException(u"test"_ustr);
|
||||
|
@@ -528,6 +528,53 @@ Module.addOnPostRun(function() {
|
||||
console.log(v);
|
||||
console.assert(v === null);
|
||||
}
|
||||
{
|
||||
const v1 = new Module.uno_InOutParam_boolean;
|
||||
const v2 = new Module.uno_InOutParam_byte;
|
||||
const v3 = new Module.uno_InOutParam_short;
|
||||
const v4 = new Module.uno_InOutParam_unsigned_short;
|
||||
const v5 = new Module.uno_InOutParam_long;
|
||||
const v6 = new Module.uno_InOutParam_unsigned_long;
|
||||
const v7 = new Module.uno_InOutParam_hyper;
|
||||
const v8 = new Module.uno_InOutParam_unsigned_hyper;
|
||||
const v9 = new Module.uno_InOutParam_float;
|
||||
const v10 = new Module.uno_InOutParam_double;
|
||||
const v11 = new Module.uno_InOutParam_char;
|
||||
test.getOut(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);
|
||||
console.log(v1.val);
|
||||
console.log(v2.val);
|
||||
console.log(v3.val);
|
||||
console.log(v4.val);
|
||||
console.log(v5.val);
|
||||
console.log(v6.val);
|
||||
console.log(v7.val);
|
||||
console.log(v8.val);
|
||||
console.log(v9.val);
|
||||
console.log(v10.val);
|
||||
console.log(v11.val);
|
||||
console.assert(v1.val === 1); //TODO: true
|
||||
console.assert(v2.val === -12);
|
||||
console.assert(v3.val === -1234);
|
||||
console.assert(v4.val === 54321);
|
||||
console.assert(v5.val === -123456);
|
||||
console.assert(v6.val === 3456789012);
|
||||
console.assert(v7.val === -123456789n);
|
||||
console.assert(v8.val === 9876543210n);
|
||||
console.assert(v9.val === -10.25);
|
||||
console.assert(v10.val === 100.5);
|
||||
console.assert(v11.val === 'Ö');
|
||||
v1.delete();
|
||||
v2.delete();
|
||||
v3.delete();
|
||||
v4.delete();
|
||||
v5.delete();
|
||||
v6.delete();
|
||||
v7.delete();
|
||||
v8.delete();
|
||||
v9.delete();
|
||||
v10.delete();
|
||||
v11.delete();
|
||||
}
|
||||
console.assert(uno.org.libreoffice.embindtest.Constants.Boolean === true);
|
||||
console.assert(test.isBoolean(uno.org.libreoffice.embindtest.Constants.Boolean));
|
||||
console.assert(uno.org.libreoffice.embindtest.Constants.Byte === -12);
|
||||
|
Reference in New Issue
Block a user