[kune-commits] r941 - in trunk: img/icons img/icons/persons src/main/java/org/ourproject/kune/platf/client/dto src/main/java/org/ourproject/kune/platf/client/services src/main/java/org/ourproject/kune/platf/public/images/persons src/main/java/org/ourproject/kune/workspace/client/entitylogo src/test/java/org/ourproject/kune/platf/integration/selenium src/test/java/org/ourproject/kune/workspace/client src/test/java/org/ourproject/kune/workspace/client/entitylogo

vjrj vjrj at ourproject.org
Thu Nov 6 01:35:04 CET 2008


Author: vjrj
Date: 2008-11-06 01:35:01 +0100 (Thu, 06 Nov 2008)
New Revision: 941

Added:
   trunk/img/icons/persons/person2-60.png
   trunk/src/main/java/org/ourproject/kune/platf/public/images/persons/person2-60.png
   trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/
   trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenterTest.java
Modified:
   trunk/img/icons/person.svg
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/EntityLogoSeleniumTest.java
Log:
Complete - task Personal homepage logo 


Modified: trunk/img/icons/person.svg
===================================================================
--- trunk/img/icons/person.svg	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/img/icons/person.svg	2008-11-06 00:35:01 UTC (rev 941)
@@ -45,8 +45,8 @@
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="1280"
-     inkscape:window-height="951"
+     inkscape:window-width="1270"
+     inkscape:window-height="773"
      inkscape:window-x="1280"
      inkscape:window-y="25" />
   <metadata
@@ -658,5 +658,34 @@
          d="M 459.05116,237.9606 C 454.38897,244.83149 431.14686,253.27664 423.78848,245.95076 C 416.51844,238.7128 416.5378,226.91334 423.78848,219.65598 C 431.03916,212.39863 442.80837,212.39863 450.05905,219.65599 C 457.30973,226.91335 454.3126,230.25764 459.05116,237.9606 z"
          style="fill:#da5f0e;fill-opacity:1;fill-rule:nonzero;stroke:#673030;stroke-width:5.30990171;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
     </g>
+    <g
+       id="g2497"
+       transform="matrix(0.7058822,0,0,0.7059232,202.61473,-43.156624)"
+       inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/icons/persons/person2-60.png"
+       inkscape:export-xdpi="90"
+       inkscape:export-ydpi="90">
+      <path
+         inkscape:export-ydpi="90"
+         inkscape:export-xdpi="90"
+         inkscape:export-filename="/home/vjrj/proyectos/ourproject.org/kune/svn/trunk/img/group-def-icon.png"
+         sodipodi:type="arc"
+         style="opacity:1;fill:#eeaaff;fill-opacity:1;fill-rule:nonzero;stroke:#954f2c;stroke-width:1.63299322;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         id="path2499"
+         sodipodi:cx="-55.5"
+         sodipodi:cy="242.36218"
+         sodipodi:rx="12.5"
+         sodipodi:ry="12"
+         d="M -43,242.36218 A 12.5,12 0 1 1 -68,242.36218 A 12.5,12 0 1 1 -43,242.36218 z"
+         transform="matrix(3.1844753,0,0,3.3202165,608.65933,-692.76155)" />
+      <path
+         id="path2501"
+         d="M 431.92095,72.158845 C 421.73175,72.158845 411.49371,76.003865 403.72508,83.779605 C 388.30176,99.217125 388.19614,124.14781 403.39336,139.72526 C 401.23073,130.24809 403.98472,119.87609 411.35455,112.49948 C 422.75019,101.09333 441.09171,101.09333 452.48735,112.49948 C 459.85713,119.87609 462.61117,130.24809 460.44854,139.72526 C 475.64581,124.14776 475.54025,99.217125 460.11683,83.779605 C 452.34825,76.003865 442.11016,72.158845 431.92095,72.158845 z"
+         style="fill:#dbdee3;fill-opacity:1;fill-rule:nonzero;stroke:#954f2c;stroke-width:5.30990267;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
+      <path
+         style="fill:#ff9955;fill-opacity:1;fill-rule:nonzero;stroke:#784421;stroke-width:5.30990171;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         d="M 454.05116,106.46307 C 449.38897,113.33396 426.14686,121.7791 418.78848,114.45323 C 411.51844,107.21527 411.5378,95.415805 418.78848,88.158448 C 426.03916,80.901092 437.80837,80.901094 445.05905,88.158453 C 452.30973,95.415815 449.3126,98.760105 454.05116,106.46307 z"
+         id="path2503"
+         sodipodi:nodetypes="csssc" />
+    </g>
   </g>
 </svg>

