javauis/lcdui_qt/tsrc/src/com/nokia/openlcdui/mt/alert/AlertTest.java
changeset 79 2f468c1958d0
parent 23 98ccebc37403
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
   327         catch(IllegalStateException ise)
   327         catch(IllegalStateException ise)
   328         {
   328         {
   329         }
   329         }
   330 
   330 
   331         alert.setIndicator(null);
   331         alert.setIndicator(null);
       
   332         
       
   333         setIndicatorAdditionalTests();
       
   334     }
       
   335 
       
   336     private void setIndicatorAdditionalTests()
       
   337     {
       
   338         boolean failed = false;
       
   339         String s = "";
       
   340         
       
   341         Gauge[] g = 
       
   342         {
       
   343           new Gauge(null, true, 10, 1),      // interactive
       
   344           new Gauge("", false, 10, 1),        // has a label
       
   345           new Gauge("Label", false, 10, 1),   // has a label
       
   346 
       
   347           new Gauge(null, false, 10, 1),  // preferred width will be locked
       
   348           new Gauge(null, false, 10, 1),  // preferred height will be locked
       
   349           new Gauge(null, false, 10, 1),  // preferred width and height will be locked
       
   350 
       
   351           new Gauge(null, false, 10, 1), // layout will be changed
       
   352           new Gauge(null, false, 10, 1),  // to be added into another Alert
       
   353           new Gauge(null, false, 10, 1),  // to be added into Form
       
   354           new Gauge(null, false, 10, 1), // some Command(s) will be added using addCommand method
       
   355           new Gauge(null, false, 10, 1), // some Command(s) will be added using setDefaultCommand method
       
   356 
       
   357           new Gauge(null, false, 10, 1), // ItemCommandListener will be added to
       
   358       };
       
   359 
       
   360       g[3].setPreferredSize(5, -1);
       
   361       g[4].setPreferredSize(-1, 5);
       
   362       g[5].setPreferredSize(5, 5);
       
   363       g[6].setLayout(Item.LAYOUT_CENTER);
       
   364       new Alert("Another Alert").setIndicator(g[7]);
       
   365       new Form("Another Form", new Item[]{g[8]});
       
   366       g[9].addCommand(new Command("Command", Command.OK, 0));
       
   367       g[10].setDefaultCommand(new Command("Command", Command.OK, 0));
       
   368       g[11].setItemCommandListener(new ItemCommandListener() 
       
   369       { 
       
   370           public void commandAction(Command c, Item item)
       
   371           {}
       
   372       });
       
   373 
       
   374       for(int i=0; i != g.length; ++i) 
       
   375       {
       
   376           try 
       
   377           {
       
   378             new Alert("Test Alert").setIndicator(g[i]);
       
   379             s = "IllegalStateException expected: index = "+i;
       
   380             failed = true;
       
   381           } catch(IllegalArgumentException ise) {
       
   382           }
       
   383       }
       
   384 
       
   385       if (failed)
       
   386       {
       
   387           fail("8. " + s);
       
   388       }
       
   389       return; 
   332     }
   390     }
   333 
   391 
   334     /**
   392     /**
   335      * Tests commands on Alert.
   393      * Tests commands on Alert.
   336      */
   394      */