mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Add some tests for string codegen.
This commit is contained in:
parent
07b8c9bf88
commit
77f1224b24
2 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::utils::{Reflector, Reflectable};
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct TestBinding {
|
||||
|
@ -32,6 +33,8 @@ impl TestBinding {
|
|||
pub fn SetFloatAttribute(&self, _: f32) {}
|
||||
pub fn DoubleAttribute(&self) -> f64 { 0. }
|
||||
pub fn SetDoubleAttribute(&self, _: f64) {}
|
||||
pub fn StringAttribute(&self) -> DOMString { ~"" }
|
||||
pub fn SetStringAttribute(&self, _: DOMString) {}
|
||||
|
||||
pub fn GetBooleanAttributeNullable(&self) -> Option<bool> { Some(false) }
|
||||
pub fn SetBooleanAttributeNullable(&self, _: Option<bool>) {}
|
||||
|
@ -55,6 +58,8 @@ impl TestBinding {
|
|||
pub fn SetFloatAttributeNullable(&self, _: Option<f32>) {}
|
||||
pub fn GetDoubleAttributeNullable(&self) -> Option<f64> { Some(0.) }
|
||||
pub fn SetDoubleAttributeNullable(&self, _: Option<f64>) {}
|
||||
pub fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(~"") }
|
||||
pub fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
|
||||
|
||||
// FIXME (issue #1813) Doesn't currently compile.
|
||||
// pub fn PassOptionalBoolean(&self, _: Option<bool>) {}
|
||||
|
@ -68,6 +73,7 @@ impl TestBinding {
|
|||
// pub fn PassOptionalUnsignedLongLong(&self, _: Option<u64>) {}
|
||||
// pub fn PassOptionalFloat(&self, _: Option<f32>) {}
|
||||
// pub fn PassOptionalDouble(&self, _: Option<f64>) {}
|
||||
pub fn PassOptionalString(&self, _: Option<DOMString>) {}
|
||||
|
||||
pub fn PassOptionalBooleanWithDefault(&self, _: bool) {}
|
||||
pub fn PassOptionalByteWithDefault(&self, _: i8) {}
|
||||
|
@ -78,6 +84,7 @@ impl TestBinding {
|
|||
pub fn PassOptionalUnsignedLongWithDefault(&self, _: u32) {}
|
||||
pub fn PassOptionalLongLongWithDefault(&self, _: i64) {}
|
||||
pub fn PassOptionalUnsignedLongLongWithDefault(&self, _: u64) {}
|
||||
pub fn PassOptionalStringWithDefault(&self, _: DOMString) {}
|
||||
|
||||
pub fn PassOptionalNullableBooleanWithDefault(&self, _: Option<bool>) {}
|
||||
pub fn PassOptionalNullableByteWithDefault(&self, _: Option<i8>) {}
|
||||
|
@ -90,6 +97,7 @@ impl TestBinding {
|
|||
pub fn PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>) {}
|
||||
pub fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>) {}
|
||||
pub fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>) {}
|
||||
// pub fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
|
||||
}
|
||||
|
||||
impl Reflectable for TestBinding {
|
||||
|
|
|
@ -14,6 +14,7 @@ interface TestBinding {
|
|||
attribute unsigned long long unsignedLongLongAttribute;
|
||||
attribute float floatAttribute;
|
||||
attribute double doubleAttribute;
|
||||
attribute DOMString stringAttribute;
|
||||
|
||||
attribute boolean? booleanAttributeNullable;
|
||||
attribute byte? byteAttributeNullable;
|
||||
|
@ -26,6 +27,7 @@ interface TestBinding {
|
|||
attribute unsigned long long? unsignedLongLongAttributeNullable;
|
||||
attribute float? floatAttributeNullable;
|
||||
attribute double? doubleAttributeNullable;
|
||||
attribute DOMString? stringAttributeNullable;
|
||||
|
||||
// FIXME (issue #1813) Doesn't currently compile.
|
||||
// void passOptionalBoolean(optional boolean arg);
|
||||
|
@ -39,6 +41,7 @@ interface TestBinding {
|
|||
// void passOptionalUnsignedLongLong(optional unsigned long long arg);
|
||||
// void passOptionalFloat(optional float arg);
|
||||
// void passOptionalDouble(optional double arg);
|
||||
void passOptionalString(optional DOMString arg);
|
||||
|
||||
void passOptionalBooleanWithDefault(optional boolean arg = false);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
|
@ -49,6 +52,7 @@ interface TestBinding {
|
|||
void passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6);
|
||||
void passOptionalLongLongWithDefault(optional long long arg = -12);
|
||||
void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17);
|
||||
void passOptionalStringWithDefault(optional DOMString arg = "");
|
||||
|
||||
void passOptionalNullableBooleanWithDefault(optional boolean? arg = null);
|
||||
void passOptionalNullableByteWithDefault(optional byte? arg = null);
|
||||
|
@ -59,4 +63,5 @@ interface TestBinding {
|
|||
void passOptionalNullableUnsignedLongWithDefault(optional unsigned long? arg = null);
|
||||
void passOptionalNullableLongLongWithDefault(optional long long? arg = null);
|
||||
void passOptionalNullableUnsignedLongLongWithDefault(optional unsigned long long? arg = null);
|
||||
// void passOptionalNullableStringWithDefault(optional DOMString? arg = null);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue