package com.farmerbb.taskbar.ui;

import android.graphics.PixelFormat;
import android.view.Gravity;
import android.view.WindowManager;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;

import static org.junit.Assert.assertEquals;

@RunWith(RobolectricTestRunner.class)
public class ViewParamsTest {
    @Test
    public void testToWindowManagerParams() {
        int width = 100;
        int height = 101;
        int gravity = Gravity.BOTTOM;
        int flags = 1001;
        ViewParams params = new ViewParams(width, height, gravity, flags);
        WindowManager.LayoutParams generatedParams = params.toWindowManagerParams();
        assertEquals(width, generatedParams.width);
        assertEquals(height, generatedParams.height);
        assertEquals(gravity, generatedParams.gravity);
        assertEquals(flags, generatedParams.flags);
        assertEquals(PixelFormat.TRANSLUCENT, generatedParams.format);
        assertEquals(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, generatedParams.type);
        params.gravity = -1;
        generatedParams = params.toWindowManagerParams();
        assertEquals(0, generatedParams.gravity);
    }
}

@@ -513,24 +513,56 @@
 ags = 1001;%0A
+        int bottomMargin = 102;%0A
         View
@@ -617,24 +617,38 @@
 avity, flags
+, bottomMargin
 );%0A        W
@@ -937,16 +937,71 @@
 flags);%0A
+        assertEquals(bottomMargin, generatedParams.y);%0A
         
@@ -1239,32 +1239,32 @@
 anagerParams();%0A
-
         assertEq
@@ -1293,20 +1293,156 @@
 s.gravity);%0A
+        params.bottomMargin = -1;%0A        generatedParams = params.toWindowManagerParams();%0A        assertEquals(0, generatedParams.y);%0A
     %7D%0A%7D%0A

Fix tests