Home | History | Annotate | Download | only in layout
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ide.common.layout;
     18 
     19 import com.android.ide.common.api.DropFeedback;
     20 import com.android.ide.common.api.IDragElement;
     21 import com.android.ide.common.api.INode;
     22 import com.android.ide.common.api.Rect;
     23 
     24 /** Test the {@link ZoomControlsRule} */
     25 public class ZoomControlsRuleTest extends LayoutTestBase {
     26     public void testDoNothing() {
     27         String draggedButtonId = "@+id/DraggedButton";
     28 
     29         IDragElement[] elements = TestDragElement.create(TestDragElement.create(
     30                 "android.widget.Button").id(draggedButtonId));
     31 
     32         INode layout = TestNode.create("android.widget.ZoomControls").id("@+id/ZoomControls01")
     33         .bounds(new Rect(0, 0, 240, 480)).add(
     34                 TestNode.create("android.widget.Button").id("@+id/Button01").bounds(
     35                         new Rect(0, 0, 100, 80)),
     36                 TestNode.create("android.widget.Button").id("@+id/Button02").bounds(
     37                         new Rect(0, 100, 100, 80)),
     38                 TestNode.create("android.widget.Button").id("@+id/Button03").bounds(
     39                         new Rect(0, 200, 100, 80)),
     40                 TestNode.create("android.widget.Button").id("@+id/Button04").bounds(
     41                         new Rect(0, 300, 100, 80)));
     42 
     43         ZoomControlsRule rule = new ZoomControlsRule();
     44 
     45         // Enter target
     46         DropFeedback feedback = rule.onDropEnter(layout, null/*targetView*/, elements);
     47         // Zoom controls don't respond to drags
     48         assertNull(feedback);
     49     }
     50 }
     51