Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 424480fb authored by Mark Harman's avatar Mark Harman
Browse files

Fix testRightLayout() due to changes to have gallery button avoid privacy indicator.

parent cf79c056
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import net.sourceforge.opencamera.SaveLocationHistory;
import net.sourceforge.opencamera.cameracontroller.CameraController;
import net.sourceforge.opencamera.preview.Preview;
import net.sourceforge.opencamera.ui.FolderChooserDialog;
import net.sourceforge.opencamera.ui.MainUI;
import net.sourceforge.opencamera.ui.PopupView;
import android.annotation.SuppressLint;
@@ -8742,18 +8743,20 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
        Log.d(TAG, "gallery right: " + galleryButton.getRight());
        Log.d(TAG, "gallery top: " + galleryButton.getTop());
        final float scale = mActivity.getResources().getDisplayMetrics().density;
        int expected_gap = (int) (MainUI.privacy_indicator_gap_dp * scale + 0.5f); // convert dps to pixels;
        if( mActivity.getSystemOrientation() == MainActivity.SystemOrientation.PORTRAIT ) {
            assertTrue(settingsButton.getBottom() > (int)(0.8*display_size.y));
            assertEquals(display_size.x, settingsButton.getRight());
            // position may be 1 coordinate different on some devices, e.g., Galaxy Nexus
            assertEquals((double)(display_size.y-1), (double)(galleryButton.getBottom()), 1.0+1.0e-5);
            assertEquals(display_size.x, galleryButton.getRight());
            assertEquals((double)(display_size.y-1-expected_gap), (double)(galleryButton.getBottom()), 1.0+1.0e-5);
            assertEquals(display_size.x-expected_gap, galleryButton.getRight());
        }
        else {
            assertTrue(settingsButton.getRight() > (int)(0.8*display_size.x));
            assertEquals(0, settingsButton.getTop());
            assertEquals(display_size.x, galleryButton.getRight());
            assertEquals(0, galleryButton.getTop());
            assertEquals(display_size.x-expected_gap, galleryButton.getRight());
            assertEquals(expected_gap, galleryButton.getTop());
        }
        {
@@ -8773,14 +8776,14 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv
            assertTrue(settingsButton.getBottom() < (int)(0.2*display_size.y));
            assertEquals(display_size.x, settingsButton.getRight());
            // position may be 1 coordinate different on some devices, e.g., Galaxy Nexus
            assertEquals((double)(display_size.y-1), (double)(galleryButton.getBottom()), 1.0+1.0e-5);
            assertEquals(display_size.x, galleryButton.getRight());
            assertEquals((double)(display_size.y-1-expected_gap), (double)(galleryButton.getBottom()), 1.0+1.0e-5);
            assertEquals(display_size.x-expected_gap, galleryButton.getRight());
        }
        else {
            assertTrue(settingsButton.getRight() < (int)(0.2*display_size.x));
            assertEquals(0, settingsButton.getTop());
            assertEquals(display_size.x, galleryButton.getRight());
            assertEquals(0, galleryButton.getTop());
            assertEquals(display_size.x-expected_gap, galleryButton.getRight());
            assertEquals(expected_gap, galleryButton.getTop());
        }
        assertFalse(mActivity.popupIsOpen());
+3 −2
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ public class MainUI {
    private boolean view_rotate_animation;
    private float view_rotate_animation_start; // for MainActivity.lock_to_landscape==false
    private final static int view_rotate_animation_duration = 100; // duration in ms of the icon rotation animation
    public final static int privacy_indicator_gap_dp = 24;

    private boolean immersive_mode;
    private boolean show_gui_photo = true; // result of call to showGUI() - false means a "reduced" GUI is displayed, whilst taking photo or video
@@ -380,9 +381,9 @@ public class MainUI {
            if( ui_placement != UIPlacement.UIPLACEMENT_LEFT ) {
                // if we did want to do this for UIPLACEMENT_LEFT for consistency, it'd be the
                // "bottom" margin we need to change.
                gallery_top_gap = (int) (24 * scale + 0.5f); // convert dps to pixels
                gallery_top_gap = (int) (privacy_indicator_gap_dp * scale + 0.5f); // convert dps to pixels
            }
            int privacy_indicator_gap = (int) (24 * scale + 0.5f); // convert dps to pixels
            int privacy_indicator_gap = (int) (privacy_indicator_gap_dp * scale + 0.5f); // convert dps to pixels
            gallery_navigation_gap += privacy_indicator_gap;
        }
        test_navigation_gap = navigation_gap;