mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Add interface codegen tests.
This commit is contained in:
parent
48ebd2a5e3
commit
9fe72eb379
2 changed files with 16 additions and 0 deletions
|
@ -2,12 +2,16 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use dom::bindings::js::JS;
|
||||||
use dom::bindings::utils::{Reflector, Reflectable};
|
use dom::bindings::utils::{Reflector, Reflectable};
|
||||||
|
use dom::blob::Blob;
|
||||||
|
use dom::window::Window;
|
||||||
use servo_util::str::DOMString;
|
use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[deriving(Encodable)]
|
#[deriving(Encodable)]
|
||||||
pub struct TestBinding {
|
pub struct TestBinding {
|
||||||
reflector: Reflector,
|
reflector: Reflector,
|
||||||
|
window: JS<Window>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TestBinding {
|
impl TestBinding {
|
||||||
|
@ -35,6 +39,8 @@ impl TestBinding {
|
||||||
pub fn SetDoubleAttribute(&self, _: f64) {}
|
pub fn SetDoubleAttribute(&self, _: f64) {}
|
||||||
pub fn StringAttribute(&self) -> DOMString { ~"" }
|
pub fn StringAttribute(&self) -> DOMString { ~"" }
|
||||||
pub fn SetStringAttribute(&self, _: DOMString) {}
|
pub fn SetStringAttribute(&self, _: DOMString) {}
|
||||||
|
pub fn InterfaceAttribute(&self) -> JS<Blob> { Blob::new(&self.window) }
|
||||||
|
pub fn SetInterfaceAttribute(&self, _: &JS<Blob>) {}
|
||||||
|
|
||||||
pub fn GetBooleanAttributeNullable(&self) -> Option<bool> { Some(false) }
|
pub fn GetBooleanAttributeNullable(&self) -> Option<bool> { Some(false) }
|
||||||
pub fn SetBooleanAttributeNullable(&self, _: Option<bool>) {}
|
pub fn SetBooleanAttributeNullable(&self, _: Option<bool>) {}
|
||||||
|
@ -60,6 +66,8 @@ impl TestBinding {
|
||||||
pub fn SetDoubleAttributeNullable(&self, _: Option<f64>) {}
|
pub fn SetDoubleAttributeNullable(&self, _: Option<f64>) {}
|
||||||
pub fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(~"") }
|
pub fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(~"") }
|
||||||
pub fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
|
pub fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
|
||||||
|
pub fn GetInterfaceAttributeNullable(&self) -> Option<JS<Blob>> { Some(Blob::new(&self.window)) }
|
||||||
|
pub fn SetInterfaceAttributeNullable(&self, _: Option<JS<Blob>>) {}
|
||||||
|
|
||||||
// FIXME (issue #1813) Doesn't currently compile.
|
// FIXME (issue #1813) Doesn't currently compile.
|
||||||
// pub fn PassOptionalBoolean(&self, _: Option<bool>) {}
|
// pub fn PassOptionalBoolean(&self, _: Option<bool>) {}
|
||||||
|
@ -74,6 +82,7 @@ impl TestBinding {
|
||||||
// pub fn PassOptionalFloat(&self, _: Option<f32>) {}
|
// pub fn PassOptionalFloat(&self, _: Option<f32>) {}
|
||||||
// pub fn PassOptionalDouble(&self, _: Option<f64>) {}
|
// pub fn PassOptionalDouble(&self, _: Option<f64>) {}
|
||||||
pub fn PassOptionalString(&self, _: Option<DOMString>) {}
|
pub fn PassOptionalString(&self, _: Option<DOMString>) {}
|
||||||
|
pub fn PassOptionalInterface(&self, _: Option<JS<Blob>>) {}
|
||||||
|
|
||||||
// pub fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>) {}
|
// pub fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>) {}
|
||||||
// pub fn PassOptionalNullableByte(&self, _: Option<Option<i8>>) {}
|
// pub fn PassOptionalNullableByte(&self, _: Option<Option<i8>>) {}
|
||||||
|
@ -87,6 +96,7 @@ impl TestBinding {
|
||||||
// pub fn PassOptionalNullableFloat(&self, _: Option<Option<f32>>) {}
|
// pub fn PassOptionalNullableFloat(&self, _: Option<Option<f32>>) {}
|
||||||
// pub fn PassOptionalNullableDouble(&self, _: Option<Option<f64>>) {}
|
// pub fn PassOptionalNullableDouble(&self, _: Option<Option<f64>>) {}
|
||||||
pub fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>) {}
|
pub fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>) {}
|
||||||
|
// pub fn PassOptionalNullableInterface(&self, _: Option<Option<JS<Blob>>>) {}
|
||||||
|
|
||||||
pub fn PassOptionalBooleanWithDefault(&self, _: bool) {}
|
pub fn PassOptionalBooleanWithDefault(&self, _: bool) {}
|
||||||
pub fn PassOptionalByteWithDefault(&self, _: i8) {}
|
pub fn PassOptionalByteWithDefault(&self, _: i8) {}
|
||||||
|
@ -111,6 +121,7 @@ impl TestBinding {
|
||||||
pub fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>) {}
|
pub fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>) {}
|
||||||
pub fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>) {}
|
pub fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>) {}
|
||||||
// pub fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
|
// pub fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
|
||||||
|
pub fn PassOptionalNullableInterfaceWithDefault(&self, _: Option<JS<Blob>>) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reflectable for TestBinding {
|
impl Reflectable for TestBinding {
|
||||||
|
|
|
@ -15,6 +15,7 @@ interface TestBinding {
|
||||||
attribute float floatAttribute;
|
attribute float floatAttribute;
|
||||||
attribute double doubleAttribute;
|
attribute double doubleAttribute;
|
||||||
attribute DOMString stringAttribute;
|
attribute DOMString stringAttribute;
|
||||||
|
attribute Blob interfaceAttribute;
|
||||||
|
|
||||||
attribute boolean? booleanAttributeNullable;
|
attribute boolean? booleanAttributeNullable;
|
||||||
attribute byte? byteAttributeNullable;
|
attribute byte? byteAttributeNullable;
|
||||||
|
@ -28,6 +29,7 @@ interface TestBinding {
|
||||||
attribute float? floatAttributeNullable;
|
attribute float? floatAttributeNullable;
|
||||||
attribute double? doubleAttributeNullable;
|
attribute double? doubleAttributeNullable;
|
||||||
attribute DOMString? stringAttributeNullable;
|
attribute DOMString? stringAttributeNullable;
|
||||||
|
attribute Blob? interfaceAttributeNullable;
|
||||||
|
|
||||||
// FIXME (issue #1813) Doesn't currently compile.
|
// FIXME (issue #1813) Doesn't currently compile.
|
||||||
// void passOptionalBoolean(optional boolean arg);
|
// void passOptionalBoolean(optional boolean arg);
|
||||||
|
@ -42,6 +44,7 @@ interface TestBinding {
|
||||||
// void passOptionalFloat(optional float arg);
|
// void passOptionalFloat(optional float arg);
|
||||||
// void passOptionalDouble(optional double arg);
|
// void passOptionalDouble(optional double arg);
|
||||||
void passOptionalString(optional DOMString arg);
|
void passOptionalString(optional DOMString arg);
|
||||||
|
void passOptionalInterface(optional Blob arg);
|
||||||
|
|
||||||
// void passOptionalNullableBoolean(optional boolean? arg);
|
// void passOptionalNullableBoolean(optional boolean? arg);
|
||||||
// void passOptionalNullableByte(optional byte? arg);
|
// void passOptionalNullableByte(optional byte? arg);
|
||||||
|
@ -55,6 +58,7 @@ interface TestBinding {
|
||||||
// void passOptionalNullableFloat(optional float? arg);
|
// void passOptionalNullableFloat(optional float? arg);
|
||||||
// void passOptionalNullableDouble(optional double? arg);
|
// void passOptionalNullableDouble(optional double? arg);
|
||||||
void passOptionalNullableString(optional DOMString? arg);
|
void passOptionalNullableString(optional DOMString? arg);
|
||||||
|
// void passOptionalNullableInterface(optional Blob? arg);
|
||||||
|
|
||||||
void passOptionalBooleanWithDefault(optional boolean arg = false);
|
void passOptionalBooleanWithDefault(optional boolean arg = false);
|
||||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||||
|
@ -77,4 +81,5 @@ interface TestBinding {
|
||||||
void passOptionalNullableLongLongWithDefault(optional long long? arg = null);
|
void passOptionalNullableLongLongWithDefault(optional long long? arg = null);
|
||||||
void passOptionalNullableUnsignedLongLongWithDefault(optional unsigned long long? arg = null);
|
void passOptionalNullableUnsignedLongLongWithDefault(optional unsigned long long? arg = null);
|
||||||
// void passOptionalNullableStringWithDefault(optional DOMString? arg = null);
|
// void passOptionalNullableStringWithDefault(optional DOMString? arg = null);
|
||||||
|
void passOptionalNullableInterfaceWithDefault(optional Blob? arg = null);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue