Commits

Anonymous committed b84cd42

Added tests for hash and equals.

  • Participants
  • Parent commits 6918eaf

Comments (0)

Files changed (2)

File test/TestComponent.fan

     verifyEq(Monitor.primary.dpi.w, wrap.getVerticalScreenDPI)
   }
   
-  public Void testCheckType()
+  virtual public Void testCheckType()
   {
     verifyEq(ComponentWrapper.TYPE_LABEL, wrap.checkType(false))
   }
 //    echo(wrap.getPixelUnitFactor(false))
 //    echo(wrap.getPixelUnitFactor(true))
 //  }
+  
+  virtual public Void testEqualsHash(){
+    test := Label { text = "test"}
+    test2 := Label { text = "test2"}
+    ww1 := WidgetWrapper(test)
+    ww1_1 := WidgetWrapper(test)
+    ww2 := WidgetWrapper(test2)
+ 
+    verifyEq(ww1, ww1_1)
+    verifyEq(ww1.hash, ww1_1.hash)
+    
+    verifyNotEq(ww1, ww2)
+    verifyNotEq(ww1.hash, ww2.hash)
+    
+  }
   
 }

File test/TestContainer.fan

 //
 
 using gfx
-using fwt
+using fwt
+using [java] net.miginfocom.layout::ComponentWrapper
 **
 **
 **
       verifyEq(m,mwrap.comp)
       verifyEq(m,mwrap.content)
       verifyEq(mwrap.comp,mwrap.content)
-    }
+    }
+  
+    override Void testCheckType()
+    {
+       verifyEq(ComponentWrapper.TYPE_CONTAINER, wrap.checkType(false))
+    }
+  
+  
+    override public Void testEqualsHash()
+    {
+      test := ContentPane {Label { text = "test"},}
+      test2 := ContentPane {Label { text = "test2"},}
+      ww1 := PaneWrapper(test)
+      ww1_1 := PaneWrapper(test)
+      ww2 := PaneWrapper(test2)
+   
+      verifyEq(ww1, ww1_1)
+      verifyEq(ww1.hash, ww1_1.hash)
+      
+      verifyNotEq(ww1, ww2)
+      verifyNotEq(ww1.hash, ww2.hash)
+      
+  }
 }