#include<bits/stdc++.h>
using namespace std;
#define int long long
#define bug(a) cout << #a << " : " << a << '\n';
void solve(int cs){
int n,m;cin >> n >>m;
char arr[n+1][m+1];
bool ok = false;
for (int i = 0; i < n; ++i)
{
for(int j = 0;j < m ; ++j){
cin >> arr[i][j];
if(arr[i][j] == '+')ok = true;
}
}
if(ok == false){
cout << 0 << '\n';
return;
}
int a ,b,c,d,cnt = 1;
int mx = INT_MIN;
for (int i = 0; i < n; ++i)
{
for(int j = 0;j < m ; ++j){
if(arr[i][j] == '+'){
a= i-1;
b = j+1;
c = i +1;
d = j-1;
while(arr[a][j] == '+' and arr[i][b] == '+'
and arr[c][j] == '+' and arr[i][d] == '+'){
a--;
b++;
c++;
d--;
cnt += 4;
}
mx = max(cnt,mx);
cnt = 1;
}
}
}
cout << mx << '\n';
}
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int t; cin>>t;
int cs = 0;
while(t--){
solve(++cs);
}
return 0;
}