Added: trunk/img/icons/persons/person2-60.png
===================================================================
(Binary files differ)


Property changes on: trunk/img/icons/persons/person2-60.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -122,6 +122,10 @@
         return getHasLogo();
     }
 
+    public boolean isPersonalGroup() {
+        return groupType.equals(GroupType.PERSONAL);
+    }
+
     public void setDefaultContent(final ContentSimpleDTO defaultContent) {
         this.defaultContent = defaultContent;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -339,6 +339,9 @@
     @Resource("org/ourproject/kune/platf/public/images/opentriangle.gif")
     AbstractImagePrototype opentriangle();
 
+    @Resource("org/ourproject/kune/platf/public/images/persons/person2-60.png")
+    AbstractImagePrototype personAvatarDef();
+
     @Resource("org/ourproject/kune/platf/public/images/person-def.png")
     AbstractImagePrototype personDef();
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -253,7 +253,7 @@
                 final EntityLogoPresenter presenter = new EntityLogoPresenter($(StateManager.class),
                         $(WsThemePresenter.class), $(Session.class));
                 final EntityLogoPanel panel = new EntityLogoPanel($(I18nUITranslationService.class),
-                        $(WorkspaceSkeleton.class), $$(FileDownloadUtils.class), $$(EntityLogoSelector.class));
+                        $(WorkspaceSkeleton.class), $$(FileDownloadUtils.class), $$(EntityLogoSelector.class), $(Images.class));
                 presenter.init(panel);
                 return presenter;
             }

Added: trunk/src/main/java/org/ourproject/kune/platf/public/images/persons/person2-60.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/public/images/persons/person2-60.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPanel.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -24,11 +24,13 @@
 import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.services.Images;
 import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 import org.ourproject.kune.workspace.client.themes.WsTheme;
 
 import com.calclab.suco.client.ioc.Provider;
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
 import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Image;
@@ -103,6 +105,10 @@
             setLogoText("");
         }
 
+        public void setChangeYourAvatarText() {
+            putYourLogoHL.setText(i18n.t("Change Your Avatar"));
+        }
+
         public void setChangeYourLogo() {
             putYourLogoHL.setText(i18n.t("Change Your Logo"));
         }
@@ -112,6 +118,10 @@
             logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE);
         }
 
+        public void setLogoImage(AbstractImagePrototype imageProto) {
+            imageProto.applyTo(logoImage);
+        }
+
         public void setLogoImage(final String url) {
             Image.prefetch(url);
             logoImage.setUrl(url);
@@ -130,6 +140,10 @@
             logoLabel.addStyleName(LOGO_MEDIUM_FONT_STYLE);
         }
 
+        public void setPutYourAvatarText() {
+            putYourLogoHL.setText(i18n.t("Put Your Avatar Here"));
+        }
+
         public void setPutYourLogo() {
             putYourLogoHL.setText(i18n.t("Put Your Logo Here"));
         }
@@ -157,21 +171,27 @@
     private final Provider<EntityLogoSelector> entityLogoSelectorProvider;
     private EntityTextLogo entityTextLogo;
     private final I18nTranslationService i18n;
+    private final Images images;
 
     public EntityLogoPanel(final I18nTranslationService i18n, final WorkspaceSkeleton ws,
             final Provider<FileDownloadUtils> dowloadProvider,
-            final Provider<EntityLogoSelector> entityLogoSelectorProvider) {
+            final Provider<EntityLogoSelector> entityLogoSelectorProvider, Images images) {
         this.i18n = i18n;
         this.downloadProvider = dowloadProvider;
         this.entityLogoSelectorProvider = entityLogoSelectorProvider;
+        this.images = images;
         ws.addToEntityMainHeader(this);
     }
 
     public void reloadImage(GroupDTO group) {
-        entityTextLogo.setLogoImage(downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache="
-                + new Date().getTime());
+        getEntityTextLogo().setLogoImage(
+                downloadProvider.get().getLogoImageUrl(group.getStateToken()) + "&nocache=" + new Date().getTime());
     }
 
