[Tests] Added extra check for static initialization to DataBindingTestbed
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/6ecf8916 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/6ecf8916 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/6ecf8916 Branch: refs/heads/develop Commit: 6ecf8916c12837db431e5ffaa69e3d32efdef0c9 Parents: 4262fbe Author: greg-dove <greg.d...@gmail.com> Authored: Tue Oct 11 18:25:36 2016 +1300 Committer: greg-dove <greg.d...@gmail.com> Committed: Tue Oct 11 18:25:36 2016 +1300 ---------------------------------------------------------------------- .../DataBindingTestbed/src/MyInitialView.mxml | 19 ++++++++ .../bindables/BindableWithConstructorInit.as | 46 ++++++++++++++++++++ 2 files changed, 65 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6ecf8916/manualtests/DataBindingTestbed/src/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/manualtests/DataBindingTestbed/src/MyInitialView.mxml b/manualtests/DataBindingTestbed/src/MyInitialView.mxml index 3f788fe..67d5ac7 100644 --- a/manualtests/DataBindingTestbed/src/MyInitialView.mxml +++ b/manualtests/DataBindingTestbed/src/MyInitialView.mxml @@ -174,6 +174,25 @@ limitations under the License. addErrorReport("problem with explicit dispatching from BindableSubVO3 ",e); } + test=null; + try { + test = BindableWithConstructorInit.STATIC_INIT; + if (test.value !="STATIC_INIT") { + throw new Error("problem with static init in BindableWithConstructorInit "); + } + test.value= "STATIC_INIT_CHANGED"; + } catch (e:Error) { + addErrorReport("problem with static init in BindableWithConstructorInit ",e); + } + + test=null; + try { + test = new BindableWithConstructorInit("string",99) + } catch (e:Error) { + addErrorReport("problem instantiating BindableWithConstructorInit ",e); + } + + } private var _expectedTarget:Object; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6ecf8916/manualtests/DataBindingTestbed/src/bindables/BindableWithConstructorInit.as ---------------------------------------------------------------------- diff --git a/manualtests/DataBindingTestbed/src/bindables/BindableWithConstructorInit.as b/manualtests/DataBindingTestbed/src/bindables/BindableWithConstructorInit.as new file mode 100644 index 0000000..b150bd3 --- /dev/null +++ b/manualtests/DataBindingTestbed/src/bindables/BindableWithConstructorInit.as @@ -0,0 +1,46 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package bindables +{ + + + [Bindable] + public class BindableWithConstructorInit + { + + public static const STATIC_INIT:BindableWithConstructorInit = new BindableWithConstructorInit( "STATIC_INIT" ,-1 ); + + public var ordinal:int; + public var value:String; + + public function BindableWithConstructorInit ( value:String, ordinal:int ) + { + this.value = value; + this.ordinal = ordinal; + } + + + + public function equals( other:BindableWithConstructorInit ):Boolean + { + return ( this.ordinal == other.ordinal && this.value == other.value ); + } + } + +} \ No newline at end of file