patch 8.2.4799: popup does not use correct topline

Problem:    Popup does not use correct topline.
Solution:   Also add one when firstline is negative. (closes #10229)
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index b91689e..3e5373c 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -514,6 +514,19 @@
   call assert_equal(5, popup_getpos(winid).firstline)
 
   call popup_close(winid)
+
+  " Popup with less elements than the maximum height and negative firstline:
+  " check that the popup height is correctly computed.
+  let winid = popup_create(['xxx']->repeat(4), #{
+        \ firstline: -1,
+        \ maxheight: 6,
+	\ })
+
+  let pos = popup_getpos(winid)
+  call assert_equal(3, pos.width)
+  call assert_equal(4, pos.height)
+
+  call popup_close(winid)
 endfunc
 
 func Test_popup_firstline_cursorline()