+    public void setChangeYourAvatarText() {
+        getEntityTextLogo().setChangeYourAvatarText();
+    }
+
     public void setChangeYourLogoText() {
         getEntityTextLogo().setChangeYourLogo();
 
@@ -213,6 +233,10 @@
         getEntityTextLogo().setMediumFont();
     }
 
+    public void setPutYourAvatarText() {
+        getEntityTextLogo().setPutYourAvatarText();
+    }
+
     public void setPutYourLogoText() {
         getEntityTextLogo().setPutYourLogo();
     }
@@ -232,6 +256,10 @@
         getEntityTextLogo().addStyleDependentName(newTheme.toString());
     }
 
+    public void showDefUserLogo() {
+        getEntityTextLogo().setLogoImage(images.personAvatarDef());
+    }
+
     private EntityTextLogo getEntityTextLogo() {
         if (entityTextLogo == null) {
             this.entityTextLogo = new EntityTextLogo(entityLogoSelectorProvider);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -20,6 +20,7 @@
 
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
@@ -46,14 +47,7 @@
         });
         stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
             public void onEvent(final StateAbstractDTO state) {
-                final boolean isAdmin = state.getGroupRights().isAdministrable();
-                if (state.getGroup().hasLogo()) {
-                    view.setChangeYourLogoText();
-                    view.setSetYourLogoVisible(isAdmin);
-                } else {
-                    view.setPutYourLogoText();
-                    view.setSetYourLogoVisible(isAdmin);
-                }
+                setEntityLogoLink(state);
             }
         });
         theme.onThemeChanged(new Listener2<WsTheme, WsTheme>() {
@@ -75,21 +69,47 @@
         view.reloadImage(session.getCurrentState().getGroup());
     }
 
-    private void setGroupLogo(final GroupDTO group) {
+    void setEntityLogoLink(final StateAbstractDTO state) {
+        final boolean isAdmin = state.getGroupRights().isAdministrable();
+        switch (state.getGroup().getGroupType()) {
+        case PERSONAL:
+            if (state.getGroup().hasLogo()) {
+                view.setChangeYourAvatarText();
+            } else {
+                view.setPutYourAvatarText();
+            }
+            break;
+        default:
+            if (state.getGroup().hasLogo()) {
+                view.setChangeYourLogoText();
+            } else {
+                view.setPutYourLogoText();
+            }
+            break;
+        }
+        view.setSetYourLogoVisible(isAdmin);
+    }
+
+    void setGroupLogo(final GroupDTO group) {
         final ContentSimpleDTO groupFullLogo = group.getGroupFullLogo();
         if (groupFullLogo != null) {
             view.setFullLogo(groupFullLogo.getStateToken(), true);
         } else if (group.hasLogo()) {
+            setLogoText(group.getLongName());
             view.setLogoImage(group.getStateToken());
-            setLogoText(group.getLongName());
             view.setLogoImageVisible(true);
         } else {
             setLogoText(group.getLongName());
-            view.setLogoImageVisible(false);
+            if (group.getGroupType().equals(GroupType.PERSONAL)) {
+                view.showDefUserLogo();
+                view.setLogoImageVisible(true);
+            } else {
+                view.setLogoImageVisible(false);
+            }
         }
     }
 
-    private void setLogoText(String name) {
+    void setLogoText(String name) {
         int length = name.length();
         if (length <= GROUP_LARGE_NAME_LIMIT_SIZE) {
             view.setLargeFont();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -39,7 +39,8 @@
 
 public class EntityLogoSelectorPanel implements EntityLogoSelectorView {
 
-    public static final String TITLE = "Select a logo for your group";
+    public static final String NORMAL_TITLE = "Select a logo for your group";
+    public static final String PERSON_TITLE = "Select your avatar";
     public static final String ICON_UPLOAD_SERVLET = "/kune/servlets/EntityLogoUploadManager";
     public static final String SUBID = "k-elogoselp-subb";
     public static final String CANCELID = "k-elogoselp-canb";
@@ -49,10 +50,13 @@
     private final Hidden userhashField;
     private final Hidden tokenField;
     private final TextField file;
+    private final Label dialogInfoLabel;
+    private final I18nTranslationService i18n;
 
     public EntityLogoSelectorPanel(final EntityLogoSelectorPresenter presenter, final WorkspaceSkeleton ws,
             I18nTranslationService i18n) {
-        dialog = new BasicDialogExtended(i18n.t(TITLE), true, true, 400, 200, "", i18n.t("Select"), SUBID,
+        this.i18n = i18n;
+        dialog = new BasicDialogExtended(i18n.t(NORMAL_TITLE), true, true, 400, 200, "", i18n.t("Select"), SUBID,
                 i18n.tWithNT("Cancel", "used in button"), CANCELID, new Listener0() {
                     public void onEvent() {
                         String filename = file.getValueAsString();
@@ -95,16 +99,8 @@
                 presenter.onSubmitFailed(httpStatus, responseText);
             }
         });
-        // We will automatically resize images to 64x64 pixels. For good
-        // results, start with a square image. For best results, use a 64x64
-        // pixel image.
-        String text = i18n.t("Select an image in your computer as the logo for this group. "
-                + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
-                EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT);
-        Label label = new Label();
-        label.setHtml(text + "<br/><br/>");
-
-        formPanel.add(label);
+        dialogInfoLabel = new Label();
+        formPanel.add(dialogInfoLabel);
         file = new TextField("File", EntityLogoView.LOGO_FORM_FIELD);
         EventCallback keyListener = new EventCallback() {
             public void execute(EventObject e) {
@@ -145,6 +141,22 @@
         formPanel.getForm().reset();
     }
 
+    public void setNormalGroupsLabels() {
+        dialogInfoLabel.setHtml(i18n.t("Select an image in your computer as the logo for this group. "
+                + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
+                EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT)
+                + "<br/><br/>");
+        dialog.setTitle(NORMAL_TITLE);
+    }
+
+    public void setPersonalGroupsLabels() {
+        dialogInfoLabel.setHtml(i18n.t("Select an image in your computer as your avatar. "
+                + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
+                EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT)
+                + "<br/><br/>");
+        dialog.setTitle(PERSON_TITLE);
+    }
+
     public void setUploadParams(String userHash, String token) {
         userhashField.setValue(userHash);
         tokenField.setValue(token);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPresenter.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -59,6 +59,11 @@
         session.check(new AsyncCallbackSimple<Object>() {
             public void onSuccess(Object result) {
                 view.setUploadParams(session.getUserHash(), session.getCurrentStateToken().toString());
+                if (session.getCurrentState().getGroup().isPersonalGroup()) {
+                    view.setPersonalGroupsLabels();
+                } else {
+                    view.setNormalGroupsLabels();
+                }
                 view.show();
             }
         });

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorView.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -23,6 +23,10 @@
 public interface EntityLogoSelectorView extends View {
     void hide();
 
+    void setNormalGroupsLabels();
+
+    void setPersonalGroupsLabels();
+
     void setUploadParams(String userHash, String token);
 
     void show();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoView.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -34,6 +34,8 @@
 
     void reloadImage(GroupDTO group);
 
+    void setChangeYourAvatarText();
+
     void setChangeYourLogoText();
 
     void setFullLogo(StateToken stateToken, boolean clipped);
@@ -48,6 +50,8 @@
 
     void setMediumFont();
 
+    void setPutYourAvatarText();
+
     void setPutYourLogoText();
 
     void setSetYourLogoVisible(final boolean visible);
@@ -55,4 +59,6 @@
     void setSmallFont();
 
     void setTheme(final WsTheme oldTheme, WsTheme newTheme);
+
+    void showDefUserLogo();
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/EntityLogoSeleniumTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/EntityLogoSeleniumTest.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/EntityLogoSeleniumTest.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -20,7 +20,7 @@
 
     private void setLogo(String filename) throws Exception, IOException {
         click(gid(EntityLogoPanel.PUT_YOUR_LOGO_LINK));
-        waitForTextInside(EntityLogoSelectorPanel.DIALOG_ID, EntityLogoSelectorPanel.TITLE);
+        waitForTextInside(EntityLogoSelectorPanel.DIALOG_ID, EntityLogoSelectorPanel.NORMAL_TITLE);
         File dir = new File(".");
         type(EntityLogoView.LOGO_FORM_FIELD, dir.getCanonicalPath() + File.separator + "img" + File.separator
                 + filename);

Added: trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenterTest.java	2008-11-05 22:07:07 UTC (rev 940)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenterTest.java	2008-11-06 00:35:01 UTC (rev 941)
@@ -0,0 +1,87 @@
+package org.ourproject.kune.workspace.client.entitylogo;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
+
+public class EntityLogoPresenterTest {
+
+    private StateManager stateManager;
+    private Session session;
+    private EntityLogoPresenter entityLogoPresenter;
+    private EntityLogoView view;
+
+    @Before
+    public void before() {
+        stateManager = Mockito.mock(StateManager.class);
+        session = Mockito.mock(Session.class);
+        WsThemePresenter theme = Mockito.mock(WsThemePresenter.class);
+        entityLogoPresenter = new EntityLogoPresenter(stateManager, theme, session);
+        view = Mockito.mock(EntityLogoView.class);
+        entityLogoPresenter.init(view);
+    }
+
+    @Test
+    public void testCommProjectNoLogo() {
+        GroupDTO group = new GroupDTO("shortname", "longname", GroupType.COMMUNITY);
+        group.setHasLogo(false);
+        entityLogoPresenter.setGroupLogo(group);
+        Mockito.verify(view, Mockito.never()).setLogoImageVisible(true);
+        Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(false);
+        Mockito.verify(view, Mockito.never()).showDefUserLogo();
+        Mockito.verify(view, Mockito.never()).setLogoImage((StateToken) Mockito.anyObject());
+    }
+
+    @Test
+    public void testCommunityWithLogo() {
+        testGroupWIthLogo(GroupType.COMMUNITY);
+    }
+
+    @Test
+    public void testOrgWithLogo() {
+        testGroupWIthLogo(GroupType.ORGANIZATION);
+    }
+
+    @Test
+    public void testOrphWithLogo() {
+        testGroupWIthLogo(GroupType.ORPHANED_PROJECT);
+    }
+
+    @Test
+    public void testPersonalGroupWithLogo() {
+        testGroupWIthLogo(GroupType.PERSONAL);
+    }
+
+    @Test
+    public void testPersonalProjectNoLogo() {
+        GroupDTO group = new GroupDTO("shortname", "longname", GroupType.PERSONAL);
+        group.setHasLogo(false);
+        entityLogoPresenter.setGroupLogo(group);
+        Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(true);
+        Mockito.verify(view, Mockito.never()).setLogoImageVisible(false);
+        Mockito.verify(view, Mockito.times(1)).showDefUserLogo();
+        Mockito.verify(view, Mockito.never()).setLogoImage((StateToken) Mockito.anyObject());
+    }
+
+    @Test
+    public void testProjectWithLogo() {
+        testGroupWIthLogo(GroupType.PROJECT);
+    }
+
+    private void testGroupWIthLogo(GroupType groupType) {
+        GroupDTO group = new GroupDTO("shortname", "longname", groupType);
+        group.setHasLogo(true);
+        entityLogoPresenter.setGroupLogo(group);
+        Mockito.verify(view, Mockito.times(1)).setLogoImageVisible(true);
+        Mockito.verify(view, Mockito.never()).setLogoImageVisible(false);
+        Mockito.verify(view, Mockito.never()).showDefUserLogo();
+        Mockito.verify(view, Mockito.times(1)).setLogoImage((StateToken) Mockito.anyObject());
+    }
+
+}




More information about the kune-commits mailing list